Which statement is true about primitive variables?
B
Explanation:
Reference: https://stackoverflow.com/questions/9690981/compare-two-primitive-long-variables-in-
java
Given the code fragment:
What is the result?
B
Identify two Java reserved words.
B, C
Explanation:
Reference: https://www.computerhope.com/jargon/j/java_reserved_words.htm
Which statement is true about a Java method?
B
Explanation:
Reference: https://www.quora.com/Can-we-define-a-function-within-another-function-in-Java
Given:
And the code fragment:
Which code fragment can be inserted at line n1 to enable the code to print All the best?
B
Given the code fragment:
Which two code fragments are valid at line 2?
A.
for (int count = 0; count < 5; count++) {
System.out.print(count);
}
B.
package p1;
C.
import java.util.*;
public void display() {
List<Integer> nums = new ArrayList<> ();
}
D.
{
private int num;
}
E.
private String name = “John”;
public void display() {
System.out.print(name);
}
B, E
You have been asked to develop a Java program that prints the elements of an array in reverse order.
Which looping statement cannot be used to meet the requirement?
D
Explanation:
Reference: https://www.javatpoint.com/java-program-to-print-the-elements-of-an-array-in-reverse-
order
Given the code fragment:
Which statement is true?
A.
The code results in a compilation error. To make it compile, insert at line n1:
import java.lang.Math;
import java.lang.Random;
B.
The code compiles successfully
C.
The code results in a compilation error. To make it compile, insert at line n1:
import java.lang;
import java.util;
D.
The code results in a compilation error. To make it compile, insert at line n1:
import java.util.*;
B
Given the code fragment:
What is the result?
D
Given the code fragment:
Which code fragment, when inserted at line n1, enables the code to print Java Programming:1?
C
Given:
What is the result?
A
Which two Java reserved words are used to implement encapsulation?
C, E
Explanation:
Reference: https://learn.saylor.org/mod/page/view.php?id=22044
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;
B.
Ball.weight = 0.0;
C.
Ball b = new Ball(0.0);
D.
Ball b = new Ball();
D
Which two statements are true about the Java Runtime Environment (JRE)?
B, D
Explanation:
Reference: https://en.wikipedia.org/wiki/Java_virtual_machine
Identify two features of Java.
B, D
Explanation:
Reference: https://www.javatpoint.com/features-of-java