Java Conditional Statements

Quiz
•
Computers
•
9th Grade
•
Medium
Trevor I Stanley
Used 5+ times
FREE Resource
16 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following Java code snippet? ```java int x = 10; if (x > 5) { System.out.println("Greater"); } else { System.out.println("Smaller"); } ```
Smaller
Greater
Error
No output
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is a correct syntax for an if-else statement in Java?
`if (condition) { // code } else (condition) { // code }`
`if (condition) { // code } else { // code }`
`if { // code } else { // code }`
`if (condition) else { // code }`
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Consider the following code: ```java int a = 5, b = 10; if (a < b && b > 5) { System.out.println("Condition met"); } ``` What will be the output?
Condition met
No output
Error
Condition not met
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the result of the expression `!(true && false)` in Java?
true
false
Error
null
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following operators is a comparison operator in Java?
&&
||
==
!
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code? ```java int x = 3; if (x == 3) { if (x > 2) { System.out.println("Nested"); } } else { System.out.println("Not Nested"); } ```
Nested
Not Nested
Error
No output
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which logical operator is used to represent "OR" in Java?
&&
||
!
==
Create a free account and access millions of resources
Similar Resources on Wayground
15 questions
Programming python review

Quiz
•
9th - 12th Grade
20 questions
Quarter 3 Final Exam: Functions and Parameters

Quiz
•
9th - 12th Grade
21 questions
CodeHS 3.1 Boolean Expressions-4.2 For Loops Review

Quiz
•
9th - 12th Grade
20 questions
uCertify Chapter 1 Test

Quiz
•
9th - 12th Grade
12 questions
HTML & Java

Quiz
•
9th Grade
12 questions
Java Strings

Quiz
•
9th - 12th Grade
13 questions
APCSA Quiz 1

Quiz
•
9th Grade - University
17 questions
Cumulative Test Practice Units 1, 3, 4, 5, & 7

Quiz
•
9th - 12th Grade
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
15 questions
Core 4 of Customer Service - Student Edition

Quiz
•
6th - 8th Grade
15 questions
What is Bullying?- Bullying Lesson Series 6-12

Lesson
•
11th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
10 questions
Proper Keyboarding Techniques

Interactive video
•
6th - 10th Grade
14 questions
Inputs and Outputs: Computer Science Intro

Lesson
•
5th - 9th Grade
10 questions
Understanding Computers: Hardware, Software, and Operating Systems

Interactive video
•
7th - 12th Grade