Java I - Midterm
java
You use ________ to run a Java program.
TRUE
[TRUE/FALSE] $343 is a valid identifier
FALSE
[TRUE/FALSE] Java source code can be executed on a Java Virtual Machine
Java API
________ contains predefined classes and interfaces for developing Java programs
Java virtual machine
________ is a software that interprets Java bytecode
x.eqauls('a')
char class method for testing a matched character assume variable is named x and test for 'a'
-2
"AbA".compareToIgnoreCase("abC") returns
return new int[]{1, 2, 3};
"Suppose a method p has the following heading:
2
"abc".compareTo("aba") returns ___________.
A1
Note that the Unicode for character A is 65. The expression "A" + 1 evaluates to ________.
megahertz and gigahertz
The speed of the CPU may be measured in?
1234.6
The statement System.out.printf("%3.1f", 1234.56) outputs ___________.
double
The switch control variable cannot be what type of variable
Multiprogramming
runs multiple programs sharing CPU.
two bytes
A Java character is stored in __________.
Java interpreter
A ________ is a program that translates Java source code into Java bytecode.
[1, 20, 30, 40, 50]
Assume int[] scores = {1, 20, 30, 40, 50}, what is the output of System.out.println(java.util.Arrays.toString(scores))?
applets
Due to security reasons, Java ________ cannot run from a Web browser in the new version of Java
Boolean literal
In Java, the word true is
char[] charArray = new char[]{'a', 'b'}; and char[] charArray = {'a', 'b'};
How can you initialize an array of two characters to 'a' and 'b'?
5
How many elements are in array double[] list = new double[5]?
Java bytecode
Java compiler translates Java source code into
Java bytecode
Java compiler translates Java source code into ________.
overflows
Java does not report errorss on ____
-1
Math.cos(Math.PI) returns
javac Test.java
The JDK command to compile a class in the file Test.java is
class loader
The ________ loads Java bytecode to the memory
Double.parseDouble(s);
The __________ method parses a string s to a double value.
.class
The extension name of a Java bytecode file is ________
public static void main(String[] args)
The main method header is written as
Math.sin(Math.toRadians(35))
To obtain the sine of 35 degrees, use _______.
4.0
What is Math.rint(3.5)?
java ByteCode
Which JDK command is correct to run a Java application in ByteCode.class?
software
is a program written in a high-level programming language.
Multiprocessing
runs multiple programs concurrently using multiple processors
javac MyFirstProgram.java
type in the JDK command to compile the class MyFirstProgram