B4 - The if Statement

B4 - The if Statement

University

5 Qs

quiz-placeholder

Similar activities

Printing Press

Printing Press

1st Grade - Professional Development

10 Qs

JDA2025 Sharing Session

JDA2025 Sharing Session

University

10 Qs

Writing a Literature Review

Writing a Literature Review

University

10 Qs

International Women's Day

International Women's Day

6th Grade - Professional Development

10 Qs

Field Methods in Psychology

Field Methods in Psychology

University

10 Qs

OHE exam 2 prep

OHE exam 2 prep

University

10 Qs

Mastering Python Loops

Mastering Python Loops

University

10 Qs

Java Basics – Day 1 Quiz

Java Basics – Day 1 Quiz

University

10 Qs

B4 - The if Statement

B4 - The if Statement

Assessment

Quiz

Other

University

Hard

Created by

Ahmetcan türk

FREE Resource

5 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How many choices are possible when using a single if-else statement?

1

2

3

4

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the following code fragment write to the monitor?


int sum = 14;

if ( sum < 20 )

System.out.print("Under ");

else

{

System.out.print("Over ");

System.out.println("the limit.");

}

Under

Over

Under the limit

Over the limit

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the following code fragment write to the monitor?


int sum = 7;

if ( sum > 20 )

{

System.out.print("You win ");

}

else

{

System.out.print("You lose ");

}


System.out.println("the prize.");

You win

You lose

You win the prize.

You lose the prize.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the following code fragment write to the monitor?


int sum = 21;

if ( sum != 20 )

System.out.print("You win ");

else

System.out.print("You lose ");


System.out.println("the prize.");

You win

You lose

You win the prize

You lose the prize

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Evaluate (to true or false) each of the following expressions:

14 <= 14 14 < 14 -9 > -25 -25 > -9

true true true true

true false false false

true false true true

true false true false