passed 2025
________ translates high-level language program into machine language
program.
A). The operating system
B). A compiler
C). An assembler
D). CPU - correct answers A compiler
If a program compiles fine, but it produces incorrect result, then the program
suffers ________.
A). a compilation error
B). a runtime error
C). a logic error - correct answers a logic error
When you invoke a method with a parameter, the value of the argument is
passed to the parameter. This is referred to as _________.
A). pass by value
B). pass by name
C). pass by reference
D). method invocation - correct answers pass by value
, (char)('a' + Math.random() * ('z' - 'a' + 1)) returns a random character
__________.
A). between 'b' and 'y'
B). between 'a' and 'y'
C). between 'b' and 'z'
D). between 'a' and 'z' - correct answers between 'a' and 'z'
You should fill in the blank in the following code with ______________.
public class Test {
public static void main(String[] args) {
System.out.print("The grade is " + getGrade(78.5));
System.out.print("\nThe grade is " + getGrade(59.5));
}
public static _________ getGrade(double score) {
if (score >= 90.0)
return 'A';
else if (score >= 80.0)
return 'B';
else if (score >= 70.0)
return 'C';
else if (score >= 60.0)
return 'D';
else