Issuu on Google+

Full file at http://testbank360.eu/test-bank-fundamentals-of-java-3rd-edition-lambe

Chapter 2—First Java Programs TRUE/FALSE 1. Java is the fastest growing programming language in the world. ANS: T

PTS: 1

REF: 31

2. Java programs cannot be run on different types of computers unless code changes are made. ANS: F

PTS: 1

REF: 32

3. Compared to C++, Java is more difficult to use and learn, more error prone, and less portable. ANS: F

PTS: 1

REF: 32

4. A JVM is a program that behaves like a computer. ANS: T

PTS: 1

REF: 32

5. Any computer can run an interpreter. ANS: T

PTS: 1

REF: 33

6. Java applets are inherently insecure. ANS: F

PTS: 1

REF: 33

7. Terminal-oriented programs are similar in structure to programs that process files of sequentially organized data. ANS: T

PTS: 1

REF: 34

8. Sending messages to objects always takes the form <name of object>(<parameters>). ANS: T

PTS: 1

REF: 35

9. Java programs cannot be written using a simple text editor, such as Notepad. ANS: F

PTS: 1

REF: 38

10. When a syntax error is found by the Java compiler, the error message that is provided yields no information about the type of error that occurred or where it occurred. ANS: F

PTS: 1

REF: 40

11. The main factor affecting a program’s readability is its layout. ANS: T

PTS: 1

REF: 41

12. During the course of a program, a variable’s value cannot change.


Full file at http://testbank360.eu/test-bank-fundamentals-of-java-3rd-edition-lambe

ANS: F

PTS: 1

REF: 43

13. It is required that variable names begin with a lowercase letter. ANS: F

PTS: 1

REF: 43

14. There is a limit to the number of variables that you can declare in a program. ANS: F

PTS: 1

REF: 43

15. The default layout manager for frames is an instance of the class BorderLayout. ANS: T

PTS: 1

REF: 49

MULTIPLE CHOICE 1. Java is a modern ____ programming language. a. first-generation c. procedural b. object-oriented d. second-generation ANS: B

PTS: 1

REF: 32

2. Java bears a superficial resemblance to ____, which is currently the worldâ&#x20AC;&#x2122;s most popular industrialstrength programming language. a. C c. COBOL b. BASIC d. C++ ANS: D

PTS: 1

3. The Java compiler translates Java into ____. a. natural language b. machine language ANS: C

PTS: 1

REF: 32 c. byte code d. bit code REF: 32

4. A(n) ____ user interface uses the Java console and the command prompt to display data, prompt the user for data, and read data into a program. a. terminal I/O c. graphical b. text d. illustrative ANS: A

PTS: 1

REF: 33

5. ____ is the name of an object that knows how to display or print characters in a terminal window. a. System c. System.out b. System.terminal d. Out.System ANS: C

PTS: 1

REF: 35

6. The end of a statement in a Java program is denoted by a ____. a. : c. ; b. . d. } ANS: C

PTS: 1

REF: 35


Full file at http://testbank360.eu/test-bank-fundamentals-of-java-3rd-edition-lambe

7. Which of the following Java statements would print the text “Hello” in a terminal window? a. System.println(“Hello”); c. System.printLine(“Hello”); System.out.println(Hello); b. d. System.out.println(“Hello”); ANS: D

PTS: 1

REF: 35

8. The file extension for a Java source code file must be ____. a. .java c. .jav b. .j d. .sun ANS: A

PTS: 1

REF: 37

9. The file extension for a byte code file is always ____. a. .cla c. .java b. .class d. .jav ANS: B

PTS: 1

REF: 37

10. Using a simple text editor in Windows to write Java programs, plus running the Java compiler and the JVM from the command line in Windows is known as the ____ development environment. a. simple c. integrated b. DOS d. Windows ANS: B

PTS: 1

REF: 38

11. A(n) ____ statement, found at the beginning of a Java source code file, tells the compiler where to find complete specifications for a class that will be used in the Java source code. a. include c. use b. export d. import ANS: D

