OCA Chuong 3

OCA Chuong 3

University

15 Qs

quiz-placeholder

Similar activities

Seventh Grade by Gary Soto

Seventh Grade by Gary Soto

KG - University

10 Qs

Strings & Arrays

Strings & Arrays

University

12 Qs

Unit 10 Vocabulary

Unit 10 Vocabulary

KG - University

20 Qs

Java Programming Quiz

Java Programming Quiz

12th Grade - University

20 Qs

Android - Quiz 15

Android - Quiz 15

University

15 Qs

OCA Chuong 2

OCA Chuong 2

University

11 Qs

MD2-1.3- Câu lệnh điều kiện

MD2-1.3- Câu lệnh điều kiện

University

10 Qs

Java Mastery Challenge

Java Mastery Challenge

University

10 Qs

OCA Chuong 3

OCA Chuong 3

Assessment

Quiz

English

University

Hard

Created by

Chính Đồng

Used 5+ times

FREE Resource

15 questions

Show all answers

1.

MULTIPLE SELECT QUESTION

3 mins • 1 pt

Question 1: Given:

public abstract interface Frobnicate {

public void twiddle(String s);

}

A. public abstract class Frob implements Frobnicate {

public abstract void twiddle(String s){};

}

B. public abstract class Frob implements Frobnicate {

}

C. public class Frob extend Frobnicate {

public void twiddle(Integer i){};

}

D. public class Frob implements Frobnicate{

public void twiddle(Integer i){};

}

E. public class Frob implements Frobnicate {

public void twiddle(String i){}

public void twiddle(Integer s){}

}

2.

MULTIPLE SELECT QUESTION

3 mins • 1 pt

Question 2: Given:

class Top {

public Top(String s){

System.out.print("B");

}

}

public class Button2 extend Top {

public Button2(String s){

System.out.print("D");}

public static void main(String[] args){

new Button2("C");

System.out.println (" ")

}

}

A. BD

B. DB

C. BDC

D. DBC

E. Complilation fails

3.

MULTIPLE SELECT QUESTION

3 mins • 1 pt

Question 3: Given:

class Clidder {

private final void flipper() {

System.out.println("Clidder");}

}

public class Clidlet extend Clidder {

public final void flipper(){

System.out.println("Clidlet");

}

public static void main(Sring[] args) {

new Clidlet().flipper();

}

}

A. Clidlet

B. Clidder

C. Clidder

Clidlet

D. Clidlet

Clidder

E. Compilation fails

4.

FILL IN THE BLANK QUESTION

10 mins • 1 pt

Using the fragments bellow, complete the following code so it compiles. Note that you may not have to fill in all of the slots

Code:

class AgedP {

_____ ____ ____ ____ ____

public AgedP(int x) {

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

}

}

public class Kinder extends AgedP {

____ ____ ____ ____ ____ ____

public Kinder (int x) {

____ ____ ____ ____ ____ ();

}

}

Fragments: Use the following fragments zero or more times:

AgedP super this ( { ) } ;

5.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

Question 5: Given:

class Bird {

{ System.out.print("b1");}

public Bird(){System.out.print("b2");}

}

class Raptor extends Bird {

static { System.out.print("r1");}

public Raptor(){System.out.print("r2");}

{System.out.print("r3");}

static {System.out.print("r4");}

}

class Haw extend Raptor {

public static void main (String [] args) {

System.out.print("pre");

new Hawk();

System.out.println("hawk");}

}

A. pre b1 b2 r3 r2 hawk

B. pre b2 b1 r2 r3 hawk

C. pre b2 b1 r2 r3 hawk r1 r4

D. r1 r4 pre b2 b1 r2 r3 hawk

E. Compilation fails

6.

MULTIPLE SELECT QUESTION

15 mins • 1 pt

Question 6: Given the following:

1. class X {void do1(){}}

2. class Y extends X {void do2() {}}

3. class Chrome {

4. public static void main (String[] args){

5. X x1 = new X();

6. X x2 = new Y();

7. Y y1 = new Y();

8/ // insert code here

9. }}

Which of the following, inserted at line 8, will compile? (choose all that apply)

A. x2.do2();

B. (Y)x2.do2();

C. ((Y)x2).do2();

D. None of the above statements will compile

7.

MULTIPLE CHOICE QUESTION

15 mins • 1 pt

Question 7: Given:

public class Locomotive {

Locomotive(){ main("hi");}

public static void main(String[] args){

System.out.print("2");

}

public static void main(String args){

System.out.print("3"+args);

}

}

A. 2 will be included in the output

B. 3 will be included in the output

C. hi will be included in the output

D. Compilation fails

E. An exception is thrown at runtime

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?