Quiz 1
One byte has ________ bits. Selected Answer: a. 8 Correct Answer: a. 8
.
The JDK command to compile a class in the file Test.java is Selected Answer: e. javac Test.java Correct Answer: e. javac Test.java
.
Which of the following code has the best style? I: public class Test { public static void main(String[] args) { System.out.println("Welcome to Java!"); } } II: public class Test { public static void main(String[] args) { System.out.println("Welcome to Java!"); } } III: public class Test { public static void main(String[] args) { System.out.println("Welcome to Java!"); } } IV: public class Test { public static void main(String[] args) { System.out.println("Welcome to Java!"); } } Selected Answer: d. II Correct Answer: a. IV
.
________ is a technical definition of the language that includes the syntax and semantics of the Java programming language. Selected Answer: c. Java language specification Correct Answer: c. Java language specification
.
___________ translates high-level language program into machine language program. Selected Answer: c. A compiler Correct Answer: c. A compiler
A complier
Java compiler translates Java source code into _________. Selected Answer: c. Java bytecode Correct Answer: c. Java bytecode
Code
nalyze the following code. I: public class Test { public static void main(String[] args) { System.out.println("Welcome to Java!"); } } II: public class Test { public static void main(String[] args) { System.out.println("Welcome to Java!"); } } Selected Answer: b. Only the code in I can compile and run and display Welcome to Java. Correct Answer: d. Both I and II can compile and run and display Welcome to Java, but the code in I has a better style than II.
Code
________ provides an integrated development environment (IDE) for rapidly developing Java programs. Editing, compiling, building, debugging, and online help are integrated in one graphical user interface. Selected Answer: c. Java JDK Correct Answer: a. Java IDE
Java IDE
Computer can execute the code in ____________. Selected Answer: a. machine language Correct Answer: a. machine language
Machine Language CP
The main method header is written as: Selected Answer: c. public static void main(String[] args) Correct Answer: c. public static void main(String[] args)
Main Method Header
The speed of the CPU may be measured in __________. Selected Answers: d. gigahertz Correct Answers: b. megahertz and d. gigahertz
Speed of CPU
Which of the following is not permanent storage devices? Selected Answer: a. main memory Correct Answer: a. main memory
Storage Device
Java was developed by ____________. Selected Answer: b. Sun Microsystems Correct Answer: b. Sun Microsystems
Sun Microsystems
Which of the following statements is correct? Selected Answer: a. Every statement in a program must end with a semicolon. Correct Answer: a. Every statement in a program must end with a semicolon.
What does Java end in?
________ is interpreted. Selected Answer: a. Java Correct Answer: a. Java
What is Java
____________ is an operating system. Selected Answer: e. Windows Correct Answer: e. Windows
Windows
Which of the following lines is not a Java comment? Selected Answers: c. -- comments Correct Answers: c. -- comments e. ** comments **
c. and e.
Programming style is important, because ______________. Selected Answers: a. good programming style makes a program more readable Correct Answers: a. good programming style makes a program more readable c. good programming style helps reduce programming errors
c. good programming style helps reduce programming errors
If a program compiles fine, but it produces incorrect result, then the program suffers __________. Selected Answer: b. a logic error Correct Answer: b. a logic error
logic error
A block is enclosed inside __________. Selected Answer: c. braces Correct Answer: c. braces
{ { braces