Question 1: Given:
public abstract interface Frobnicate {
public void twiddle(String s);
}
OCA Chuong 3
Quiz
•
English
•
University
•
Hard
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
10 questions
TOEFL ITP Structure and Written Expression Skill 1 and 2
Quiz
•
11th Grade - University
10 questions
Correcting grammar for ESL students
Quiz
•
University
20 questions
Marketing
Quiz
•
University
20 questions
Vocabulary
Quiz
•
University
20 questions
DataStorm Quiz
Quiz
•
University
10 questions
Java Mastery Challenge
Quiz
•
University
10 questions
bedwars quiz
Quiz
•
University - Professi...
10 questions
Seventh Grade by Gary Soto
Quiz
•
KG - University
15 questions
Multiplication Facts
Quiz
•
4th Grade
25 questions
SS Combined Advisory Quiz
Quiz
•
6th - 8th Grade
40 questions
Week 4 Student In Class Practice Set
Quiz
•
9th - 12th Grade
40 questions
SOL: ILE DNA Tech, Gen, Evol 2025
Quiz
•
9th - 12th Grade
20 questions
NC Universities (R2H)
Quiz
•
9th - 12th Grade
15 questions
June Review Quiz
Quiz
•
Professional Development
20 questions
Congruent and Similar Triangles
Quiz
•
8th Grade
25 questions
Triangle Inequalities
Quiz
•
10th - 12th Grade