|
|
|
|
350 Mock Questions on SCJP 1.5 - JUST Rs.250 or 7 USD
Send us mail to sales@javabeat.net
more details
|
|
SCJA Mock Questions
|
Question 1
|
|
What will be the result of compiling and running the following code ?
|
public class StringCheck { public static void main(String args[]) { String s = "SCJA "; s.trim(); s = s + "Exam"; System.out.println(s); } }
|
|
Select the correct answer :
|
|
a.
|
SCJA Exam
|
|
b.
|
SCJA Exam
|
|
c.
|
SCJAExam
|
|
d.
|
Compilation fails
|
|
Question 2
|
|
What will be the result of compiling and running the following code ?
|
public class LoopCheck { public static void main(String args[]) { int i = 0; int x = 10; while ( x > 6 ) { System.out.print(++i + " "); x--; } } }
|
|
Select the correct answer :
|
|
a.
|
1 2 3 4 5
|
|
b.
|
0 1 2 3 4
|
|
c.
|
1 2 3 4
|
|
d.
|
0 1 2 3
|
|
e.
|
0 1 2 3 4
|
|
Question 3
|
|
Which of the following code fragments are a valid iteration statements ?
|
|
Select all correct answers :
|
|
a.
|
for ( int i=0; i<10;i++ ) {}
|
|
b.
|
for ( ; ; ) {}
|
|
c.
|
for ( int i=0; i< 5; ) {i++;}
|
|
d.
|
for ( int i=10; true; i--) {}
|
|
a.,b.,c. and d. are correct.
|
|
Question 4
|
|
The body of a do while loop is always executed more than one time.
|
|
Select the correct answer :
|
|
a.
|
The statement is true
|
|
b.
|
The statement is false
|
|
Question 5
|
|
Which of the following statements about the ScopeCheck class are true ?
|
public class ScopeCheck { private String name; private int age; public String call(String s) { String text; return s; } }
|
|
Select all correct answers :
|
|
a.
|
The variables name and age are instance variables
|
|
b.
|
The variable text is a method parameter variable
|
|
c.
|
The variable text is a local variable
|
|
d.
|
Compilation fails because variable text is not initialized
|
a. and c. are correct.
|
|
350 Mock Questions on SCJP 1.5 - JUST Rs.250 or 7 USD
Send us mail to sales@javabeat.net
more details
|
|
|
|