
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
Learning-1 (Report Text)
Quiz
•
University
13 questions
travel the world and the seven seas
Quiz
•
University
20 questions
Second period test B1.1
Quiz
•
University
12 questions
Ways of expressing ability
Quiz
•
University
20 questions
Simple Present vs Present Continuous
Quiz
•
6th Grade - University
20 questions
RAWS Diagnostic Test
Quiz
•
12th Grade - University
16 questions
Listening part1 items 1-16 on 5/01/2568
Quiz
•
University
15 questions
Prepositions Quiz
Quiz
•
University
Popular Resources on Wayground
7 questions
History of Valentine's Day
Interactive video
•
4th Grade
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
15 questions
Valentine's Day Trivia
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th 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
10 questions
THEME
Quiz
•
KG - University
13 questions
Jobs in the Theater
Quiz
•
6th Grade - University
12 questions
Charlie and the Chocolate Factory Chapters 21-30
Quiz
•
2nd Grade - University
20 questions
Context Clues
Quiz
•
KG - University