0% found this document useful (0 votes)
94 views19 pages

Test Bank For Starting Out With Python 3rd Edition

Uploaded by

ysajsmcqxb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
94 views19 pages

Test Bank For Starting Out With Python 3rd Edition

Uploaded by

ysajsmcqxb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

Test Bank + Answer Key

Test Bank for Starting Out with Python 3rd Edition by Tony Gaddis

View Full Product:


https://selldocx.com/products/test-bank-starting-out-with-python-3e-gaddis

Book Title: Starting Out with Python

Edition: 3rd Edition

Author: Tony Gaddis

Click above to view a sample


Gaddis: Starting Out with Python, 3e - Test Bank

Chapter Two

MULTIPLE CHOICE
1. What type of error produces incorrect results but does not prevent the program from running?
a. syntax
b. logic
c. grammatical
d. human
Gaddis: Starting Out with Python, 3e - Test Bank, Chapter Two 2

ANS: B

2. The program development cycle is made up of _____ steps that are repeated until no errors can
be found in the program.
a. five
b. four
c. three
d. six
Gaddis: Starting Out with Python, 3e - Test Bank, Chapter Two 3

ANS: A

3. What is the informal language that programmers use to create models of programs that have no
syntax rules and are not meant to be compiled or executed?
a. Flowchart
b. Algorithm
c. Code
d. Pseudocode
Gaddis: Starting Out with Python, 3e - Test Bank, Chapter Two 4

ANS: D

4. A(n) _____ is a diagram that graphically depicts the steps that take place in a program.
a. flowchart
b. algorithm
c. code
d. pseudocode
Gaddis: Starting Out with Python, 3e - Test Bank, Chapter Two 5

ANS: A

5. The _____ function reads a piece of data that has been entered at the keyboard and returns
that piece of data, as a string, back to the program.
a. input
b. output
c. eval_input
d. string_input
Gaddis: Starting Out with Python, 3e - Test Bank, Chapter Two 6

ANS: A

6. The line continuation character is a _____.


a. #
b. %
c. &
d. \
Gaddis: Starting Out with Python, 3e - Test Bank, Chapter Two 7

ANS: D

7. Which mathematical operator is used to raise five to the second power in Python?
a. /
b. **
c. ^
d. ~
Gaddis: Starting Out with Python, 3e - Test Bank, Chapter Two 8

ANS: B

8. In a print statement, you can set the _____ argument to a space or empty string to stop the
output from advancing to a new line.
a. stop
b. end
c. separator
d. newLine
Gaddis: Starting Out with Python, 3e - Test Bank, Chapter Two 9

ANS: B

9. After the execution of the following statement, the variable sold will reference the numeric
literal value as a(n) _____ data type: sold = 256.752
a. int
b. float
c. str
d. currency
Gaddis: Starting Out with Python, 3e - Test Bank, Chapter Two 10

ANS: B

10. After the execution of the following statement, the variable price
will reference the value _____. price = int(68.549)
a. 68
b. 69
c. 68.55
d. 68.54
Gaddis: Starting Out with Python, 3e - Test Bank, Chapter Two 11

ANS: A

11. The output of the following print statement is:


print ‘I\’m ready to begin’
a. Im ready to begin
b. I\’m ready to begin
c. I’m ready to begin
d. ‘I\’m ready to begin’
Gaddis: Starting Out with Python, 3e - Test Bank, Chapter Two 12

ANS: C
12. If value1 is 2.0 and value2 is 12, what is the output of the following command?
print(value1 * value2)
a. 24
b. value1 * value2
c. 24.0
d. 2.0 * 12
Gaddis: Starting Out with Python, 3e - Test Bank, Chapter Two 13

ANS: C

13. The _____ built-in function is used to read a number that has been typed on the keyboard.
a. input()
b. read()
c. get()
d. keyboard()
Gaddis: Starting Out with Python, 3e - Test Bank, Chapter Two 14

ANS: A

14. What is the output of the following print statement?


print(‘The path is D:\\sample\\test.’)
a. ‘The path is D:\\sample\\test.’
b. The path is D:\\sample\\test.
c. The path is D\\sample\\test.
d. The path is D:\sample\test.
Gaddis: Starting Out with Python, 3e - Test Bank, Chapter Two 15

ANS: D

15. What symbol is used to mark the beginning and end of a string?
a. Slash
b. Asterisk
c. Quotation
d. Comma
Gaddis: Starting Out with Python, 3e - Test Bank, Chapter Two 16

ANS: C

TRUE/FALSE
1. True/False: Comments in Python begin with the # character.

ANS: T

2. True/False: When using the camelCase naming convention, the first word of the variable name
is written in lowercase letters and the first character of the second and subsequent words are
written in uppercase letters.

ANS: T

3. True/False: According to the behavior of integer division, when an integer is divided by an


integer, the result will be a float.
ANS: F

4. True/False: Python allows programmers to break a statement into multiple lines.

ANS: T

5. True/False: Python formats all floating-point numbers to two decimal places when outputting
using the print statement.

ANS: F

6. True/False: A flowchart is a tool that programmers use to design programs.

ANS: T

7. True/False: In Python, math expressions are evaluated from left to right, no matter what the
operators are.

ANS: F

8. True/False: Computer programs typically perform three steps: Input is received, some process
is performed on the input, and output is produced.

ANS: T

9. True/False: In Python, print statements written on separate lines do not necessarily output on
separate lines.

ANS: T

10. True/False: The \t escape character causes the output to skip over to the next horizontal tab.
Gaddis: Starting Out with Python, 3e - Test Bank, Chapter Two 17

ANS: T

FILL IN THE BLANK


1. _______________ are notes of explanation that document lines or sections of a program.

ANS: Comments

2. The % symbol is the remainder operator and it is also known as the _______________
operator.

ANS: modulus

3. A(n) _______________ character is a special character that is preceded with a backslash,


appearing inside a string literal.

ANS: escape

4. The _______________ specifier is a special set of characters that specify how a value should
be formatted.

ANS: formatting

5. The result of the expression 12.3 + 6.7 is _______________.

ANS: 19.0

6. When applying the .3f formatting specifier to the following number, 76.15854, the result is
_______________.

ANS: 76.159

7. A(n) _______________ is a single task that the program must perform in order to satisfy the
customer.

ANS: software requirement

8. A(n) _______________ is a name that represents a value stored in the computer’s memory.

ANS: variable

9. Python uses _______________ to categorize values in memory.

ANS: data types

10. When the + operator is used with two strings, it performs string _______________.
Gaddis: Starting Out with Python, 3e - Test Bank, Chapter Two 18

ANS: concatenation

You might also like