0% found this document useful (0 votes)
30 views

Course:: The Quiz Questions

This document contains a quiz about inheritance in Java programming. It asks 5 multiple choice questions about inheritance concepts like what inheritance is, what can be done during the inheritance process, valid syntax for subclasses, and true statements about classes and interfaces. The answers section then provides the correct answers to each question.

Uploaded by

Fuad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

Course:: The Quiz Questions

This document contains a quiz about inheritance in Java programming. It asks 5 multiple choice questions about inheritance concepts like what inheritance is, what can be done during the inheritance process, valid syntax for subclasses, and true statements about classes and interfaces. The answers section then provides the correct answers to each question.

Uploaded by

Fuad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Course: Easy-to-follow Java programming

The quiz questions


Answer the questions below to review what you have learned in Video 8. You will
find the right answers after the questions in the solution section.

1. What is inheritance?

An object deleted from memory passes on its resources (e.g. memory)


to another object.

You create a new class out of an existing one.

Modification of methods.

We create the object without knowing its class.

2. What can you do during the inheritance process?

Set multiple superclasses.

Remove methods.

Create new data members.

Create new methods.

Prescribe which object will receive the resources of the deleted


one.

Duckademy IT courses – www.duckademy.com


3. In the following statement what can you use instead of the question mark
(?)? There is a superclass A, which has a subclass B, and there is a C which
is the subclass of B.
? x = new B();

B
C

Object

String

4. Complete the following sentences:

If you put the final keyword in front of a variable, then the value ca nno.
If a data member is an object, the final keyword refers to tthe referencet, not to
tthe valuet.
If a class is denoted with final, then you cannot tinherit fromt the class.
If a method is final in a class, then the method cannot tbe overriddent in the
subclasses.

5. Select which statements are true:

A class in Java can have only one superclass.

Multiple inheritance is designated by rectangles in a UML class diagram.

The interfaces were created to partially support multiple inheritance.

An interface can have multiple super-interfaces.

Object is an interface.

Duckademy IT courses – www.duckademy.com


----------------------------------------------------------------------------------------------------------------

The answers

1. What is inheritance?

An object deleted from memory passes on its resources (e.g. memory)


to another object.
X You create a new class out of an existing one.

Modification of methods.

We create the object without knowing its class.

2. What can you do during the inheritance process?

Set multiple superclasses.

Remove methods.
X Create new data members.
X Create new methods.

Prescribe which object will receive the resources of the


deleted one.
X Modify existing methods.

3. In the following statement what can you use instead of the question mark
(?)? There is a superclass A, which has a subclass B, and there is a C which
is the subclass of B.
? x = new B();

X A

X B
C

X Object

String

Duckademy IT courses – www.duckademy.com


4. Complete the following sentences:

If you put the final keyword in front of a variable, then the value cannot bet
tchangedt.
If a data member is an object, the final keyword refers to tthe referencet, not to
tthe valuet.
If a class is denoted with final, then you cannot tinherit fromt the class.
If a method is final in a class, then the method cannot tbe overriddent in the
subclasses

5. Select which statements are true:

X A class in Java can have only one superclass.

Multiple inheritance is designated by rectangles in a UML class diagram.

X The interfaces were created to partially support multiple inheritance.

X An interface can have multiple super-interfaces.

Object is an interface.

Duckademy IT courses – www.duckademy.com

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy