
Java Variables Quiz

Quiz
•
Computers
•
11th Grade
•
Hard
Standards-aligned
Valerie Yarmesch
FREE Resource
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
Similar Resources on Wayground
10 questions
Bài kiểm tra 15 phút

Quiz
•
11th Grade
12 questions
Loops

Quiz
•
9th - 12th Grade
10 questions
Unit 1 Post Test: Basic Python

Quiz
•
9th - 12th Grade
9 questions
Java nested if program

Quiz
•
10th - 11th Grade
13 questions
Java 1

Quiz
•
11th Grade
15 questions
Java Variables, Input and Output

Quiz
•
10th - 12th Grade
10 questions
Preetest Pemrograman Bahasa C

Quiz
•
11th Grade
10 questions
Functions in C++

Quiz
•
9th - 12th Grade
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th Grade
Discover more resources for Computers
20 questions
Digital Citizenship

Quiz
•
8th - 12th Grade
35 questions
Computer Baseline Examination 2025-26

Quiz
•
9th - 12th Grade
13 questions
Problem Solving Process

Quiz
•
9th - 12th Grade
10 questions
Understanding Algorithms with Pseudocode and Flowcharts

Interactive video
•
9th - 12th Grade
19 questions
AP CSP Unit 1 Review (code.org)

Quiz
•
10th - 12th Grade