Solution and Answer Guide: Farrell, Programming Logic and Design CY24, 9780357880876; Chapter 1: An Overview of Computers and Programming
Solution and Answer Guide
FARRELL, PROGRAMMING LOGIC AND DESIGN CY24, 9780357880876; CHAPTER 1: AN OVERVIEW OF COMPUTERS AND PROGRAMMING
TABLE OF CONTENTS Review Questions Answers .................................................................................................1 Programming Exercises Solutions ..................................................................................... 9 Performing Maintenance Solutions ................................................................................. 18 Debugging Exercises Solutions ........................................................................................ 19 Game Zone Solutions .........................................................................................................21
REVIEW QUESTIONS ANSWERS 1.
Computer programs also are known as _______________. (1.1) a. data b. hardware c. software d. information Answer: c Feedback: a. Incorrect. Data is the facts and figures that are input to programs. b. Incorrect. Hardware is computer equipment. c. Correct. Computer programs are called software as opposed to computer equipment, which is hardware. Data is the facts and figures that are input into programs, while information is data that has been processed and output. d. Incorrect. Information is data that has been processed and output.
2. The major operations performed by all sizes of computers include _______________. (1.1) a. b. c. d.
input, processing, and output hardware and software sequence and looping spreadsheets and word processing
Answer: a Feedback:
© 2024 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
1
Solution and Answer Guide: Farrell, Programming Logic and Design CY24, 9780357880876; Chapter 1: An Overview of Computers and Programming
a. Correct. All computers perform input, processing, and output to change data into information. Hardware and software are, respectively, the equipment and programs in a computer system. Sequence and looping describe groups of software instructions, and spreadsheets and word processing are examples of software applications. b. Incorrect. Hardware and software are equipment and programs, respectively. c. Incorrect. Sequence and looping are two logical structures. d. Incorrect. Spreadsheets and word processing are examples of software applications. 3. Visual Basic, C++, and Java are all examples of computer _______________. (1.1–1.3) a. b. c. d.
operating systems programming languages hardware machine languages
Answer: b Feedback: a. Incorrect. Operating systems manage computer resources. Windows, Linux, Apple iOS, and Unix are examples of operating systems. b. Correct. Visual Basic, C++, and Java are high-level programming languages. They are far more English-like than machine language, which consists of 0s and 1s. Hardware is equipment. Operating systems are the software that manage a computer’s resources. c. Incorrect. Hardware is equipment such as printers and monitors. d. Incorrect. Machine languages are binary language; Visual Basic, C++, and Java are higher-level languages, meaning they are more English-like. 4. A programming language’s rules are its _______________. (1.1) a. b. c. d.
syntax logic format options
Answer: a Feedback: a. Correct. A programming language’s rules are its syntax. b. Incorrect. Logic is the series of events that leads to a solution. c. Incorrect. The term “format” has nothing to do with language rules. d. Incorrect. Options are not programming language rules. 5. The most important task of a compiler or interpreter is to _______________. (1.1)
© 2024 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
2
Solution and Answer Guide: Farrell, Programming Logic and Design CY24, 9780357880876; Chapter 1: An Overview of Computers and Programming
a. b. c. d.
create the rules for a programming language translate English statements into a language such as Java translate programming language statements into machine language execute machine language programs to perform useful tasks
Answer: c Feedback: a. Incorrect. The designers of a programming language create its rules. b. Incorrect. Programmers translate English statements into programming languages. c. Correct. Compilers and interpreters translate programming language statements into machine language. d. Incorrect. A computer’s CPU executes programs. 6. Which of the following is temporary, internal storage? (1.1) a. b. c. d.
CPU hard disk keyboard memory
Answer: d Feedback: a. Incorrect. A CPU is hardware that performs processing. b. Incorrect. A hard disk is a hardware storage device. c. Incorrect. A keyboard is a hardware input device. d. Correct. Memory is temporary, internal storage. 7. Which of the following pairs of steps in the programming process is in the correct order? (1.3) a. b. c. d.
code the program, plan the logic test the program, translate it into machine language put the program into production, understand the problem code the program, translate it into machine language
Answer: d Feedback: a. Incorrect. You must plan the logic before you code the program. b. Incorrect. You must translate the program into machine language before it can be tested. c. Incorrect. You must understand the problem before you can write the program and ultimately put it into production.
© 2024 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
3
Solution and Answer Guide: Farrell, Programming Logic and Design CY24, 9780357880876; Chapter 1: An Overview of Computers and Programming
d. Correct. You code the program and then translate it into machine language before you can run it. 8. A programmer’s most important task before planning the logic of a program is to _______________. (1.3) a. b. c. d.
decide which programming language to use code the problem train the users of the program understand the problem
Answer: d Feedback: a. Incorrect. Deciding which programming language to use is not the most important task. b. Incorrect. Coding the program is not the most important task. c. Incorrect. Training users is not the most important task. d. Correct. A programmer’s most important task is to understand the problem. 9. The two most commonly used tools for planning a program’s logic are _______________. (1.3) a. b. c. d.
ASCII and EBCDIC Java and Visual Basic flowcharts and pseudocode word processors and spreadsheets
Answer: c Feedback: a. Incorrect. ASCII and EBCDIC are code sets that represent characters in a computer system. b. Incorrect. Java and Visual Basic are programming languages. c. Correct. Flowcharts and pseudocode are commonly used planning tools. d. Incorrect. Word processors and spreadsheets are examples of application software. 10. Writing a program in a language such as C++ or Java is known as _______________ the program. (1.3) a. b. c. d.
translating coding interpreting compiling
Answer: b Feedback:
© 2024 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
4
Solution and Answer Guide: Farrell, Programming Logic and Design CY24, 9780357880876; Chapter 1: An Overview of Computers and Programming
a. Incorrect. Translating refers to turning a language’s statements into machine code. b. Correct. Coding a program is putting a program’s logic into a programming language. c. Incorrect. Interpreting refers to turning a language’s statements into machine code. d. Incorrect. Compiling refers to turning a language’s statements into machine code. 11. An English-like programming language such as Java or Visual Basic is a _______________ programming language. (1.3) a. b. c. d.
machine-level low-level high-level binary-level
Answer: c Feedback: a. Incorrect. English-like programming languages are high-level in contrast to machine-level languages. b. Incorrect. English-like programming languages are high-level in contrast to low-level languages. c. Correct. English-like programming languages are high-level in contrast to binary, low-level, machine languages. d. Incorrect. English-like programming languages are high-level in contrast to binary languages. 12. Which of the following is an example of a syntax error? (1.3) a. b. c. d.
producing output before accepting input subtracting when you meant to add misspelling a programming language word using a high-level programming language when a low-level language would have been more appropriate
Answer: c Feedback: a. Incorrect. Producing output at the wrong time is an error in logic. b. Incorrect. Subtracting when you meant to add is an error in logic. c. Correct. Misspelling a programming language word is a syntax error. d. Incorrect. Using an inappropriate language is an error in logic. 13. Which of the following is an example of a logical error? (1.3)
© 2024 Cengage. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
5