Java1-ch03_quiz01

Java1-ch03_quiz01

University

10 Qs

quiz-placeholder

Similar activities

Understanding If-Else in C Programming

Understanding If-Else in C Programming

University

10 Qs

Python Skills

Python Skills

1st Grade - Professional Development

15 Qs

Manual Transmissions/Clutches

Manual Transmissions/Clutches

9th Grade - University

15 Qs

Hari3-Kuis Coding dan Perkenalan AI

Hari3-Kuis Coding dan Perkenalan AI

1st Grade - University

10 Qs

Python Review Module 14 - Recursion

Python Review Module 14 - Recursion

University

10 Qs

K Map

K Map

University

10 Qs

Logic Gates

Logic Gates

10th Grade - University

15 Qs

PLTW Modeling & Simulation Vocabulary Part 2

PLTW Modeling & Simulation Vocabulary Part 2

5th Grade - University

15 Qs

Java1-ch03_quiz01

Java1-ch03_quiz01

Assessment

Quiz

Science

University

Hard

Created by

Sreng Vichet

Used 11+ times

FREE Resource

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the correct syntax for a basic if statement in Java?

A) if (condition) { }

B) if condition { }

C) if (condition); { }

D) if condition: { }

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What will the following code output?

A) A

B) B

C) No output

D) Compilation error

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is not allowed in an if statement condition?

A) x == 10

B) x > 0 && y < 5

C) x = 5

D) true

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of an if-else statement?

A) To allow multiple conditions to be checked simultaneously.

B) To execute one block of code if the condition is true and another if it is false.

C) To check multiple conditions without nesting.

D) To terminate program execution if a condition is false.

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What will the following code output?

A) A

B) B

C) C

D) No output

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which statement is true about the if-else-if ladder?

A) All conditions are always checked.

B) Only the first true condition is executed, and the rest are ignored.

C) It must always end with an else block.

D) It is equivalent to a switch statement in all cases.

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What will the following code output?

A) Greater than 15

B) Greater than 5 but less than or equal to 15

C) 5 or less

D) Compilation error

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?

Discover more resources for Science