Question : What is the result?` 1. 97 98 99 100 null null null 2. 97 98 99 100 101 102 103 3. Compilation Fails. 4. A NullPointerException is thrown at runtime. 5. An ArraylndexoutofBoundsException is thrown at runtime.
Correct Answer : 1
Question : Given the code fragment:
int x=100; int a = x++; int b = ++x; int c = x++; int d = (a System.out.println(d);
What is the result?
1. 100 2. 101 3. 102 4. 103 5. Compilation Fails
Correct Answer : 5
Question : Given the following main method:
public static void main(String args[]){ int num = 5; do{ System.out.println(num-- + " "); }while(num ==0); }