Try to solve these questions if you won’t able to do it then debug the snippet.
Q1. What is the output of the given code snippet?
int i =15;
int j = i++ + --i;
System.out.println(j);
a. 30. b. 29 c. 31 d. 32
Q2. What is the output of the given code snippet?
int i = 15;
int j = ++i - --i + i;
System.out.println(j);
a. 17 b. 15 c. 16 d. 14
Q3. What is the output of the given code snippet?
int i = 15;
int j = i++ + ++i;
System.out.println(j);
a. 33 b. 30 c. 32 d. 31
Q4. What is the output of the given code snippet?
int i = 15;
int j = i++ - --i + i + i++ +i;
System.out.println(j);
a. 47 b. 75 c. 47 d. 45 e. None of these
Q5. What is the output of the given code snippet?
int i = 15;
System.out.print(--i + i--);
System.out.print(--i - i--);
System.out.print(--i + i++);
System.out.print(--i +i + i--);
System.out.print(i);
a. 28 0 28 43 15 b. 28 0 28 42 15 c. 28 0 21 30 10 d. 28 0 20 30 9
Q6. What is the output of the given code snippet?
int i = 10;
int j = (i++ * --i) - --i + i++ +i ;
System.out.println(j);
a. 200 b. 109 c. 110 d. 120 e. None of these
Q7. What is the output of the given code snippet?
System.out.println("Rohan"+ 2+5+1);
a. Rohan7 b. Rohan26 c. Rohan 26 d. Rohan251 e. Compile Time Error f. None of these
Q8. What is the output of the given code snippet?
System.out.println("Mohan"+25*5+269*0+"Rahul");
a. Mohan125Rahul b. Mohan2550Rahul c. Mohan1250Rahul d. Mohan0Rahul e. Compile Time Error f. None of these
Q9. What is the output of the given code snippet?
System.out.println(12+6+9 +"Mohan" + 12+6+9);
a. 1269Mohan1269 b. 1269Mohan27 c. 27Mohan27 d. 27Mohan1269 e. Compile Time Error f. None of these
Q10. What is the output of the given code snippet?
System.out.println("Mohan" + 12+6+9-4);
a. Mohan1265 b. Mohan23 c. Mohan1211 d. Compile Time Error e. None of these
Q11. What is the output of the given code snippet?
System.out.println("Mohan" + 12+7+(9-4));
a. Mohan24 b. Mohan1275 c. Mohan195 d. Compile Time Error e. None of these
Q12. What is the output of the given code snippet?
System.out.println(12+7+9-4 + "Mohan" + 12+7+9-4);
a. 24Mohan24 b. 24Mohan195 c. 1275Mohan1275 d. Compile Time Error e. None of these
Q13. What is the output of the given code snippet?
System.out.println(15+10/2*6+9-2*9/3);
a. 18.83 b. 48 c. 5.08 d. None of these
Q14. What is the output of the given code snippet?
int x = 11;
boolean result = x==10 || x<12 && x>10 && x<11;
System.out.println(result);
a. true b.false c. Compile Time Error d. None of these
Hope you like it !!! Happy Learning