Question No 47
Exhibit:
1. public class test (
2. public static void main(string args[]) {
3. int 1= 0;
4. while (i) {
5. if (i==4) {
6. break;
7. )
8. ++i;
9. )
10.
11. )
12. )
What is the value of i at line 10?
A. 0
B. 3
C. 4
D. 5
E. The code will not compile.
Answer: E
Question No 48
Given:
3. int i= 1, j= 10 ;
4. do (
5. if (i++> --j) continue;
6. ) while (i<5);
After execution, what are the values for I and j?
A. i = 6 and j= 5
B. i = 5 and j= 5
C. i = 6 and j= 4
D. i = 5 and j= 6
E. i = 6 and j= 6
Answer: D
Question No 49
Given:
1. switch (i) {
2. default:
310-025
Leading the way in IT testing and certification tools, www.testking.com
- 27 -
3. System.out.printIn(“Hello”);
4. )
What are the two acceptable types for the variable i? (Choose Two)
A. Char
B. Byte
C. Float
D. Double
E. Object
Answer: A, B
Question No 50
Given:
1. public class foo {
2. public static void main (string[]args)
3. try {return;}
4. finally {system.out.printIn(“Finally”);}
5. }
6. )
What is the result?
A. The program runs and prints nothing.
B. The program runs and prints “Finally”
C. The code compiles, but an exception is thrown at runtime.
D. The code will not compile because the catch block is missing.
Answer: B