PRO192_part6

PRO192_part6

University

21 Qs

quiz-placeholder

Similar activities

FC III Chap 1&2

FC III Chap 1&2

University

20 Qs

College Quiz

College Quiz

KG - University

16 Qs

Copyright & Fair Use for Educators

Copyright & Fair Use for Educators

9th Grade - Professional Development

19 Qs

ATRN 121 Quiz 1

ATRN 121 Quiz 1

University

20 Qs

Unit 3 Media and Politics Vol 1

Unit 3 Media and Politics Vol 1

University

20 Qs

17 Career Cluster

17 Career Cluster

6th Grade - University

17 Qs

Black Butler (anime and manga) Quiz!

Black Butler (anime and manga) Quiz!

KG - Professional Development

20 Qs

Module 4

Module 4

11th Grade - University

20 Qs

PRO192_part6

PRO192_part6

Assessment

Quiz

Other

University

Medium

Created by

Phạm Ngân

Used 3+ times

FREE Resource

21 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

22. Suppose you are writing a class that will provide custom deserialization. The class implements java.io.Serializable (not java.io.Externalizable). What access mode should the readObject() method have?

A. public

B. protected

C. default

D. private

2.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

31. Suppose threads aThread and bThread are both accessing a shared object named sharedOb, and aThread has just executed:
sharedOb.wait();

What code can bThread execute in order to get aThread out of the waiting state, no matter what other conditions prevail?

A. aThread.notify();

B. aThread.notifyAll();

C. aThread.interrupt();

D. sharedOb.notify();

E. sharedOb.notifyAll();

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt


39. What relationship does the extends keyword represent?

A. "is a"

B. "has a"

C. Polymorphism

D. Multivariance

E. Overloading

4.

MULTIPLE SELECT QUESTION

45 sec • 1 pt


38. Given the following code:
1. class Xyz {
2. float f;
3. Xyz() {
4. ??? // What goes here?
5. }
6. Xyz(float f) {
7. this.f = f;
8. }
9. }

What code at line 4 results in a class that compiles?

A. super();

B. this(1.23f);

C. this(1.23f); super();

D. super(1.23f); this(1.23f);

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt


37. What happens when you try to compile the following code and run the Zebra application?
class Animal { float weight; Animal(float weight) {
this.weight = weight;
}
}

class Zebra extends Animal {
public static void main(String[] args) { Animal a = new Animal(222.2f);
Zebra z = new Zebra();
}
}

A. Class Animal generates a compiler error.

B. Class Zebra generates a compiler error.

C. The code compiles without error. The application throws an exception when the Animal
constructor is called.

D. The code compiles without error. The application throws an exception when the Zebra
constructor is called.

E. The code compiles and runs without error.

6.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

36. Suppose class aaa.Aaa has a method called callMe(). Suppose class bbb.Bbb, which extends aaa.AAA, wants to override callMe(). Which access modes for callMe() in aaa.AAA will allow this?

A. public

B. protected

C. default

D. private

7.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

35. Suppose classes Lemon and Grapefruit extend class Citrus. Which statements are true regard- ing the following code?
1. Grapefruit g = new Grapefruit();
2. Citrus c = (Citrus)g;
3. Lemon lem = (Lemon)c;

A. The cast in line 2 is not necessary.

B. Line 3 causes a compiler error.

C. The code compiles, and throws an exception at line 3.

D. The code compiles and runs without throwing any exceptions.

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?