JAVA QUESTIONS
MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. 1) The extension name of a Java bytecode file is A) .obj B) .exe C) .class D) .java 1) 2) ________ is a device to connect a computer to a local area network (LAN). A) Cable modem B) Regular modem C) DSL D) NIC 2) 3) ________ contains predefined classes and interfaces for developing Java programs. A) Java IDE B) Java API C) Java JDK D) Java language specification 3) 4) The ________ method displays a message dialog box. (Choose all that apply.) A) JOptionPane.displayMessageDialog(null, ʺWelcome to Java!ʺ, ʺExample 1.2 Outputʺ, JOptionPane.INFORMATION_MESSAGE); B) JOptionPane.showMessage(null, ʺWelcome to Java!ʺ, ʺExample 1.2 Outputʺ, JOptionPane.INFORMATION_MESSAGE); C) JOptionPane.showMessageDialog(null, ʺWelcome to Java!ʺ, ʺExample 1.2 Outputʺ, JOptionPane.INFORMATION_MESSAGE); D) JOptionPane.displayMessage(null, ʺWelcome to Java!ʺ, ʺExample 1.2 Outputʺ, JOptionPane.INFORMATION_MESSAGE); E) JOptionPane.showMessageDialog(null, ʺWelcome to Java!ʺ); 4) 5) Every statement in Java ends with ________. A) an asterisk (*) B) a period (.) C) a semicolon (;) D) a comma (,) 5) 6) Which of the following statements is correct? A) Every method must end with a semicolon. B) Every line in a program must end with a semicolon. C) Every comment line must end with a semicolon. D) Every class must end with a semicolon. E) Every statement in a program must end with a semicolon. 6) 7) Java was developed by ________. A) IBM B) Sun Microsystems C) Oracle D) Microsoft E) Cisco Systems 7) 8) ________ translates high-level language program into machine language program. A) A compiler B) The operating system C) An assembler D) CPU 8) 1 9) The main method header is written as: A) public static void main(string[ ] args) B) public static main(String[ ] args) C) public static void Main(String[ ] args) D) public static void main(String[ ] args) E) public void main(String[ ] args) 9) 10) One byte has ________ bits. A) 4 B) 8 C) 16 D) 12 10) 11) The extension name of a Java source code file is A) .java B) .exe C) .class D) .obj 11) 12) ________is Architecture-Neutral. A) C B) Java C) Pascal D) C++ E) Ada 12) 13) ________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. A) Java language specification B) Java IDE C) Java JDK D) Java API 13) 14) To improve readability and maintainability, you should declare ________ instead of using literal values such as 3.14159. A) variables B) constants C) methods D) classes 14) 15) -24 % 5 is ________. A) -1 B) -2 C) -3 D) -4 E) 0 15) 16) The ________ method parses a string s to a double value. A) double.parseDouble(s); B) double.parse(s); C) Double.parsedouble(s); D) Double.parseDouble(s); 16) 17) Suppose i is an int type variable. Which of the following statements display the character whose Unicode is stored in variable i? A) System.out.println(i + ʺ ʺ); B) System.out.println(i); C) System.out.println((char)i); D) System.out.println((int)i); 17) 18) Math.pow(2, 3) returns ________. A) 8 B) 9.0 C) 8.0 D) 9 18) 19) If a program compiles fine, but it produces incorrect result, then the program suffers
9 years ago
Purchase the answer to view it

- quiz2_1.docx