Polymorphism - Objective Exercises

Polymorphism - Objective Exercises

University

11 Qs

quiz-placeholder

Similar activities

I Must Betray You Vocab (Baseline)

I Must Betray You Vocab (Baseline)

8th Grade - University

15 Qs

Chapter 1: The Fence Quiz (The Adventures of Tom Sawyer)

Chapter 1: The Fence Quiz (The Adventures of Tom Sawyer)

11th Grade - University

15 Qs

Area and Circumference of the Circle

Area and Circumference of the Circle

6th Grade - University

15 Qs

CBNS 120 MT 1 Review

CBNS 120 MT 1 Review

University

15 Qs

E P L Quiz

E P L Quiz

9th Grade - University

10 Qs

Geography/Vocab China Quiz

Geography/Vocab China Quiz

7th Grade - University

14 Qs

Unit 6 2D & 3D Shapes

Unit 6 2D & 3D Shapes

2nd Grade - University

10 Qs

Lesson 3-5 Assessment

Lesson 3-5 Assessment

5th Grade - University

15 Qs

Polymorphism - Objective Exercises

Polymorphism - Objective Exercises

Assessment

Quiz

others

University

Practice Problem

Hard

Created by

MOHAMMAD HARON

Used 3+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

11 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

45 sec • 2 pts

Which of the following statements is an advantage of polymorphism?

The same program logic can be used with objects of several related classes.
Variables can be re-used in order to save memory.
Constructing new objects from old objects of a similar class saves time.
Polymorphism is a dangerous aspect of inheritance and should be avoided.

2.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

The following key words are normally found in the inheritance and polymorphism concepts EXCEPT

instanceof
abstract
extends
private

3.

MULTIPLE CHOICE QUESTION

45 sec • 2 pts

Why is the class member, studentName declared private? (Choose the best answer.)

So that no classes outside of Student can interfere and use the studentName attribute
Because all class members are required to be declared private.
Because it facilitates record keeping.
Because the programmer wishes to protect the program against hackers wanting to steal vital information.

4.

MULTIPLE CHOICE QUESTION

45 sec • 2 pts

Which of the following statements is TRUE?

Polymorphism and inheritance is essentially the same thing.
Polymorphism means that the method executed in response to a given message will vary according to the class to which the object belongs.
The instance of operator tests whether an object exist.
Polymorphism uses array of subclasses.

5.

MULTIPLE CHOICE QUESTION

45 sec • 2 pts

What is the purpose of defining multiple constructors?

Multiple constructors are easier to write than a single constructor.
The Java constructors are easier to write than a single constructor.
Multiple constructors give the client more flexibility in creating instances.
Programs with multiple constructors are easier to read than a single constructor.

6.

MULTIPLE CHOICE QUESTION

1 min • 2 pts

Media Image

What is the output of running the class c?

AB
BA
AA
BB

7.

MULTIPLE CHOICE QUESTION

45 sec • 2 pts

Which of the following statements about the reference super written in a child class is TRUE?

It must be used every time method from the superclass is called.
It must be the last statement of the constructor.
It must be the first statement of the constructor.
It can only be used once in a program.

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?