Quiz 3

Quiz 3

University

13 Qs

quiz-placeholder

Similar activities

Mảng động trong C

Mảng động trong C

University

17 Qs

Android - Quiz 12

Android - Quiz 12

University

15 Qs

Computer Coding

Computer Coding

4th Grade - University

15 Qs

Family members

Family members

University

10 Qs

Above & Beyond Level 3 Summer - Unit 2 Input 4 Vocabulary

Above & Beyond Level 3 Summer - Unit 2 Input 4 Vocabulary

University

10 Qs

OCA Chuong 2

OCA Chuong 2

University

11 Qs

Types of Sources

Types of Sources

University

15 Qs

Reliable Resources

Reliable Resources

6th Grade - University

15 Qs

Quiz 3

Quiz 3

Assessment

Quiz

English

University

Medium

Created by

Kanyanut HOMSAPAYA

Used 6+ times

FREE Resource

13 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

1. Which statements are true? Select the two correct answers.

(A) In Java, the extends clause is used to specify the inheritance relationship.

(B) The subclass of a non-abstract class can be declared abstract.

(C) All members of the superclass are inherited by the subclass.

(D) A final class can be abstract.

(E) A class in which all the members are declared private, cannot be declared public.

(A) and (B)

(B) and (C)

(A) and (E)

(C) and (D)

(D) and (E)

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

2. Which statements are true? Select the two correct answers.

(A) A class can only be extended by one class.

(B) Every Java object has a public method named equals.

(C) Every Java object has a public method named length.

(D) A class can extend any number of classes.

(E) A non-final class can be extended by any number of classes.

(B) and (C)

(A) and (B)

(B) and (E)

(C) and (D)

(D) and (E)

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

Given the following classes and declarations, which statements are true?  Select the three correct answers.

(A) The Bar class is a subclass of Foo.

(B) The statement b.f(); is legal.

(C) The statement a.j = 5; is legal.

(D) The statement a.g(); is legal.

(E) The statement b.i = 3; is legal.

(A), (B) and (D)

(A), (C) and (E)

(C), (D) and (E)

(B), (C) and (D)

(A), (D) and (E)

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Given classes A, B, and C, where B extends A, and C extends B, and where all classes implement the instance method void doIt(). How can the doIt() method in A be called from an instance method in C? Select the one correct answer.

super.doIt();

super.super.doIt();

this.super.doIt();

A.this.doIt();

((A) this).doIt();

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

Which method declarations, when inserted at (7), will not result in a compile-time error?  Select the two correct answers.

(A) public int step1(int i) { return 1; }

(B) public String step2(String str2, String str1) { return str1; }

(C) private void step2() { } (D) private static void step2() { }

(E) private static String step2(String str) { return str; }

(F) public MySuperclass makeIt() { return new MySuperclass(); }

(G) public MyClass makeIt2() { return new MyClass(); }

(B) and (G)

(A) and (E)

(C) and (D)

(F) and (G)

(C) and (F)

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What would be the result of compiling and running the following program? Select the one correct answer.

The code will compile and print |Toyota|Volvo|12345|54321|, when run.

The code will compile and print |Volvo|Toyota|12345|54321|, when run.

The code will compile and print |Toyota|Toyota|12345|12345|, when run.

The code will compile and print |Toyota|Toyota|12345|12345|, when run.

The code will compile and print |Volvo|Toyota|54321|54321|, when run.

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of these field declarations are legal within the body of an interface? Select the two correct answers.

(A) public static int answer = 42;

(B) int answer;

(C) final static int answer = 42;

(D) public int answer = 42;

(E) private final static int answer = 42;

(A) and (B)

(A) and (C)

(C) and (E)

(D) and (E)

(B) and (D)

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?