Which statement is true about primitive variables?
A. They can be compared with the == operator.
B. They can be compared with the equals method only.
C. They cannot be compared.
D. They can be compared with the compareTo method only.
Given the code fragment:
What is the result?
A. 2
B. 4
C. The program executes an infinite number of times.
D. 3
Identify two Java reserved words.
A. array
B. true
C. this
D. exception
E. string
Given the code fragment:
What is the result?
A. pen pencil erasers paper
B. paper pen pencil erasers
C. A compilation error occurs.
D. A runtime exception is thrown.
Given the code fragment:
Which code fragment can be inserted at line n1 to enable the code to print 0.0?
A. Ball b = null;
B. weight = 0.0;
C. Ball.weight = 0.0;
D. Ball b = new Ball(0.0);
E. Ball b = new Ball();
Which two statements are true about the Java Runtime Environment (JRE)?
A. It is responsible for garbage collection.
B. It interprets bytecode stored in a .class file.
C. It contains the JDK and Java APIs.
D. It is platform independent.
E. You must install the JRE to compile a .java file.
Given the code fragment:
What is the result?
A. Unknown issues. Invalid divisor.
B. Unknown issues.
C. Invalid divisor.
D. A compilation error occurs.
Given:
What is the result?
A. A compilation error occurs in the modify method.
B. 99
C. 5
D. A compilation error occurs in the main method.
Given the code fragment:
What is the result?
A. A compilation error occurs at line n1.
B. Jack
C. The program prints either Jack or Queen.
D. Queen
Given:
What is the result?
A. The program compiles and nothing is printed.
B. Iteration plus an increasing number is printed 100 times.
C. Iteration plus an increasing number is printed 99 times.
D. An error occurs during compilation.