Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Title 1 Introduction
Book Python for Everyone
Edition 1
7. Computers store both data and programs not currently running in:
file:///C:/Horstmann1e_TB/ch01.testbank.xhtml 1/10
10/24/2017 Testbank (Chapter 1)
A. Primary storage.
B. Central processing unit.
C. Secondary storage. Answer
D. Transistors.
Title Where are programs and data stored?
Section 1.2 The Anatomy of a Computer
11. What part of the computer carries out arithmetic operations, such as addition, subtract, multiplication and
division?
A. CPU Answer
B. Secondary memory
C. Primary memory
D. Network
Title What is considered output hardware?
Section 1.2 The Anatomy of a Computer
13. What are two of the most important benefits of the Python language?
A. Advanced Math equations and strict data typing
B. Ease of use and portability Answer
file:///C:/Horstmann1e_TB/ch01.testbank.xhtml 2/10
10/24/2017 Testbank (Chapter 1)
A. Nothing, the variable total will be the sum of the three numbers
B. Python is case sensitive so Num1, Num2, and Num3 are undefined Answer
C. total must be initialized to zero first
D. The numbers should be 10.0, 20.0 and 30.0
Title What is wrong with the following code snippet?
Section 1.4 Becoming Familiar with Your Programming Environment
15. An integrated development environment (IDE) bundles tools for programming into a unified application.
What kinds of tools are usually included?
A. A web browser
B. An editor and a interpreter Answer
C. Presentation tools
D. Source files and class files
Title What kind of tools can be found in an IDE?
Section 1.4 Becoming Familiar with Your Programming Environment
17. What reads Python programs and executes the program instructions?
A. editor
B. CPU
C. compiler
D. interpreter Answer
Title What is used to execute a Python program?
Section 1.4 Becoming Familiar with Your Programming Environment
file:///C:/Horstmann1e_TB/ch01.testbank.xhtml 3/10
10/24/2017 Testbank (Chapter 1)
Section 1.4 Becoming Familiar with Your Programming Environment
19. By entering the command python3, the program runs in which mode?
A. interactive mode Answer
B. print mode
C. command mode
D. backup mode
Title What mode is invoked when the user enters "python" at the command prompt?
Section 1.4 Becoming Familiar with Your Programming Environment
20. The Python compiler reads the file containing your source code and converts it to:
A. machine code
B. assembly code
C. byte code Answer
D. virtual machine code
Title What type of code is created by the Python compiler?
Section 1.4 Becoming Familiar with Your Programming Environment
21. What is the correct sequence of steps invoked by the Python Interpreter:
A. source code -> virtual machine -> byte code -> compiler
B. source code -> compiler -> byte code -> virtual machine Answer
C. compiler -> source code -> virtual machine -> byte code
D. byte code -> virtual machine -> source code -> compiler
Title What is the role of the Interpreter?
Section 1.4 Becoming Familiar with Your Programming Environment
A. line number 2
B. line number 3 Answer
C. line number 4
D. Nothing, the program does not contain any comments
Title What is the syntax for a comment line?
Section 1.5 Analyzing Your First Program
24. A collection of programming instructions that carry out a particular task is called a:
A. program
B. compiler
C. function Answer
D. comment
Title What is a collection of programming instructions called?
file:///C:/Horstmann1e_TB/ch01.testbank.xhtml 4/10
10/24/2017 Testbank (Chapter 1)
Section 1.5 Analyzing Your First Program
print(25 + 84)
A. 2584
B. 109 Answer
C. 25 + 84
D. Nothing, this code snipped causes a compile time error
Title What is printed by a given code snippet?
Section 1.5 Analyzing Your First Program
C. The answer is 25 + 84
D. Nothing, this code snipped causes a compile time error
Title What is printed by a given code snippet?
Section 1.5 Analyzing Your First Program
print("25 + 84")
A. 2584
B. 109
C. 25 + 84 Answer
D. Nothing, this code snipped causes a compile time error
Title What is printed by a given code snippet?
Section 1.5 Analyzing Your First Program
A. GoodMorningClass!
B. Good Morning Class!
C. Good Morning Class ! Answer
D. nothing, this code produces a syntax error
Title What is printed by a given code snippet?
Section 1.5 Analyzing Your First Program
file:///C:/Horstmann1e_TB/ch01.testbank.xhtml 6/10
10/24/2017 Testbank (Chapter 1)
Title What is another name for a compile-time error?
Section 1.6 Errors
36. Although the following code statement is valid, print(10/0), what will happen when this code is
executed?
A. The program prints 0
B. The error message ZeroDivisionError: int division or modulo by zero is displayed Answer
C. The program runs, but nothing is printed
D. The error message SyntaxError: EOL while scanning string literal
Title What is another name for a compile-time error?
Section 1.6 Errors
37. The programmer, not the compiler, is responsible for testing a program to identify?
A. Undefined symbols
B. Syntax errors
C. Logic errors Answer
D. Out-of-memory errors
Title The programmer, not the compiler, is responsible for testing a program to identify?
Section 1.6 Errors
38. What is it called when you describe the steps that are necessary for finding a solution to a problem in
programming?
A. algorithm Answer
B. compile
C. interpret
D. code
Title What is it called when you describe the steps that are necessary for finding a solution to a
problem in programming?
Section 1.7 Problem Solving: Algorithm Design
39. The following pseudocode calculates the total purchase price for an item including sales tax, what is the
missing last line?
A. Set the total cost to the item cost plus the tax rate.
B. Set the total cost to the item cost times the tax.
C. Set the total cost to the item cost plus the tax. Answer
D. Set the total cost to the item tax.
Title What is the missing pseudocode?
Section 1.7 Problem Solving: Algorithm Design
num = 0
Repeat the following steps 15 times
file:///C:/Horstmann1e_TB/ch01.testbank.xhtml 7/10
10/24/2017 Testbank (Chapter 1)
45. Imagine you are planning to buy a new cell phone. You are considering two cell phones. These cell phones
have different purchase prices. Each mobile service provider charges a different rate for each minute that
the cell phone is used. To determine which cell phone is the better buy, you need to develop an algorithm
to calculate the total cost of purchasing and using each cell phone. What are all the inputs needed for this
algorithm?
A. The cost of each cell phone and the rate for each minute for each cell phone
B. The cost of each cell phone and the number of minutes provided with each cell phone
C. The cost of each cell phone, the rate per minute for each cell phone, and the number of minutes
provided with each cell phone
file:///C:/Horstmann1e_TB/ch01.testbank.xhtml 8/10
10/24/2017 Testbank (Chapter 1)
D. The cost of each cell phone, the rate per minute for each cell phone, and the number of minutes you
would use the cell phone Answer
Title Which inputs do you need to calculate cost of purchasing/using cell phone?
Section 1.7 Problem Solving: Algorithm Design
46. In order to run Python programs, the computer needs to have software called a(n)?
A. debugger
B. interpreter Answer
C. windows
D. assembler
Title Software needed to run Python on a computer?
Section 1.3 The Python Programming Language
Set a = 0
Set b = 0
Set c = 1
Set d = 1
Print d
Repeat until a equals 10
Set d = b + c
Set b = c
file:///C:/Horstmann1e_TB/ch01.testbank.xhtml 9/10
10/24/2017 Testbank (Chapter 1)
Set c = d
Add 1 to a
Print d
A. 1 3 5 7 9 11 13 15 17 19 21
B. 1 1 2 3 5 8 13 21 34 55 89 Answer
C. 1 2 3 4 5 6 7 8 9 10 11
D. 1 3 6 9 12 15 18 21 24 27 30
Title What does this algorithm produce?
Section 1.7 Problem Solving: Algorithm Design
file:///C:/Horstmann1e_TB/ch01.testbank.xhtml 10/10