ICSE Class 10 Computer Applications
Question 1 of 30
Solved Sample Paper 3 — Question 1
Back to all questions 1
Question Question 1(i)
What will be the output of the following code?
int size = 2;
if (size < 0)
System.out.println("Small");
else if (size == 0)
System.out.println("Medium");
else
System.out.println("Large");- Small
- Large
- Medium
- Runtime error
Large
Reason — Since size > 0, hence the conditions of if and else if are false. Thus, the else block will be executed and "Large" will be printed on the screen.