Quiz on Decision Making
Decision making in Java allows a program to take different actions based on certain conditions. It helps control the flow of execution by choosing between multiple options using conditional statements.
Quiz Summary
0 of 15 Questions completed
Questions:
Information
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading…
You must sign in or sign up to start the quiz.
You must first complete the following:
Results
Results
0 of 15 Questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
Categories
- Not categorized 0%
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- Current
- Review / Skip
- Answered
- Correct
- Incorrect
- Question 1 of 15
1. Question
What will be the output of this code?
int x = 5;
if (x > 0)
System.out.println(“Positive”);CorrectIncorrect - Question 2 of 15
2. Question
Which keyword is used to test multiple conditions one by one?
CorrectIncorrect - Question 3 of 15
3. Question
What is the output of:
int x = 10;
if (x < 5)
System.out.println(“Small”);
else
System.out.println(“Big”);CorrectIncorrect - Question 4 of 15
4. Question
The switch statement works with which of the following data types?
CorrectIncorrect - Question 5 of 15
5. Question
What will happen if no `break` is used in a `switch` case?
CorrectIncorrect - Question 6 of 15
6. Question
Can `if` statements be nested in Java?
CorrectIncorrect - Question 7 of 15
7. Question
What is the output of:
int x = 5;
if (x == 5)
if (x > 2)
System.out.println(“Yes”);
else
System.out.println(“No”);CorrectIncorrect - Question 8 of 15
8. Question
What is the purpose of `break` in decision-making?
CorrectIncorrect - Question 9 of 15
9. Question
Which is more suitable for multi-way branching based on exact values?
CorrectIncorrect - Question 10 of 15
10. Question
What is the output?
int x = 0;
if (x)
System.out.println(“True”);CorrectIncorrect - Question 11 of 15
11. Question
Which operator is commonly used for short decision-making (ternary)?
CorrectIncorrect - Question 12 of 15
12. Question
How many `else` blocks can follow a single `if` block?
CorrectIncorrect - Question 13 of 15
13. Question
Which of the following is invalid syntax?
CorrectIncorrect - Question 14 of 15
14. Question
Can a `switch` statement be used with a `boolean` value?
CorrectIncorrect - Question 15 of 15
15. Question
What is the default block used for in a switch statement?
CorrectIncorrect
Summary
These MCQs test your knowledge on if-else, switch-case, nested conditions, and ternary operators — all crucial for writing logical control flows in Java programs.
