
Java Variables Quiz
Quiz
•
Computers
•
11th Grade
•
Practice Problem
•
Hard
Standards-aligned
Valerie Yarmesch
FREE Resource
Enhance your content in a minute
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is a correct declaration of a variable of type `int` in Java?
`int num = 5.5;`
`int num = 5;`
`int num = "5";`
`int num = '5';`
Tags
DOK Level 3: Strategic Thinking
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Given the following code snippet, what will be the output? ```java int a = 10; int b = 20; int c = a + b; System.out.println(c); ```
`10`
`20`
`30`
`40`
Tags
DOK Level 3: Strategic Thinking
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following primitive data types in Java has the largest range?
`byte`
`short`
`int`
`long`
Tags
DOK Level 3: Strategic Thinking
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Consider the following code: ```java double x = 5.0; int y = (int) x; ``` What is the value of `y` after the code is executed?
`5.0`
`5`
`0`
`Type mismatch error`
Tags
DOK Level 3: Strategic Thinking
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following statements is true about the `char` data type in Java?
`char` can store any Unicode character.
`char` can store only ASCII characters.
`char` can store integer values.
`char` can store floating-point numbers.
Tags
DOK Level 3: Strategic Thinking
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the result of the following code? ```java boolean flag = true; if (flag) { System.out.println("Flag is true"); } else { System.out.println("Flag is false"); } ```
`Flag is true`
`Flag is false`
`Compilation error`
`Runtime error`
Tags
DOK Level 3: Strategic Thinking
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is the correct way to declare a variable of type `float` in Java?
`float num = 5.5;`
`float num = 5.5f;`
`float num = "5.5";`
`float num = '5.5';`
Tags
DOK Level 3: Strategic Thinking
Create a free account and access millions of resources
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
0 questions
Java Values and Data Types Quiz
Quiz
•
0 questions
Data Types in Java
Quiz
•
0 questions
Java Variables 1.1 to 1.4 Review
Quiz
•
0 questions
Java Chapter 2
Quiz
•
0 questions
10AP Computer Science Review
Quiz
•
0 questions
Variables and Data Types
Quiz
•
0 questions
Java-1
Quiz
•
0 questions
Basic Java Quiz
Quiz
•
Popular Resources on Wayground
5 questions
This is not a...winter edition (Drawing game)
Quiz
•
1st - 5th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
10 questions
Identify Iconic Christmas Movie Scenes
Interactive video
•
6th - 10th Grade
20 questions
Christmas Trivia
Quiz
•
6th - 8th Grade
18 questions
Kids Christmas Trivia
Quiz
•
KG - 5th Grade
11 questions
How well do you know your Christmas Characters?
Lesson
•
3rd Grade
14 questions
Christmas Trivia
Quiz
•
5th Grade
20 questions
How the Grinch Stole Christmas
Quiz
•
5th Grade
Discover more resources for Computers
26 questions
Christmas Movie Trivia
Lesson
•
8th Grade - Professio...
15 questions
Christmas Song Emoji Pictionary
Quiz
•
7th - 12th Grade
20 questions
Christmas Movies
Quiz
•
1st - 12th Grade
20 questions
Christmas Movie Trivia
Quiz
•
9th - 12th Grade
29 questions
christmas facts
Lesson
•
5th - 12th Grade
20 questions
Christmas Trivia
Quiz
•
5th - 12th Grade
20 questions
Stages of Meiosis
Quiz
•
9th - 12th Grade
20 questions
christmas songs
Quiz
•
KG - University
