Class 8 Switch if else

Class 8 Switch if else

8th Grade

15 Qs

quiz-placeholder

Similar activities

Control Structures in Java

Control Structures in Java

8th Grade

10 Qs

Class 8 Program coding Java

Class 8 Program coding Java

8th Grade

13 Qs

สอบกลางภาค JAVA เรียนที่ 1/2562

สอบกลางภาค JAVA เรียนที่ 1/2562

KG - 12th Grade

15 Qs

Java - Assessment 1

Java - Assessment 1

8th Grade

10 Qs

Computer Literacy

Computer Literacy

7th - 8th Grade

17 Qs

Lección1 - JavaScript

Lección1 - JavaScript

1st Grade - Professional Development

17 Qs

Introduction to Arrays

Introduction to Arrays

KG - University

10 Qs

Basic of Computer and Network

Basic of Computer and Network

8th Grade - University

20 Qs

Class 8 Switch if else

Class 8 Switch if else

Assessment

Quiz

Computers

8th Grade

Hard

Created by

Pratibha Sukhija

Used 1+ times

FREE Resource

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which is the alternative to SWITCH in Java language?

break, continue

for, while

if-else

goto, exit

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What are the keywords used to implement a SWITCH case in Java language?

switch, case

default

break

All of above

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Choose the correct syntax of SWITCH statement in Java below.

switch(input)

{

case constant1: //statements; break;

case constant2: //statements; break;

default: //statements;

};

switch(input)

{

case constant1: //statements; break;

case constant2: //statements; break;

default: //statements;

}

switch(input)

{

case constant1: //statements; break;

case constant2: //statements; break;

default case: //statements;

};

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of Java program with SWITCH below?


int a=10;

switch(a)

{

case 10: System.out.println("TEN");

}

No Output

TEN

Compiler error as there is no break

None

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the below Java program?


int persons = 45;

int random = 45;

switch(random)

{

case persons: System.out.print("CRICKET ");

default: System.out.println("RUGBY");

}

CRICKET

CRICKET RUGBY

RUGBY

Compiler error

6.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

What is the output of Java program below?


int num=40;

switch(num)

{

case 5: System.out.println("FIVE"); break;

case 35+5: System.out.println("FORTY"); break;

case 20+30: System.out.println("FIFTY");

}

FIVE

FORTY

FIFTY

Error

7.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

What is the output of the below Java program?


final int persons = 45;

int random = 45;

switch(random)

{

case persons: System.out.print("CRICKET ");

default: System.out.println("RUGBY");

}

CRICKET

CRICKET RUGBY

RUGBY

Compiler 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?