Primitives- Numeric data types QuizJ8 Home « Primitives - Numeric data types Quiz
Fundamentals Quiz 4
The quiz below tests your knowledge of the material learnt in Fundamentals - Lesson 5 - Primitives - Numeric data types.
Question 1 : What will be returned from the following code?
long aLong = 3672543567;
System.out.println("aLong = " + aLong);?
long aLong = 3672543567;
System.out.println("aLong = " + aLong);?
- We get a compiler error. When we pass a literal value to a long we need to append l or L to it or the compiler inteprets it as an integer. Because an integer has a range of -2,147,483,648 to 2,147,483,647 the number is out of range even though we passed it to a long primitive type.
Quiz Progress Bar
Quiz 1
Code Structure & Syntax
Quiz 2
Java Variables
Quiz 3
Primitives - boolean
& char
data types
Quiz 5
Method Scope
Quiz 6
Arithmetic Operators
Quiz 7
Relational & Logical Operators
Quiz 8
Assignment Operators
Quiz 9
Bitwise Logical Operators
Quiz 10
Bitwise Shift Operators
Quiz 11
if
Construct
Quiz 12
switch
Construct
Quiz 13
for
Construct
Quiz 14
while
Construct
What's Next?
The next quiz on Java is about the method scope and the Stack
.