PTS: 1

REF: 43

12. In general, instantiation takes the form ____. a. SomeClass someObject = new SomeClass(some parameters); b. SomeClass someObject = SomeClass(some parameters); c. someObject = new SomeClass(some parameters); d. SomeClass = new SomeClass(some parameters); ANS: A

PTS: 1

REF: 43

13. The assignment operator is represented in Java by the symbol ____. a. > c. == b. = d. != ANS: B

PTS: 1

REF: 44

14. The multiplication operator is represented in Java by the symbol ____. a. x c. * b. / d. % ANS: C

PTS: 1

REF: 44

15. The code for application windows in Java is located in the class ____. a. JApp c. JWindow


Full file at http://testbank360.eu/test-bank-fundamentals-of-java-3rd-edition-lambe

b. JFrame ANS: B

d. WindowFrame PTS: 1

REF: 47

COMPLETION 1. Java is secure, robust, and ____________________. ANS: portable PTS: 1

REF: 32

2. A(n) ____________________ is a process that can run concurrently with other processes. ANS: thread PTS: 1

REF: 32

3. Java runs more slowly than most modern programming languages because it is ____________________. ANS: interpreted PTS: 1

REF: 32

4. To run Java byte code on a particular computer, you must install a(n) ____________________ unless it comes with the operating system. ANS: Java virtual machine (JVM) Java virtual machine JVM PTS: 1

REF: 32

5. Some JVMs translate byte code instructions into machine language when they are first encountered, which is a process called ____________________. ANS: just-in-time compilation (JIT) just-in-time compilation JIT PTS: 1

REF: 32-33

6. A(n) ____________________ is a sequence of instructions for a computer. ANS: program PTS: 1

REF: 34


Full file at http://testbank360.eu/test-bank-fundamentals-of-java-3rd-edition-lambe

7. The string of characters that appears between the parentheses following a System.out.println message is called a(n) ____________________. ANS: parameter PTS: 1

REF: 35

8. When sending a message to an object, the period between the object’s name and the message’s name is called a(n) ____________________. ANS: method selector operator PTS: 1

REF: 35

9. Metrowerks’ Code Warrior, Microsoft’s Visual J++, and Borland’s JBuilder are examples of ____________________. ANS: integrated development environments (IDEs) integrated development environments IDEs PTS: 1

REF: 38

10. To compile a Java program stored in the file Hello.java from the command line, you would use the command ____________________. ANS: javac Hello.java PTS: 1

REF: 39

11. Once the Java program contained in the file Hello.java has been compiled, you can run it from the command line using the command ____________________. ANS: java Hello PTS: 1

REF: 39

12. Mistakes detected by the compiler are called ____________________. ANS: syntax errors compile-time errors PTS: 1

REF: 40

13. ____________________ are used to share information between objects. ANS: Parameters PTS: 1

REF: 43


Full file at http://testbank360.eu/test-bank-fundamentals-of-java-3rd-edition-lambe

14. A numeric ____________________ names a location in RAM in which a number can be stored. ANS: variable PTS: 1

REF: 43

15. Variables of type double are used to store ____________________ numbers. ANS: floating-point PTS: 1

REF: 43

16. Statements utilizing an assignment operator are called ____________________ statements. ANS: assignment PTS: 1

REF: 44

17. In Java, as in algebra, multiplication and division are done before addition and subtraction unless ____________________ are used to change the order of the computations. ANS: parentheses PTS: 1

REF: 44

18. After the statement Scanner reader = new Scanner(System.in); has been executed in a program, the variable reader stores a(n) ____________________ to a Scanner object. ANS: reference PTS: 1

REF: 45

19. A(n) ____________________ is a flat, rectangular area suitable for displaying other objects, such as geometric shapes and images. ANS: panel PTS: 1

REF: 48

20. In Java, each container object, such as a frame or a panel, uses an object called a(n) ____________________ to coordinate the organization and layout of items within the container. ANS: layout manager PTS: 1

REF: 49


Test bank fundamentals of java 3rd edition lambert