Search Header Logo

A+ Computer Science Inheritance Quiz A

Authored by Logan Scherpenberg

Computers

12th Grade

A+ Computer Science Inheritance Quiz A
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

15 mins • 1 pt

Which reserved word is used to indicate that one class is a child or descendant of another class?

super

extends

implements

derives

child

2.

MULTIPLE CHOICE QUESTION

15 mins • 1 pt

Consider the classes and client code below to determine what is printed by the client code. public class N { private int one; public N() { one=5; } public String toString() { return ""+ one; } } public class O extends N { } //client code N it = new O(); System.out.println( it );

null

0

5

O

N

3.

MULTIPLE CHOICE QUESTION

15 mins • 1 pt

Consider the classes and client code below to determine the output of the client code. public class N { private int one; public N( int x ){ one=x; } public String toString(){ return ""+ one; } } public class O extends N { public O( int x ){ super( x ); } } //client code N it = new O(7); System.out.println( it ); a. null b. 0 c. 5 d. 3 e. 7 Answer: e. 7

null

0

5

3

7

4.

MULTIPLE CHOICE QUESTION

15 mins • 1 pt

Consider the classes below and determine what is printed out by the client code. public class V { public void one(){ System.out.print("it"); } public void two(){ System.out.print("go"); } } public class W extends V { public void one(){ System.out.print("up"); } public void two(){ System.out.print("at"); } public void testIt(){ one(); super.two(); } } /////////////////////////////////////////// //client code in the main of another class V x = new V(); x.one();

it

at

go

up

null

5.

MULTIPLE CHOICE QUESTION

15 mins • 1 pt

Consider the classes below and determine what is printed out by the client code. public class V { public void one(){ System.out.print("it"); } public void two(){ System.out.print("go"); } } public class W extends V { public void one(){ System.out.print("up"); } public void two(){ System.out.print("at"); } public void testIt(){ one(); super.two(); } } /////////////////////////////////////////////// //client code in the main of another class V x = new W(); x.one();

it

at

go

up

null

6.

MULTIPLE CHOICE QUESTION

15 mins • 1 pt

Consider the classes below and determine what is printed out by the client code. public class V { public void one(){ System.out.print("it"); } public void two(){ System.out.print("go"); } } public class W extends V { public void one(){ System.out.print("up"); } public void two(){ System.out.print("at"); } public void testIt(){ one(); super.two(); } } /////////////////////////////////////////// //client code in the main of another class V x = new W(); x.one(); x.two(); a. itgo b. upat c. itat d. upgo e. null Answer: c. itat

a. itgo

b. upat

c. itat

d. upgo

e. null

7.

MULTIPLE CHOICE QUESTION

15 mins • 1 pt

Consider the classes below and determine what is printed out by the client code. public class V { public void one(){ System.out.print("it"); } public void two(){ System.out.print("go"); } } public class W extends V { public void one(){ System.out.print("up"); } public void two(){ System.out.print("at"); } public void testIt(){ one(); super.two(); } } /////////////////////////////////////////////// //client code in the main of another class V x = new W(); x.one(); x = new V(); x.two(); a. itgo b. upat c. itat d. upgo e. null Answer: a. itgo

a. itgo

b. upat

c. itat

d. upgo

e. null

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?

Discover more resources for Computers