Mid-Term Study Guide Ch 1
Java compiler translates Java source code into _________. a. Java bytecode b. machine code c. assembly code d. another high-level language code
a. Java bytecode
_________ is a software that interprets Java bytecode. a. Java virtual machine b. Java compiler c. Java debugger d. Java API
a. Java virtual machine
If you forget to put a closing quotation mark on a string, what kind error will be raised?a. a compilation error b. a runtime error c. a logic error
a. a compilation error
Which JDK command is correct to run a Java application in ByteCode.class? a. java ByteCode b. java ByteCode.class c. javac ByteCode.java d. javac ByteCode e. JAVAC ByteCode
a. java ByteCode
A Java application must have a main method. a. true b. false
a. true
The keywords in Java are all in lowercase. a. true b. false
a. true
Four bytes have ________ bits. a. 8 b. 16 c. 32 d. 64
c. 32
The extension name of a Java source code file is a. .java b. .obj c. .class d. .exe
a. .java
Which of the following statements is correct? a. Every line in a program must end with a semicolon. b. Every statement in a program must end with a semicolon. c. Every comment line must end with a semicolon. d. Every method must end with a semicolon. e. Every class must end with a semicolon.
b. Every statement in a program must end with a semicolon.
________ contains predefined classes and interfaces for developing Java programs. a. Java language specification b. Java API c. Java JDK d. Java IDE
b. Java API
Which of the following statements is correct to display Welcome to Java on the console? a. System.out.println('Welcome to Java'); b. System.out.println("Welcome to Java"); c. System.println('Welcome to Java'); d. System.out.print('Welcome to Java');
b. System.out.println("Welcome to Java");
___________ translates high-level language program into machine language program. a. An assembler b. A compiler c. CPU d. The operating system
b. a complier
A block is enclosed inside __________. a. parentheses b. braces c. brackets d. quotes
b. braces
Which of the following lines is not a Java comment? a. /** comments */ b. // comments c. # comments d. /* comments */
c. # comments
________ consists of a set of separate programs for developing and testing Java programs, each of which is invoked from a command line. a. Java language specification b. Java API c. Java JDK d. Java IDE
c. Java JDK
Programming style is important, because ______________. a. a program may not compile if it has a bad style b. good programming style can make a program run faster c. good programming style makes a program more readable
c. good programming style makes a program more readable
The JDK command to compile a class in the file Test.java is a. java Test b. java Test.java c. javac Test.java d. javac Test e. JAVAC Test.java
c. javac Test.java
The main method header is written as: a. public static void main(string[] args) b. public static void Main(String[] args) c. public static void main(String[] args) d. public static main(String[] args)
c. public static void main(String[] args)
________ provides an integrated development environment for rapidly developing Java programs. Editing, compiling, building, debugging, and online help are integrated in one graphical user interface. a. Java language specification b. Java API c. Java JDK d. Java IDE
d. Java IDE
Suppose you define a Java class as follows: public class Test { } In order to compile this program, the source code should be stored in a file named a. Test.class b. Test.doc c. Test.txt d. Test.java e. Any name with extension .java
d. Test.java
Which of the following are the reserved words? a. public b. static c. void d. class e. All above
e. All above