
OCA Chuong 3
Authored by Chính Đồng
English
University
Used 5+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
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
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
10 questions
45 CHECK PRONOUN REFERENCE FOR AGREEMENT
Quiz
•
University
10 questions
ENGLISH EXPRESSIONS
Quiz
•
6th Grade - Professio...
20 questions
Soal Chapter 4 sem 2
Quiz
•
7th Grade - University
15 questions
A, An, The / Numbers / Time
Quiz
•
KG - University
10 questions
TOEFL Structure: Review
Quiz
•
11th Grade - Professi...
10 questions
Should / Shouldn't
Quiz
•
6th Grade - University
15 questions
Negative modal verbs
Quiz
•
University
16 questions
MODALS OF NECCESITY AND PROHIBITION
Quiz
•
4th Grade - Professio...
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
54 questions
Analyzing Line Graphs & Tables
Quiz
•
4th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
Discover more resources for English
12 questions
IREAD Week 4 - Review
Quiz
•
3rd Grade - University
23 questions
Subject Verb Agreement
Quiz
•
9th Grade - University
21 questions
Past Perfect Tense
Quiz
•
University
21 questions
Contractions
Quiz
•
KG - University
8 questions
Because of Winn-Dixie Chapters 4-6
Quiz
•
KG - University
14 questions
Charlie and the Chocolate Factory Chapters 11-20
Quiz
•
2nd Grade - University