Search Header Logo

Java - If Else Switch

Authored by taha Rupawala

Computers

9th - 12th Grade

Used 15+ times

Java - If Else Switch
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

6 questions

Show all answers

1.

MULTIPLE SELECT QUESTION

30 sec • 1 pt

What are the conditional statements in Java

else if

switch

if switch

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

PREDICT THE OUTPUT:

int x = 20;

int y = 18;

if(x>y)

{

System.out.println("x is greater than y");

}

else

{

System.out.println("Error");

System.out.println("Incorrect code");

}

Error

Incorrect code

x is greater than y

Error

Incorrect Code

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

PREDICT THE OUTPUT:

int time = 16;

if(time > 12)

{

System.out.println("Good Afternoon");

}

else

{

System.out.println("Good night");

}

Good Night

Good night

Good Afternoon

Good afternoon

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

PREDICT THE OUTPUT:

int x = 60;

int y = 90;

if (y%x == 0 && y-x==30)

{

System.out.println("Hello World");

}

else

{

System.out.println("Error")

}

Hello World

Error

Hello world

Hello World

Error

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

FILL IN THE BLANKS:

int x = 50;

int y = 10;

__ ( x__y)

{

System.out.println("Hello World");

}

if, <

else, >

if, >

if, %

6.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

FILL IN THE BLANK:

int x = 50;

int y = 50;

__(x__y)

{

System.out.println("1");

}

__(x>y)

{

System.out.println("2");

}

__

{

System.out.println("3");

}

if, ==, else if, else

else, %, if else if, else

else if, if, else, if

if, --, else if, else

Access all questions and much more by creating a free account

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?