CONDITIONALS

CONDITIONALS

23 Qs

quiz-placeholder

Similar activities

IF Condition

IF Condition

Javascript Conditional Statements

Javascript Conditional Statements

JavaScript Conditional Statements Quiz

JavaScript Conditional Statements Quiz

If Statements and Loops Vocabulary and Check for Understandi

If Statements and Loops Vocabulary and Check for Understandi

Code.org Unit 4 Quiz

Code.org Unit 4 Quiz

Codesters Quiz

Codesters Quiz

CONDITIONALS

CONDITIONALS

Assessment

Quiz

Computers

Medium

Created by

Zaid Muhammad

Used 4+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

23 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of conditional statements in Java?

To declare variables

To execute a block of code only if a certain condition is true

To perform mathematical calculations

To define classes and objects

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a logical operator in Java?

++ (Increment)

&& (AND operator)

:: (Method reference)

$ (Dollar sign)

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code snippet?

int x =: 10;

int y = 20;

if (x > y || x<5) {

System.out.println("Condition is true");

} else {

System.out.println("Condition is false");

}

Condition is true

   B) Condition is false

   C) Compilation error

   D) Runtime error

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code snippet?

int x = 5;

if (x > 0 && x < 10) {

    System.out.println("Number is between 0 and 10");

} else {

    System.out.println("Number is not between 0 and 10");

}

   A) Number is between 0 and 10

   B) Number is not between 0 and 10

   C) Compilation error

   D) Runtime error

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

 What will be the output of the following code snippet?

int i = 0;

while (i < 5) {

    System.out.print(i + " ");

    i += 2;

}

   A) 0 1 2 3 4

   B) 0 2 4

   C) 2 4 6 8 10

   D) Infinite loop

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Greater than or equal to

> or =

> || =

>=

<=

7.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What Javascript code matches this statement:

Their name is Kim and they are less than 16 years old

if (name = "Kim" && age < 16 )

if (name === "Kim" && age < 16 )

if (name = "Kim" || age < 16 )

if (name === "Kim" || age < 16 )

Create a free account and access millions of resources

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?