Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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?

  1. In object-oriented programming. Data and functions that manipulate them are usually separate entities that interact with each other.
  2. Objects can contain data, called "properties", and functions that manipulate the data, called "methods".
  3. Objects can hide certain details from other objects
  4. 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?

  1. class
  2. private
  3. constructor
  4. 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?

  1. Animal.constructor( );
  2. ancestor( ).
  3. super.constructor( );
  4. 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?

  1. public classFlowerdescendentRose{ }
  2. public classRoseextendsFlower{ }
  3. public classRoseasFlower{ }
  4. public classFlowerextendsRose{ }

Question 5

Which of the follow statement isCORRECTabout abstraction?

  1. Abstraction is a principle of object-oriented programming where abstract variable names are used to make the code more compact.
  2. 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.
  3. Abstraction is a way for base objects to behave more generically when compared to their descendents.
  4. 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?

  1. nonpublicString secretCode;
  2. abstractString secretCode;
  3. privateString secretCode;
  4. hiddenString secretCode;

Question 7

Which of these statements about polymorphism iscorrect?

  1. Polymorphism makes it possible for methods of objects in the same object hierarchy to have different behaviors.
  2. Polymorphism allows objects to become other types of unrelated objects during program execution.
  3. Polymorphism refers to the principle of object-oriented programmer where one definition of an object can have multiple names.
  4. 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?

  1. @Redefinepublic double offerBestPrice( )
  2. @Overridepublic double offerBestPrice( )
  3. #OVERRIDEpublic double offerBestPrice( )
  4. public double offerBestPrice( )

Question 9

What does the Java keyword "protected" do?

  1. When it is in front of a property or method definition, it makes that property or method accessible from within the class itselfONLY
  2. It makes everything in the class protected andinaccessibleto any code outside of the class.
  3. 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.
  4. 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?

  1. All the parameters in a constructor definition are optional at runtime.
  2. An objectCANhave multiple constructors as long as they have different names.
  3. 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.
  4. An objectCANNOThave multiple constructors.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions