Question
Question 1 Which of the following statements about object-oriented programming is INCORRECT ? In object-oriented programming. Data and functions that manipulate them are usually separate
Question 1
Which of the following statements about object-oriented programming isINCORRECT?
- In object-oriented programming. Data and functions that manipulate them are usually separate entities that interact with each other.
- Objects can contain data, called "properties", and functions that manipulate the data, called "methods".
- Objects can hide certain details from other objects
- Objects often interact with each other much like they do in real life.
Question 2
Which of the following keyword is used in Java to define the blueprint of an object?
- class
- private
- constructor
- method
Question 3
In Java, which of these is a correct statement to call the constructor of the ancestor class named "Animal" with no parameters?
- Animal.constructor( );
- ancestor( ).
- super.constructor( );
- super( );
Question 4
If we want to extend a base class called "Flower" and call it "Rose", which of these is the correct syntax to do that in Java?
- public classFlowerdescendentRose{ }
- public classRoseextendsFlower{ }
- public classRoseasFlower{ }
- public classFlowerextendsRose{ }
Question 5
Which of the follow statement isCORRECTabout abstraction?
- Abstraction is a principle of object-oriented programming where abstract variable names are used to make the code more compact.
- Abstraction is the practice of making code more obscure to read and understand so other people who look at the code have no idea what it does.
- Abstraction is a way for base objects to behave more generically when compared to their descendents.
- Abstraction is the practice of hiding complex or proprietary processes from users of a class.
Question 6
In Java, if we have a propertyString secretCode, which of these declarations hides it from other users of the objects?
- nonpublicString secretCode;
- abstractString secretCode;
- privateString secretCode;
- hiddenString secretCode;
Question 7
Which of these statements about polymorphism iscorrect?
- Polymorphism makes it possible for methods of objects in the same object hierarchy to have different behaviors.
- Polymorphism allows objects to become other types of unrelated objects during program execution.
- Polymorphism refers to the principle of object-oriented programmer where one definition of an object can have multiple names.
- Polymorphism allows methods of an object to have different names in their descendents.
Question 8
If we want a methodpublicdoubleofferBestPrice( )in our object to have a completely different algorithm than the one in the ancestor class, how would we redefine it in our object?
- @Redefinepublic double offerBestPrice( )
- @Overridepublic double offerBestPrice( )
- #OVERRIDEpublic double offerBestPrice( )
- public double offerBestPrice( )
Question 9
What does the Java keyword "protected" do?
- When it is in front of a property or method definition, it makes that property or method accessible from within the class itselfONLY
- It makes everything in the class protected andinaccessibleto any code outside of the class.
- When it is in front of a property or method definition, it makes that property or method accessible from within the class itself andALSOfrom any descendent classes.
- It is used in front of a class declaration to make sure that the classCANNOTbe inherited by any descendent classes.
Question 10
Which of the following statements about constructors in Java isCORRECT?
- All the parameters in a constructor definition are optional at runtime.
- An objectCANhave multiple constructors as long as they have different names.
- An objectCANhave multiple constructors but they must have different parameter lists. The one matching the parameters provided by the caller at runtime will be called.
- An objectCANNOThave multiple constructors.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started