Tests rules for assigning values to variables and operator precedence in Java
Int i = Character.getNumericValue(c);
Int i = (int)c;
Int i = c;
Int i = Integer.parseInt(c.toString());
Rate this question:
Compilation error due to 3 assignments in a row
Prints 130
Prints 100
Rate this question:
Prints 46.
Prints 42
Compilation error as 0x & 0 are funny symbols for Java
Compilation error because these constants must be stored in variables first
Rate this question:
Prints -7.
Prints -8
Compilation error as expressions can't be given directly into System.out.println
Compilation error because these constants must be stored in variables first
Rate this question:
Prints 9.
Prints 11
Prints 10.
Rate this question:
10
20
30
-170
Rate this question:
Line labeled 1
Line labeled 2
Line labeled 3
Line labeled 4
Rate this question:
Compile time error byte can't be assigned to int.
Prints -128.
Prints 127.
Rate this question:
Short height = 12;
Long distance = 012;
Double trouble = 0x123456;
Int yesno = (int) true;
True
False
Rate this question:
True
False
Rate this question:
Prints 1.7999999999999998
This is not legal as in C.
Prints 1.8
Throws ArithmeticException at runtime.
Rate this question:
%
>>>
**
Rate this question:
Modulus operator in Java are applicable to int quantities only.
Identifiers in Java are Case-Sensitive.
The arithmetic operators /, *, % have same precedence.
Range of the data type short is -128 to +127 inclusive.
(+69) is a legal expression.
Rate this question:
A = a * 2;
A *=2;
A
A = a
Rate this question:
Height = kite * 5;
P = kite * height;
Kite
Alpha = alpha + kite;
Height += p;
Rate this question:
First digit printed is 3.
First digit printed is 2
Second digit printed is 3.
Second digit printed is 1.
Rate this question:
True
False
Rate this question:
True
False
Rate this question:
Prints -126.
Compile time Error.
Prints -127.
Rate this question:
Prints 129.
Compile time Error.
Prints 130
Rate this question:
Null.
Prints "Money"
Prints "in life"
Prints "matters"
Compilation fails.
Rate this question:
9 Hi47 87Bye
72 Hi47 4244Bye
72 Hi425 86Bye
Compilation fails.
Rate this question:
X is 2.
X is 211.
Y is 0.
Y is 2.
Rate this question:
Prints -1.
Prints 0.
Prints 65535.
Compilation Error.
Rate this question:
Prints -2.
Prints 2.
Prints 0.
Compilation Error.
Rate this question:
Prints Ha Ha Ha.
Prints Ha169Ha.
Compilation Error at second System.out.print.
Rate this question:
Prints k = 35 m = 0 n = 97 o = 260 p = 1
Prints k = 20 m = -9 n = 90 o = 262 p = 0
Compilation Error.
Rate this question:
Prints Both are Same.
Prints Not Same.
Compilation Error.
Rate this question:
Quiz Review Timeline (Updated): May 15, 2024 +
Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.
Wait!
Here's an interesting quiz for you.