Java Basics: Primitive Types and Variables Concepts Quiz

This quiz tests your understanding of basic concepts in Java, including primitive types, variables, and escape sequences. It's designed for beginners to help reinforce key points covered in the lecture.

#1

Which of the following is not one of the four characteristics of a variable?

Name
Size
Scope
Value
1 answered
#2

In Java, a variable declared using a primitive type stores:

A reference to an object
A memory address
A value directly
The size of the object
#3

What is the range of the byte primitive type in Java?

-128 to 127
-32768 to 32767
0 to 255
-2147483648 to 2147483647
#4

Which of the following is not a primitive type in Java?

int
float
String
char
1 answered
#5

What is the size of a long variable in Java?

4 bytes
8 bytes
16 bytes
2 bytes
#6

Which of the following literals represents a character in Java?

'A'
12.34
"Java"
100L
3 answered
#7

Which of the following is an escape sequence in Java?

\t
%d
#escape
\escape
#8

What type of value does the boolean primitive type store?

1 or 0
True or False
'Y' or 'N'
Yes or No
#9

How is a reference type variable different from a primitive type variable?

It stores a value directly
It stores a reference to an object
It is automatically garbage collected
It can only store numerical values
#10

Which of the following is an example of a float literal in Java?

3.14f
3.14
3L
3
#11

What is the default value of a boolean variable in Java?

true
false
null
0
#12

Which primitive type in Java is used to store decimal values?

int
char
float
boolean
#13

What is the size of a double variable in Java?

2 bytes
4 bytes
8 bytes
16 bytes
3 answered
#14

Which of the following escape sequences is used to insert a new line in Java?

\b
\n
\r
\t
2 answered
#15

Which of the following is an example of a valid char literal?

'AB'
"A"
'A'
A
1 answered
#16

Only this qustion is fake?

Option number 1
Option number 11
Option number 1
Option number 1
1 answered

Quiz Questions with Answers

Forget wasting time on incorrect answers. We deliver the straight-up correct options, along with clear explanations that solidify your understanding.

Test Your Knowledge

Craft your ideal quiz experience by specifying the number of questions and the difficulty level you desire. Dive in and test your knowledge - we have the perfect quiz waiting for you!