Given:
class Ca { }
class Cb { }
interface Ia { }
interface Ib { }
class Aa extends Cb implements Ia { }
class Ab implements Ia implements Ib { }
class Ba implements Ca { }
class Bb extends Ca, implements Ib { }
class Ca extends Ia, Ib { }
class Cb implements Ia, Ib { }
What is the result? (Choose all that apply.)
A. Class Aa does not compile.
B. Class Ab does not compile.
C. Class Ba does not compile.
D. Class Bb does not compile.
E. Class Ca does not compile.
F. Class Cb does not compile.
G. Compilation succeeds for all of the classes.
DOWNLOAD the answer
This is your world! It's not just Java
Saturday, September 10, 2011
Quiz of the day | OCPJP (5)
Posted by
Paiman
at
6:39 PM
0
comments
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Labels:
OCPJP
Friday, September 9, 2011
Quiz of the day | OCPJP (4)
Given:
2. class A { }
3. public class B extends A {
4. public static void main(String[] args) {
5. A a = new A();
6. B b = new B();
7. // insert code here
8. }
9. }
Which, inserted independently at line 7, compile? (Choose all that apply.)
A. if(b instanceof a) System.out.print("a ");
B. if(b.instanceof(a)) System.out.print("b ");
C. if(b instanceof A) System.out.print("c ");
D. if(b instanceOf A) System.out.print("d ");
E. if(b.instanceof(A)) System.out.print("e ");
DOWNLOAD the answer
2. class A { }
3. public class B extends A {
4. public static void main(String[] args) {
5. A a = new A();
6. B b = new B();
7. // insert code here
8. }
9. }
Which, inserted independently at line 7, compile? (Choose all that apply.)
A. if(b instanceof a) System.out.print("a ");
B. if(b.instanceof(a)) System.out.print("b ");
C. if(b instanceof A) System.out.print("c ");
D. if(b instanceOf A) System.out.print("d ");
E. if(b.instanceof(A)) System.out.print("e ");
DOWNLOAD the answer
Posted by
Paiman
at
11:05 AM
0
comments
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Labels:
OCPJP
Thursday, September 8, 2011
Quiz of the day | OCPJP (3)
2. public class P {
3. private int p = 1;
4. public static void main(String[] args) {
5. protected int p = 3;
6. new P().new Q().q();
7. }
8. class Q {
9. void q() { System.out.println("number " + p); }
10. }
11. }
Which are true? (Choose all that apply.)
A. Compilation succeeds.
B. The output is "number 1".
C. The output is "number 3".
D. Compilation fails due to an error on line 5.
E. Compilation fails due to an error on line 6.
F. Compilation fails due to an error on line 9.
DOWNLOAD the answer
3. private int p = 1;
4. public static void main(String[] args) {
5. protected int p = 3;
6. new P().new Q().q();
7. }
8. class Q {
9. void q() { System.out.println("number " + p); }
10. }
11. }
Which are true? (Choose all that apply.)
A. Compilation succeeds.
B. The output is "number 1".
C. The output is "number 3".
D. Compilation fails due to an error on line 5.
E. Compilation fails due to an error on line 6.
F. Compilation fails due to an error on line 9.
DOWNLOAD the answer
Posted by
Paiman
at
10:46 AM
0
comments
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Labels:
OCPJP
Wednesday, September 7, 2011
Quiz of the day | OCPJP (2)
Given:
2. public class X {
3. public static void main(String[] args) {
4. String result = "";
5. int x = 4, y = 5;
6. if(x == 0) { result += "5"; }
7. else if (x > 6) { result += "6"; }
8. else if (y < 6) { result += "7"; }
9. else if (x == 4) { result += "8"; }
10. else { result += "9"; }
11. System.out.println(result);
12. }
13. }
What is the result? (Choose all that apply.)
A. 789
B. 7
C. 78
D. 79
E. Compilation fails due to an error on line 5.
F. Compilation fails due to errors on lines 8 and 9.
G. Compilation fails due to errors on lines 7, 8, and 9.
DOWNLOAD the answer
2. public class X {
3. public static void main(String[] args) {
4. String result = "";
5. int x = 4, y = 5;
6. if(x == 0) { result += "5"; }
7. else if (x > 6) { result += "6"; }
8. else if (y < 6) { result += "7"; }
9. else if (x == 4) { result += "8"; }
10. else { result += "9"; }
11. System.out.println(result);
12. }
13. }
What is the result? (Choose all that apply.)
A. 789
B. 7
C. 78
D. 79
E. Compilation fails due to an error on line 5.
F. Compilation fails due to errors on lines 8 and 9.
G. Compilation fails due to errors on lines 7, 8, and 9.
DOWNLOAD the answer
Posted by
Paiman
at
10:16 AM
0
comments
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Labels:
OCPJP
Tuesday, September 6, 2011
Quiz of the day | OCPJP (1)
Given:
public class A extends B {
A() {
System.out.println("a ");
}
public static void main(String[] args) {
new A();
}
}
class B extends C {
B() {
System.out.print("b ");
}
private B(String b) {
}
}
abstract class C {
C() {
System.out.print("c ");
}
}
What is the result?
A. a
B. a b
C. b a
D. a b c
E. c b a
F. Compilation fails due to a single error in the code.
G. Compilation fails due to multiple errors in the code.
DOWNLOAD the answer
public class A extends B {
A() {
System.out.println("a ");
}
public static void main(String[] args) {
new A();
}
}
class B extends C {
B() {
System.out.print("b ");
}
private B(String b) {
}
}
abstract class C {
C() {
System.out.print("c ");
}
}
What is the result?
A. a
B. a b
C. b a
D. a b c
E. c b a
F. Compilation fails due to a single error in the code.
G. Compilation fails due to multiple errors in the code.
DOWNLOAD the answer
Posted by
Paiman
at
10:14 AM
0
comments
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Labels:
OCPJP
Leave a Message
Blog Archive
-
▼
2011
(40)
-
▼
October
(11)
- Quiz of the Day | OCPJP (35)
- Quiz of the day | OCPJP (34)
- Quiz of the day | OCPJP (33)
- Quiz of the day | OCPJP (32)
- Quiz of the day | OCPJP (31)
- Quiz of the day | OCPJP (30)
- Quiz of the day | OCPJP (29)
- Quiz of the day | OCPJP (28)
- Quiz of the day | OCPJP (27)
- Quiz of the day | OCPJP (26)
- Quiz of the day | OCPJP (22)
-
▼
October
(11)
Labels
- About Java (2)
- Ajax (1)
- Animation (1)
- Array (1)
- BufferedReader (1)
- C# (1)
- C++ (1)
- Certification (5)
- Cryptography (1)
- Download (37)
- Eclipse (1)
- EJB (2)
- Game (3)
- Hibernate (3)
- Input Data (2)
- J2ME (1)
- Java 2D (1)
- Java 3D (1)
- Java Advance (1)
- Java Basic (6)
- Java Networking (1)
- Java RMI (1)
- Java Secrets (1)
- Java Swing (3)
- Java Thread (2)
- Java Tutorial (4)
- JavaFX (3)
- JDBC (1)
- JMS (1)
- JSP (1)
- Linux (1)
- MySQL (1)
- OCPJP (34)
- Opinion (2)
- Oracle (1)
- PHP (1)
- Scanner (1)
- SCJP (1)
- SCWCD (1)
- Silverlight (1)
- Spring (1)
- Tutorial (2)
- Web Service (1)
- Wireless (1)
Powered by Blogger.