"switch" Java Statement - 1

"switch" Java Statement - 1

9th - 10th Grade

17 Qs

quiz-placeholder

Similar activities

Math Class Quiz

Math Class Quiz

10th - 12th Grade

12 Qs

Pretest - Webinar1 Kelas Industri Hummasoft

Pretest - Webinar1 Kelas Industri Hummasoft

10th Grade

12 Qs

Arrays Unit 6 AP CSA

Arrays Unit 6 AP CSA

10th - 12th Grade

14 Qs

Codehs Unit 6

Codehs Unit 6

10th - 12th Grade

14 Qs

Arrays Unit 6 Computer Science

Arrays Unit 6 Computer Science

10th - 12th Grade

14 Qs

AP CSA Java Arrays

AP CSA Java Arrays

10th - 12th Grade

14 Qs

Java Chapter 1 CS2

Java Chapter 1 CS2

9th - 12th Grade

16 Qs

Unit 5 Review

Unit 5 Review

9th - 12th Grade

18 Qs

"switch" Java Statement - 1

"switch" Java Statement - 1

Assessment

Quiz

Computers

9th - 10th Grade

Medium

Created by

Swarn Mishra

Used 173+ times

FREE Resource

17 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

A SWITCH case statement in Java is a ___ control statement.

Iteration

Looping

Selection

Jump

2.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Which is the alternative to SWITCH in Java language?

break, continue

for, while

if-else

goto, exit

3.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

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

switch, case

default

break

All of above

4.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

A SWITCH statement accepts ___ type of data as input.

byte

short

int

All of above

5.

MULTIPLE CHOICE QUESTION

2 mins • 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;

};

6.

MULTIPLE CHOICE QUESTION

2 mins • 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

7.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

What is the output of the Java program below?


int b=20;

switch(b)

{

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

}

No Output

LION

Compiler error as there are no CASE statements.

None

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?