3 Introduction To Programming Using Python
3 Introduction To Programming Using Python
Many questions in this edition have been updated in the new edition. Please check with the
publisher on the newest edition.
This quiz is for students to practice. A large number of additional quiz is available for instructors using Quiz Generator from the Instructor's Resource
Website. Videos for Java, Python, and C++ can be found at https://yongdanielliang.github.io/revelvideos.html.
A. 1
B. 3
C. 5
D. 7
E. 4
Check Answer for Question 1
A. 1
B. 3
C. 5
D. 7
E. 4
Check Answer for Question 2
A. 3.5
B. 3
C. 5
D. 4
E. 3.0
Check Answer for Question 3
A. 4
B. 5
C. 6
D. 7
E. 8
Check Answer for Question 4
A. 4
B. 5
C. 6
D. 7
E. 8
Check Answer for Question 5
https://liveexample-ppe.pearsoncmg.com/selftest/selftestpy?chapter=3 1/6
12/14/23, 4:30 PM Introduction to Programming Using Python
3.6 Is pow(a, b) the same as a ** b?
A. Yes
B. No
Check Answer for Question 6
A. 0.0
B. 90.0
C. 45.0
D. 30.0
Check Answer for Question 7
A. 0.0
B. 1.3434343
C. 3.141592653589793
D. 5.565656
Check Answer for Question 8
A. 1.0
B. 1.3434343
C. 3.141592653589793
D. 0.5
Check Answer for Question 9
A. 4
B. "4"
C. '4'
Check Answer for Question 10
A. parentheses
B. brackets
C. single-quotes
D. double-quotes
E. braces
Check Answer for Question 11
A. A
B. B
C. C
D. D
Check Answer for Question 12
3.13 Suppose x is a char variable with a value 'b'. What will be displayed by the statement
print(chr(ord(x) + 1))?
A. a
https://liveexample-ppe.pearsoncmg.com/selftest/selftestpy?chapter=3 2/6
12/14/23, 4:30 PM Introduction to Programming Using Python
B. b
C. c
D. d
Check Answer for Question 13
A. print("smith\exam1\test.txt")
B. print("smith\\exam1\\test.txt")
C. print("smith\"exam1\"test.txt")
D. print("smith"\exam1"\test.txt")
Check Answer for Question 14
3.15 Suppose i is an int type variable. Which of the following statements display the character whose
Unicode is stored in variable i?
A. print(i)
B. print(str(i))
C. print(int(i))
D. print(chr(i))
Check Answer for Question 15
3.16 The Unicode of 'a' is 97. What is the Unicode for 'c'?
A. 96
B. 97
C. 98
D. 99
Check Answer for Question 16
A. Yes
B. No
Check Answer for Question 17
A. 25
B. 26
C. a
D. z
Check Answer for Question 18
A. Good123
B. Good6
C. Good 123
D. Illegal expression
Check Answer for Question 19
A. ABCD
https://liveexample-ppe.pearsoncmg.com/selftest/selftestpy?chapter=3 3/6
12/14/23, 4:30 PM Introduction to Programming Using Python
B. A, B, C, D
C. A B C D
D. A, B, C, D will be displayed on four lines
Check Answer for Question 20
A. s = "Chapter " + 1
B. s = "Chapter " + str(1)
Check Answer for Question 21
A. int
B. float
C. str
Check Answer for Question 22
A. int
B. float
C. str
D. String
Check Answer for Question 24
A. welcome
B. WELCOME
C. Welcome
Check Answer for Question 25
A. \t\tWelcome\n
B. \t\tWelcome\n
C. \t\tWELCOME\n
D. Welcome
Check Answer for Question 26
A. an int
B. a float
C. a str
Check Answer for Question 27
https://liveexample-ppe.pearsoncmg.com/selftest/selftestpy?chapter=3 4/6
12/14/23, 4:30 PM Introduction to Programming Using Python
3.28 To format a number x to 3 digits after the decimal point, use _______.
A. format(x, "5.3f")
B. format("5.3f", x)
C. format(x, "5.4f")
D. format("5.3f", x)
Check Answer for Question 28
3.29 Suppose x is 345.3546, what is format(x, "10.3f")? (note b represents a blank space)
A. bb345.355
B. bbb345.355
C. bbbb345.355
D. bbb345.354
E. bbbb345.354
Check Answer for Question 29
3.30 What will be displayed by the following code? ? (note ? represents a blank space)
A. ???Welcome#?111#924.66
B. Welcome#111#924.66
C. Welcome#111#.66
D. Welcome???#?111#924.66
Check Answer for Question 30
3.31 What will be displayed by the following code? ? (note ? represents a blank space)
A. ???Welcome#?111#924.66
B. ???Welcome#?111#????924.66
C. ???Welcome#111?#????924.66
D. Welcome???#111?#????924.66
Check Answer for Question 31
3.32 Suppse number contains integer value 4, which of the following statement is correct?
A. turtle.setSize(5)
B. turtle.size(5)
C. turtle.pensize(5)
D. turtle.setPenSize(5)
Check Answer for Question 33
https://liveexample-ppe.pearsoncmg.com/selftest/selftestpy?chapter=3 5/6