- Home
- Chapter 1 - Object Oriented Programming Concepts
- Object Oriented Programming Concepts
- Multiple Choice Questions
- State whether the given statements are True or False
- Assignment Questions
- Chapter 2 - Introduction to Java
- Introduction to Java
- Multiple Choice Questions
- Assignment Questions
- Chapter 3 - Values and Data Types
- Values and Data Types
- Multiple Choice Questions
- State whether the given statements are True or False
- Assignment Questions
- Chapter 4 - Operators in Java
- Operators in Java
- Multiple Choice Questions
- State whether the given statements are True or False
- Assignment Questions
- Chapter 5 - User-Defined Methods
- User-Defined Methods
- Multiple Choice Questions
- State whether the given statements are True or False
- Assignment Questions
- Chapter 6 - Input in Java
- Input in Java
- Multiple Choice Questions
- Assignment Questions and Programs
- Chapter 7 - Mathematical Library Methods
- Mathematical Library Methods
- Multiple Choice Questions
- Assignment Questions
- Chapter 8 - Conditional Constructs in Java
- Conditional Constructs in Java
- Multiple Choice Questions
- Assignment Questions and Programs
- Chapter 9 - Iterative Constructs in Java
- Iterative Constructs in Java
- Multiple Choice Questions
- State whether the given statements are True or False
- Assignment Questions and Programs
- Chapter 10 - Nested for loops
- Nested for loops
- Assignment Questions and Programs
- Chapter 11 - Constructors
- Constructors
- Multiple Choice Questions
- Assignment Questions and Programs
- Chapter 12 - Library Classes
- Library Classes
- Multiple Choice Questions
- Assignment Questions
- Chapter 13 - Encapsulation and Inheritance
- Library Classes
- Multiple Choice Questions
- Assignment Questions
- Chapter 14 - Arrays
- Library Classes
- Multiple Choice Questions
- Assignment Questions
- Chapter 15 - String Handling
- Library Classes
- Multiple Choice Questions
- Assignment Questions
Conditional Constructs in Java
Chapter 8
Conditional Constructs in Java
Class 8 - Logix Kips ICSE Computer Applications with BlueJ
![]() Share with a Friend |
Multiple Choice Questions
Question 1
Which of the following are conditional constructs?
- if-else
- if-else-if ladder
- switch statement
- All of these ✔
Question 2
Which operator cannot be used with if-else statement?
- <=
- ||
- &&
- ? : ✔
Question 3
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.printIn("Large");
- Small
- Large ✔
- Medium
- Runtime error
Question 4
What will be the output of the following code?
int fruit = 3;
switch (fruit + 1)
{
case 1:
System.out.println("Banana");
break ;
case 2:
System.out.println("Apple");
break ;
case 3:
System.out.println("Orange");
break ;
default :
System.out.println("Fruitless");
}
- Orange
- Banana
- Apple
- Fruitless ✔
Question 5
Predict the output of the following code snippet:
int a = 1;
int b = 2;
if (a == b)
System.out.println ("Both values are equal");
else
System.out.println ("Values are not equal");
- Both values are equal
- Incorrect use of the == operator
- Values are not equal ✔
- No output
Question 6
Consider the following code snippet:
if ( c > d)
x = c;
else
x = d;
Choose the correct option if the code mentioned above is rewritten using the ternary operator:
- x = (c >d) ? c : d; ✔
- x = (c >d) ? d : c;
- x = (c >d) ? c : c;
- x = (c >d) ? d : d;
Question 7
if ((a > b) && (a > c)), then which of the following statements is true?
- a is the largest number. ✔
- b is the largest number.
- c is the largest number.
- b is the smallest number.
Question 8
Consider the following code snippet:
int val = 2;
switch (val)
{
case 1: System.out.println("Case 1");
break;
case 2: System.out.println("Case 2");
break;
default: System.out.println("No match found");
break;
}
Which of the following statements is correct?
- case 1 will be executed.
- case 2 will be executed. ✔
- default will be executed.
- both case 1 and 2 will be executed.
Question 9
A sequence of statements enclosed between a pair of curly brackets is called
- a compound statement ✔
- an empty statement
- a null statement
- a void statement
Question 10
Which clause is optional in the switch statement?
- default ✔
- case
- switch
- None of these
Question 11
Which of the following statements involves a fall-through?
- if-else
- for loop
- if-else-if ladder
- switch ✔
Question 12
Which of the following causes a fall-through in the switch statement?
- the omission of fall
- the omission of continue
- the omission of break ✔
- the omission of loop
Question 13
Which of the following is mandatory in the switch statement?
- break
- continue
- case ✔
- default
Question 14
Which of the following statement is a valid combination?
- if inside switch ✔
- switch inside if ✔
- else inside switch
- default inside if
