Question: Part A: class A { A(int i) {} // 1 } class B extends A {} // 2 Which of the following statements are true?

Part A:

class A {

A(int i) {} // 1

} class B extends A {} // 2

Which of the following statements are true? Choose 2

a. The compiler attempts to create a default constructor for class A.

b. The compiler attempts to create a default constructor for class B.

c. Compile-time error at 1.

d. Compile-time error at 2.

Part B:

class A {A() throws Exception {}} // 1

class B extends A {B() throws Exception {}} // 2

class C extends A {C() {}} // 3

Which of the following statements are true? Choose 2.

a. class A extends Object.

b. Compile-time error at 1.

c. Compile-time error at 2.

d. Compile-time error at 3.

Part C:

Which of the following modifiers CANNOT be applied to the declaration of a field? Choose 2

a. abstract

b. final

c. private

d. protected

e. public

f. transient g const

Part D:

2 class A {

3 public static void main (String[] args) {

4 Error error = new Error();

5 Exception exception = new Exception();

6 System.out.print((exception instanceof Throwable) + ",");

7 System.out.print(error instanceof Throwable);

8 }

9 }

What is the result of attempting to compile and run the program? Choose 1.

a. Prints: false,false

b. Prints: false,true

c. Prints: true,false

d. Prints: true,true

e. Compile-time error

f. Run-time error

g. None of the above

Part E:

String d = beekeeper;

d.substring(1,7);

d = w + d;

d.insert(3,bee);

System.out.println(d);

What is the result?

a. wbeebeekeep

b. wbeekeeper

c. wbeekeepe

d. weekeeper

e. whoneyproducer

f. Compilation fails

g. An exception is thrown

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!