🎧 New: AI-Generated Podcasts Turn your study notes into engaging audio conversations. Learn more

Java8e_Gaddis_ch01.docx

Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

Transcript

**Starting Out with Java: From Control Structures through Objects 8e (Gaddis)** **Chapter 1 Introduction to Computers and Java** **TRUE/FALSE** 1\. Logical errors are mistakes that cause the program to produce erroneous results. ANS: T 2\. The Java Virtual Machine is a program that reads Java b...

**Starting Out with Java: From Control Structures through Objects 8e (Gaddis)** **Chapter 1 Introduction to Computers and Java** **TRUE/FALSE** 1\. Logical errors are mistakes that cause the program to produce erroneous results. ANS: T 2\. The Java Virtual Machine is a program that reads Java byte code instructions and executes them as they are read. ANS: T 3\. Colons are used to indicate the end of a Java statement. ANS: F 4\. Compiled byte code is also called source code. ANS: F 5\. Application software refers to programs that make the computer useful to the user. ANS: T 6\. Each byte is assigned a unique number known as an address. ANS: T 7\. Encapsulation refers to the combining of data and code into a single object. ANS: T 8\. Java source files end with the **.class** extension. ANS: F 9\. A procedure is a set of programming language statements that, together, perform a specific task. ANS: T 10\. A solid-state drive has no moving parts and operates faster than a traditional disk drive. ANS: T 11\. The computer is a tool used by so many professionals that it cannot be easily categorized. ANS: T 12\. Without programmers, the users of computers would have no software, and, without software, computers would not be able to do anything. ANS: T 13\. The contents of a variable cannot be changed while the program is running. ANS: F 14\. Java source files end with the.class extension. ANS: F 15\. When an object\'s internal data is hidden from outside code and access to that data is retricted to the object\'s methods, the data is protected from accidental corruption. ANS: T **MULTIPLE CHOICE** 1\. While \_\_\_\_\_\_\_\_\_\_ is centered on creating procedures, \_\_\_\_\_\_\_\_\_\_ is centered on creating objects. ---- ----------------------------------------------------- a. procedural programming, object-oriented programming b. object-oriented programming, procedural programming c. routine programming, method programming d. procedural programming, class programming ---- ----------------------------------------------------- ANS: A 2\. RAM is usually ---- ------------------------------------------------------- a. an input/output device b. a volatile type of memory, used for temporary storage c. secondary storage d. a static type of memory, used for permanent storage ---- ------------------------------------------------------- ANS: B 3\. The two primary methods of programming in use today are ---- -------------------------------- a. procedural and object-oriented b. hardware and software c. practical and theoretical d. desktop and mobile ---- -------------------------------- ANS: A 4\. Validating the results of a program is important to ---- --------------------------------------------------- a. correct runtime errors b. make sure the program solves the original problem c. create a model of the program d. correct syntax error ---- --------------------------------------------------- ANS: B 5\. Software refers to ---- ----------------------------------------------- a. programs b. the physical components a computer is made of c. firmware d. data stored in RAM ---- ----------------------------------------------- ANS: A 6\. An object typically hides its data but allows outside code access to ---- -------------------------------------- a. the pseudocode b. the methods that operate on the data c. private data members d. the data files ---- -------------------------------------- ANS: B 7\. Variables are ---- ------------------------------------------------------------------------------------------- a. symbolic names made up by the programmer and once created, their values cannot be changed b. operators that perform operations on one or more operands c. symbolic names made up by the programmer that represent memory locations d. reserved words ---- ------------------------------------------------------------------------------------------- ANS: C 8\. \_\_\_\_\_\_\_\_\_\_ refers to the physical components that a computer is made of. ---- ------------- ---- -------------- a. Input c. Control unit b. Main memory d. Hardware ---- ------------- ---- -------------- ANS: D 9\. A characteristic of \_\_\_\_\_\_\_\_\_\_ is that only an object\'s methods are able to directly access and make changes to an object\'s data. ---- ------------ ---- ----------------------- a. classes c. data hiding b. procedures d. component reusability ---- ------------ ---- ----------------------- ANS: C 10\. Because Java byte code is the same on all computers, compiled Java programs ---- ----------------------------------------------------------------------- a. are nonexistent b. must be re-compiled for each different machine before they can be run c. are highly portable d. cannot run on computers with different operating systems ---- ----------------------------------------------------------------------- ANS: C 11\. A cross between human language and a programming language is called ---- ------------ ---- -------------------------- a. a compiler c. the Java Virtual Machine b. pseudocode d. the Java language ---- ------------ ---- -------------------------- ANS: B 12\. Byte code instructions are ---- --------------------------------- a. machine code instructions b. syntax errors c. read and interpreted by the JVM d. another name for source code ---- --------------------------------- ANS: C 13\. One type of design tool used by programmers when creating a model of a program is ---- ----------- ---- ------------ a. the ALU c. syntax b. byte code d. pseudocode ---- ----------- ---- ------------ ANS: D 14\. Keywords are ---- ---------------------------------------------------------------------------- a. symbols or words that perform operations on one or more operands b. words or characters representing values that are defined by the programmer c. the data names in your program d. words that have a special meaning in the programming language ---- ---------------------------------------------------------------------------- ANS: D 15\. Computers can do many different jobs because they are ---- -------------- ---- ------------ a. programmable c. automated b. reliable d. electronic ---- -------------- ---- ------------ ANS: A 16\. A(n) \_\_\_\_\_\_\_\_\_\_ is a software entity that contains data and procedures. ---- --------- ---- -------- a. object c. class b. program d. method ---- --------- ---- -------- ANS: A 17\. Application software refers to ---- -------------------------------------------------------- a. the programs that make the computer useful to the user b. the operating system c. keywords d. pseudocode ---- -------------------------------------------------------- ANS: A 18\. The end of a Java statement is indicated by a \_\_\_\_\_\_\_\_. ---- ------------------- ---- ------------------- a. bracket (**}**) c. semicolon (**;**) b. asterisk (**\***) d. colon (**:**) ---- ------------------- ---- ------------------- ANS: C 19\. What is syntax? ---- ------------------------------------------------------------------- a. the rules that must be followed when writing a program b. the words that have a special meaning in the programming language c. the symbols or words that perform operations in a program d. the words or characters that are defined by the programmer ---- ------------------------------------------------------------------- ANS: A 20\. A set of programming language statements that perform a specific task is a(n) ---- ------------------ ---- ----------- a. pseudocode chart c. object b. source code d. procedure ---- ------------------ ---- ----------- ANS: D 21\. The central processing unit (CPU) consists of two parts which are ---- ---------------------------------------------------------- a. the input and output devices b. the control unit and the arithmetic and logic unit (ALU) c. the control unit and main memory d. the arithmetic and logic unit (ALU) and main memory ---- ---------------------------------------------------------- ANS: B 22\. There are \_\_\_\_\_\_\_\_\_\_ bits in a byte. ---- --- ---- ---- a. 4 c. 16 b. 8 d. 32 ---- --- ---- ---- ANS: B 23\. A runtime error is usually the result of ---- ----------------- ---- ------------------ a. a logical error c. a compiler error b. a syntax error d. bad data ---- ----------------- ---- ------------------ ANS: A 24\. A(n) \_\_\_\_\_\_\_\_\_\_ is used to write computer programs. ---- --------------------- ---- ---------------------- a. pseudocode document c. application b. operating system d. programming language ---- --------------------- ---- ---------------------- ANS: D 25\. \_\_\_\_\_\_\_\_\_\_ refers to the physical components that a computer is made of. ---- ------------ ---- ------------ a. The device c. Software b. Hardware d. The system ---- ------------ ---- ------------ ANS: B 26\. A computer program is ---- ------------------------------------------------------------------------------------ a. the same as main memory b. only used for desktop computers c. a set of instructions that allow the computer to solve a problem or perform a task d. another name for an operating system ---- ------------------------------------------------------------------------------------ ANS: C 27\. Which of the following is not part of the programming process? ---- --------------------------------------------------- a. defining and modeling the problem b. entering code and compiling it c. testing and debugging d. All of these are parts of the programming process ---- --------------------------------------------------- ANS: D 28\. Computer programming is ---- ----------- ---- ---------------------- a. an art c. both of the above b. a science d. neither of the above ---- ----------- ---- ---------------------- ANS: C 29\. The original name for Java was ---- ------------ ---- ----- a. JavaScript c. Elm b. HotJava d. Oak ---- ------------ ---- ----- ANS: D 30\. A program is a sequence of instructions stored in ---- ------------------------ ---- ---------- a. the CPU c. software b. the computer\'s memory d. firmware ---- ------------------------ ---- ---------- ANS: B 31\. Which of the following is ***not*** one of the major components of a typical computer system? ---- --------------------------------------- a. the CPU b. input/output devices c. main memory d. secondary storage devices e. All of the above are major components ---- --------------------------------------- ANS: E 32\. Byte code instructions are ---- --------------------------------- a. another name for source code b. syntax errors c. machine code instructions d. read and interpreted by the JVM ---- --------------------------------- ANS: D 33\. Which of the following is a software entity that contains data and procedures? ---- ----------- ---- ----------- a. a method c. a class b. an object d. a program ---- ----------- ---- ----------- ANS: B 34\. Each different type of CPU has its own ---- ---------- ---- ------------------ a. syntax c. machine language b. firmware d. software ---- ---------- ---- ------------------ ANS: C 35\. Internally, the central processing unit (CPU) consists of two parts which are \_\_\_\_\_\_\_\_\_\_ ---- ------------------------------------------------------ a. the control unit and the arithmetic/logic unit (ALU) b. the control unit and main memory c. the arithmetic/logic unit (ALU) and main memory d. the input and output devices ---- ------------------------------------------------------ ANS: A 36\. Java was developed by ---- ----------- ---- ------------------ a. Microsoft c. Sun Microsystems b. IBM d. Hewlett-Packard ---- ----------- ---- ------------------ ANS: C 37\. Which of the following will compile a program called ReadIt? ---- ------------------- ---- -------------------- a. java ReadIt.java c. javac ReadIt.java b. java ReadIt.javac d. javac ReadIt.javac ---- ------------------- ---- -------------------- ANS: C 38\. Which of the following will run the compiled program called ReadIt? ---- ------------------ ---- ------------ a. java ReadIt.java c. run ReadIt b. java ReadIt d. go ReadIt ---- ------------------ ---- ------------ ANS: B

Tags

java programming computer science programming concepts
Use Quizgecko on...
Browser
Browser