
switch statements + java

Quiz
•
Computers
•
Professional Development
•
Hard

ANIL KUMAR
FREE Resource
82 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
Answer explanation
The program first asks the user to enter a programming language. Then, it uses a switch statement to check the user input. If the user input is "java", the program will print "Java Current Version is 12.". The other case statements in the switch statement are for Python, Rust, and a default case. Since the user input in the program is "java", the program will print the current version of Java.
2.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
Answer explanation
The switch statement in the image will first check if the value of n is equal to 10. If it is, the statement System.out.println("-10"); will be executed. The other statements will not be executed.
3.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
Answer explanation
You are eligible for marriage now. The switch statement in the image will first check if the value of the variable age is equal to 18. If it is, the statement System.out.println("You are eligible for marriage now"); will be executed. The other statements will not be executed.
4.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
Answer explanation
The switch statement in the image will first check if the value of the variable num is equal to 1. If it is, the statement System.out.println("Case1: Value is: 1"); will be executed. However, the value of num is 2, so this case will not be executed.
5.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
Answer explanation
The switch statement in the image will first check if the value of the variable weekday is equal to 1. If it is, the statement System.out.println("Sunday"); will be executed. However, the value of weekday is not equal to 1, so this case will not be executed.
6.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
Answer explanation
The switch statement in the image will first check if the value of n is equal to 10. If it is, the statement System.out.println("-10"); will be executed. However, there is no case 10 in the switch statement, so this statement will not be executed.
7.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
Answer explanation
The switch statement in the image will first check if the value of n is equal to 11. If it is, the statement System.out.println(n); will be executed. This statement will print the value of n, which is 11.
Create a free account and access millions of resources
Similar Resources on Quizizz
80 questions
preTEST Pranata Komputer Terampil Part 1

Quiz
•
10th Grade - Professi...
85 questions
PM 220-1102

Quiz
•
Professional Development
87 questions
Project Management Certification

Quiz
•
Professional Development
79 questions
Memory Allocation + java-visual

Quiz
•
Professional Development
80 questions
CompTIA IT 11

Quiz
•
Professional Development
85 questions
Mega Quiz

Quiz
•
11th Grade - Professi...
80 questions
Python Test

Quiz
•
Professional Development
80 questions
Level 1

Quiz
•
Professional Development
Popular Resources on Quizizz
15 questions
Character Analysis

Quiz
•
4th Grade
17 questions
Chapter 12 - Doing the Right Thing

Quiz
•
9th - 12th Grade
10 questions
American Flag

Quiz
•
1st - 2nd Grade
20 questions
Reading Comprehension

Quiz
•
5th Grade
30 questions
Linear Inequalities

Quiz
•
9th - 12th Grade
20 questions
Types of Credit

Quiz
•
9th - 12th Grade
18 questions
Full S.T.E.A.M. Ahead Summer Academy Pre-Test 24-25

Quiz
•
5th Grade
14 questions
Misplaced and Dangling Modifiers

Quiz
•
6th - 8th Grade