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.*;
Given the code:
Which code fragment, when inserted at line n1, enables the code to print sum is 30?
A. int sum(int a, b) {
B. int sum(int a, int b) {
C. int sum(int, int) {
D. int sum(int[] a, b) {
Given the code fragment: What is the result?
A. false false -1
B. true false 0
C. true true 0
D. false true -1
Identify two class variables.
A. private static int numberOfSquares = 20;
B. public static int counter = 0;
C. private Measure cm;
D. public int size = 10;
E. int scale = 35;
Which statement is valid?
A. int 2 totalScore = 0;
B. int total-score = 0;
C. int totalScore2 = 0;
D. int total score = 0;
Given the code fragment:
What is the result?
A. false false
B. true true
C. true false
D. false true
Given the code fragment: What is the result?
A. [jasmine, rose, lily]
B. A runtime exception is thrown.
C. [jasmine, lily, lotus]
D. [jasmine, rose, lotus, lily]
Given the code fragment:
Which statement, when inserted at line n1, enables the code to print 0 2 4 6 8 10?
A. count = (count++) +1;
B. count = count++;
C. count =+ 2;
D. count += 2;
Given the code fragment:
What is the result?
A. 3 : 1
B. 3 : 2
C. 0 : 1
D. 2 : 0
Given the code fragment:
What is the result?
A. 25.67
B. 25.00
C. 25.7
D. 26