Given the code fragment:
Which statement can be inserted into line n1 to print 1,2; 1,10; 2,20;?
Correct Answer:
B
Given the code fragment:
List
//line n1
);
Which code fragment must be inserted at line n1 to enable the code to print the maximum number in the nums list?
Correct Answer:
A
Given the content of Operator.java, EngineOperator.java, and Engine.java files:
and the code fragment:
What is the result?
Correct Answer:
A
Given that course.txt is accessible and contains:
Course : : Java
and given the code fragment:
public static void main (String[ ] args) { int i;
char c;
try (FileInputStream fis = new FileInputStream (“course.txt”); InputStreamReader isr = new InputStreamReader(fis);) { while (isr.ready()) { //line n1
isr.skip(2);
i = isr.read (); c = (char) i;
System.out.print(c);
}
} catch (Exception e) { e.printStackTrace();
}
}
What is the result?
Correct Answer:
B
Given:
and
Which interface from the java.util.function package should you use to refactor the class Txt?
Correct Answer:
C