Python
Interview Exam
Certification Exam
100 Questions & Answers
Ray Yao
Copyright 2015 by Ray Yao
All Rights Reserved
Neither part of this book nor whole of this book may be reproduced or transmitted in any form or by any means electronic, photographic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without prior written permission from the author . All rights reserved !
Ray Yao
About the Author
Certified PHP engineer by Zend, USA
Certified JAVA programmer by Sun, USA
Certified SCWCD developer by Oracle, USA
Certified A+ professional by CompTIA, USA
Certified ASP . NET expert by Microsoft, USA
Certified MCP professional by Microsoft, USA
Certified TECHNOLOGY specialist by Microsoft, USA
Certified NETWORK+ professional by CompTIA, USA
Ray Yaos eBooks & Books on Amazon
Advanced C++ Programming by Ray Yao
Advanced Java Programming by Ray Yao
AngularJs Programming by Ray Yao
C# Programming by Ray Yao
C# Interview & Certification Exam
C++ Programming by Ray Yao
C++ Interview & Certification Exam
Django Programming by Ray Yao
Go Programming by Ray Yao
Html Css Programming by Ray Yao
Html Css Interview & Certification Exam
Java Programming by Ray Yao
Java Interview & Certification Exam
JavaScript Programming by Ray Yao
JavaScript 50 Useful Programs
JavaScript Interview & Certification Exam
JQuery Programming by Ray Yao
JQuery Interview & Certification Exam
Kotlin Programming by Ray Yao
Linux Command Line
Linux Interview & Certification Exam
MySql Programming by Ray Yao
Node.Js Programming by Ray Yao
Php Interview & Certification Exam
Php MySql Programming by Ray Yao
PowerShell Programming by Ray Yao
Python Programming by Ray Yao
Python Interview & Certification Exam
R Programming by Ray Yao
Ruby Programming by Ray Yao
Rust Programming by Ray Yao
Scala Programming by Ray Yao
Shell Scripting Programming by Ray Yao
Visual Basic Programming by Ray Yao
Visual Basic Interview & Certification Exam
Xml Json Programming by Ray Yao
Preface
This book can help you:
Pass the college final exams
Pass the job interview exams
Pass the engineer certification exams
100 Answers for Download
This book includes 100 answers; for your convenience, you can download and print it out to check the questions .
Please download the 100 answers of this book:
https://forms . aweber . com/form/00/638806700 . htm
Table of Contents
Python 100
Questions & Answers
100 Questions
Fill in the blank below, make the program complete . The answers are on the last page .
(1)
age = 15
ticket = "Child Fare" if (age < 16 ) fill in here "Adult Fare"
# conditional expression
print (ticket)
A . ? B . : C . then D . else
(2)
trafficLight = fill in here ("Please input traffic light -- red, green or yellow: ") # user inputs data
if trafficLight == "red":
print ("The traffic light is " + trafficLight)
elif trafficLight == "green":
print ("The traffic light is " + trafficLight)
else:
print ("The traffic light is " + trafficLight)
A . user_input B . input C . user_enter D . enter
(3)
import math
r = input("Please enter a radius: ")
def circleArea():
fill in here math . pi*pow(r, 2) # send back result to caller
print ("The circle area is: ", circleArea())
A . back B . send C . return D . param
(4)
color ={0:"red", 1:"yellow", 2:"green", 3:"white"}
v = color . values()
for c fill in here v: # iterate through elements
print (c)
A . in B . at C . on D . by
(5)
name = input("Please enter your last name: ")
isLetter = name . fill in here # check if all characters are letters
if isLetter:
print ("OK ! Valid Last Name ! ")
else:
print ("No Good ! Invalid Last Name ! ")
A . isCharacter() B . isChar() C . isLetter() D . isalpha()
(6)
f = fill in here ("tryFile . txt", "w") # open a file
f . write("I am learning Python programming ! ")
f . close
f = fill in here ("tryFile . txt", "r") # open a file
print (f . read())
f . close
A . unwrap B . unlock C . untie D . open
(7)
# program001.py
def red():
print ("This flower is red")
def yellow():
print ("This flower is yellow")
def green():
print ("This flower is green")
# program002.py
fill in here program001 # import a module
program001 . red()
program001 . yellow()
program001 . green()
A . get B . import C . obtain D . acquire
(8)
class Flower:
def __init__( fill in here , name, color ): # a keyword represents the current object
self . name = name
self . color = color
f = Flower("rose", "red")
print ("The flower's name is " + f . name)
print ("The flower's color is " + f . color)
A . this B . which C . self D . object
(9)
try:
int("ten")
fill in here ValueError as message: # handle the exception
print ("Exception occurs ! ", message)
A . except B . exception C . catch D . finally
(10)
class Dog: # define a class
fill in here cry(self): # define a cry() method
print ("Dog cries: Wou ! Wou ! ")
class Cat: # define a class
fill in here cry(self): # define a cry() method
print ("Cat cries: Meo ! Meo ! ")
d = Dog()
d . cry()
c = Cat()
c . cry()
A . function B . method C . define D . def
(11)
num1 = fill in here (8 . 67) # convert data type
print (num1) # returns 8
num2 = fill in here (8 . 67) # convert data type
print (num2) # returns 9 . 0
num3 = fill in here (5) # convert data type
print (num3) # returns 5 . 0
A . float round int
B . int float round
C . round int float
D . int round float
(12)
n = 0
fill in here n < 9: # loop statement
print (n)
n = n + 1
A . switch B . while C . for D . do
(13)
import math
print ("ceil(9 . 5) : ", fill in here . ceil(9 . 5)) # math function
print ("floor(9 . 5) : ", fill in here . floor(9 . 5)) # math function
A . math B . mathematics C . function D . method
(14)
Structures | Descriptions |
fill in here | # store multiple changeable values |
fill in here | # store multiple unchangeable values |
fill in here | # store multiple unique values |
fill in here | # store multiple key : value pairs |