Capstone: Retrieving, Processing, and Visualizing Data with Python Quiz Answers

Week 01: Python for Everybody – A Review

Q1. What is the most common Unicode encoding when moving data between systems?

  • UTF-64
  • UTF-128
  • UTF-16
  • UTF-8
  • UTF-32

Q2. What is the decimal (Base-10) numeric value for the upper case letter “G” in the ASCII character set?

  • 2048
  • 7
  • 1771
  • 17
  • 71

Q3. What word does the following sequence of numbers represent in ASCII:

108, 105, 115, 116

  • open
  • lost
  • http
  • list
  • fuss

Q4. How are strings stored internally in Python 3?

  • EBCDIC
  • UTF-16
  • Unicode
  • Latin
  • ASCII

Q5. When reading data across the network (i.e. from a URL) in Python 3, what method must be used to convert it to the internal format used by strings?

  • convert()
  • encode()
  • decode()
  • more()
  • msub()

Q6. Which of the following lines will never print out regardless of the value of “x”?

if x < 2 :
print("Below 2")
elif x < 0 :
print("Negative")
else :
print("Something else")
  • Below 2
  • Something else
  • Negative
  • All the lines will print out

Q7. Which of the following lines will never print out regardless of the value for x?

if x < 2 :
print("Below 2")
elif x < 20 :
print("Below 20")
elif x < 10 :
print("Below 10")
else :
print("Something else")
  • Below 10
  • Below 20
  • Something else
  • Below 2

Q8. What would the following Python code sequence print out?

zap = "hello there bob"
print(zap[4])
  • l
  • e
  • You would get an out-of-range error and the program would fail
  • hello
  • o
  • zap

Q9. Which of the following lines of Python code contains a syntax error?

x = 12
if x < 5:
print("smaller")
else:
print("bigger")
print("all done")

Correct Answer 3

Q10. What will the following Python program print out?

def fred():
print("Zap")
def jane():
print("ABC")
jane()
fred()
jane()
  • Zap Zap Zap
  • Zap ABC jane fred jane
  • ABC Zap jane
  • Zap ABC Zap
  • ABC Zap ABC

Q11. Where in the computer is a variable such as “X” stored?

x = 123
  • Central processing unit
  • Secondary Memory
  • Output Devices
  • Input Devices
  • Main Memory

Q12. What is the primary use of the Python dictionary?

  • To make sure that the definitions of the Python reserved words are available in different languages (French, Spanish, etc)
  • To store key / value pairs
  • To look up all of the methods which are available on a Python object
  • To insure that all Python reserved words are properly spelled

Q13. What does the following Python code print out?

stuff = ['joseph', 'sally', 'walter', 'tim']
print(stuff[2])
  • joseph
  • tim
  • walter
  • sally

Q14. What will the following Python program print out? (This is a bit tricky so look carefully).

def hello():
print("Hello")
print("There")
x = 10
x = x + 1
  • Nothing will print
  • Hello
  • There
  • 11
  • 11
  • x = 11

Q15. What will the following Python program print out?

x = -1
for value in [3, 41, 12, 9, 74, 15] :
if value > x :
x = value
print(x)
  • 15
  • 74
  • 3
  • 9
  • -1

Q16. What will the following Python program print out?

total = 0
for abc in range(5):
total = total + abc
print(total)
  • 5
  • 4
  • 16
  • 10
  • 6

Q17. The following Python code causes a traceback:

a = "123"
b = 456
c = a + b
print(c)

Which line fails with a traceback?

  • 3
  • 1
  • 2
  • 4

Q18. In the following example, an error occurs in “line3” that normally causes a traceback if it were not in a try/except.

line1
try:
    line2
    line3
    line4
except:
    line5
line6

What is the sequence of lines executed in this program?

  • line1, line4, line5, line6
  • line1, line2, line3, line5, line6
  • line1, line2, line3, line6
  • line1, line2, line3, line4, line5, line6
  • line1, line5, line6

Q19. What would the following Python code print out?

abc = "With three words"
stuff = abc.split()
print(stuff)
  • [‘With the’, ‘ee words’]
  • [‘With’, ‘three’, ‘words’]
  • [‘w’, ‘i’, ‘t’, ‘h’]
  • [‘With’, ‘three words’]
  • [‘With three words’]

Q20. What would the following Python code print out?

abc = "With three words"
stuff = abc.split()
print(len(stuff))
  • 14
  • 2
  • 3
  • 16
  • 1

Q21. Which of the following is not a good synonym for “class” in Python?

  • pattern
  • template
  • direction
  • blueprint

Q22. What is “self” typically used in a Python method within a class?

  • The number of parameters to the method
  • To refer to the instance in which the method is being called
  • To terminate a loop
  • To set the residual value in an expression where the method is used

Q23. How is a Python socket different than a Python file handle?

  • The socket does not read all of the data when it is opened
  • You can read and write using the same socket
  • Opening a socket will never fail, while opening a file can fail

Q24. In the following XML, what is “type”?

<person>
<name>Chuck
<phone type="intl">
+1 734 303 4456
</phone>
<email hide="yes" />
</person>
  • An attribute
  • Tag
  • Value
  • XML syntax error
  • Simple element
  • Complex element

Q25. Which programming language serves as the basis for the JSON syntax?

  • JavaScript
  • Python
  • Java
  • SCALA
  • PHP
Get All Course Quiz Answers of Python for Everybody Specialization

Course 01: Programming for Everybody (Getting Started with Python)

Course 02: Python Data Structures

Course 03: Using Python to Access Web Data

Course 04: Using Databases with Python

Course 05: Capstone: Retrieving, Processing, and Visualizing Data with Python

Team Networking Funda
Team Networking Funda

We are Team Networking Funda, a group of passionate authors and networking enthusiasts committed to sharing our expertise and experiences in networking and team building. With backgrounds in Data Science, Information Technology, Health, and Business Marketing, we bring diverse perspectives and insights to help you navigate the challenges and opportunities of professional networking and teamwork.

Leave a Reply

Your email address will not be published. Required fields are marked *