Python 3 MCQ - Multiple Choice Questions N Answers For Tests, Quizzes - Python Students & Teachers - Python3 Programming Jobs QA PDF
Python 3 MCQ - Multiple Choice Questions N Answers For Tests, Quizzes - Python Students & Teachers - Python3 Programming Jobs QA PDF
By S. C. Lewis
Version: 0.096
Multiple Choice Questions for Python 3 - 600 Plus MCQ's for
Python Jobs, Tests & Quizzes
If you are learning Python programming on your own (whether you are learning
from Python books, videos or online tutorials and lesson plans) this book is for
you. These questions and answers can be used to test your knowledge of
Python3. If you already know Python, you can still use it to check how many
questions you can attempt on your own without any help. You may want to go
through these questions before you appear for a job interview. If you are a
teacher or tutor who is teaching Python, you'll find these MCQ useful as a tool to
understand how much your students have learned what you have taught.
All these questions are based on Python 3 and the target level of questions is
Beginner Level - someone who is just starting to learn Python or someone who
has recently learnt Python. Answer Key for these questions is provided at the
end.
FAQ
Ans: All the MCQ for this book are based on Python 3.
Ans: These questions have been tested with Python 3.4.0 on Linux and Windows
operating systems. You might want to download/update the newest Python
version from www.Python.org for your own system before attempting these
questions.
Q 3. I have just started to learn Python. Will I be able to answer these questions?
Ans: The questions for this book are written for beginners level and are intended
for someone who has recently learnt Python. Someone who has just started to
learn Python is likely to find these questions useful too. You might not be able to
answer all the questions in first attempt but would be able to answer all if you
keep coming back to these questions as you start becoming fluent in Python.
Q 4. When I run the statements given in the question, I am not able to get any of
the 4 options as my output?
Ans: It is recommended that you try to run the statements for which some output
is expected by saving them as a program in the IDLE File Editor only (unless
noted otherwise) and if it not works as expected then only try it in IDLE shell
(one statement at a time). Some statements work only in the File Editor while
some work exclusively on the IDLE shell. In some rare cases, it might be
because of the version of Python you are using and your operating system as
because of the version of Python you are using and your operating system as
some questions might give platform specific output.
Q 5. When I run the statements given in the question, the output is not in the
same order or exactly same as the given answer?
Ans: This is because some statements and functions give a random output or an
unsorted order of items. In such cases, you may select the answer which is most
likely to be the possible answer based on your understanding of Python.
Ans: None that I know of. Each of the questions has been thoroughly tested and
then only added to this book. If you are seeing some errors, try to actually solve
these questions in the IDLE File Editor and/or IDLE shell and you will not find
any errors. Some questions which intentionally have errors in-built might be
exceptions to this. This is because these are to check whether you will be able to
recall the types and names of such Python errors and these questions have the
errors in the answer options added to them.
Ans: The best approach to solve these questions is to take a pen(or pencil) &
paper and try attempting these questions one by one.
1. If you do not know the answer to a particular question (may be you have not
learnt the topic yet), you may leave the answer for that question blank, skip that
question for the moment and come back to attempt it after you have learnt that
topic.
2. If you attempted a question but your answer was wrong, go through your
Python notes (or books) again and then re-attempt that question later when you
have thoroughly grasped that concept.
3. If you get all the answers right in your first attempt, Congratulations! you are
doing something right. You can still come back to these questions after a while
for revision and to keep those topics and the related concepts in your memory
for revision and to keep those topics and the related concepts in your memory
refreshed.
Ans: The topics for these MCQ are mentioned later. While I have tried to cover
most of the mentioned topics, it is likely that some are covered indepth while
some topics are only covered slightly. I am trying to add more questions to this
book on an ongoing basis and if some topic has not been covered yet, it is likely
that I will be covering it in the near future.
Q 9. Does the answer key contains the explanations to these questions too?
Ans: The answer key contains only the answers and does not contain the
explanation to the answers. This is because most of the answers are self-
explantory or very simple to understand if you have understood the basic
concepts well. If you still face some difficulty, try thinking for a while and you'll
know why. Or else, you might Google that statement or expression and you are
likely to find your explanation easily but you might not need to go that far. If
you still face any problems, feel free to let me know.
Q 10. My version of the book I bought has less number of questions than the
number of questions present in this book. Why so?
Ans: It is possibly so because you had bought an earlier version of this book. As
I keep on adding more questions and topics to this book, so with every new
version of this book, more questions are getting added to the book. Please check
your version of the book with the version number mentioned at the start of this
book. e.g. version 0.09 of the book contains 612 questions while version 0.03 of
the book contained 267 questions only. If you are a subscriber of Amazon's
Kindle Unlimited, you can borrow the latest version for free to get the updated
book with the maximum number of questions.
Python MCQ Topics
Python basics
IDLE
user inputs
operations
arithmetic
assigning values
comparisons
writing statements
list
lists manipulation
tuple
set
dictionary
branching with if
while loop
for loop
functions
importing modules
built-in functions
built-in modules
working with strings
list comprehensions
file handling
reading and writing files
objects and classes
Python MCQ
a. 3.3
b. 3.5.1
c. 2.4
d. 2.6
a. .python
b. .pe
c. .py
d. .pi
3. What is the name of the GUI that comes in-built as an interactive shell with
Python?
a. PGUI
b. Pyshell
c. IDLE
d. PythonSh
a. print
b. display
c. run
d. output
a. ==
b. ===
c. >>>
d. =
a. x = y: y = 33
b. x = y = z = 33
c. x = z; y = z; x = 33;
d. x & y & z = 33
a. {
b. %
c. *
d. #
a. user
b. enter
b. enter
c. input
d. value
a. Floating Decimal
b. Text String
c. Boolean Value
d. Integer
11. Output displayed by the print function will add this invisible character at the
end of the line by default ...
a. \t
b. \n
c. \s
d. \r
12. Multiple values specified in parentheses to print function will display each
value separated with this by default ...
a. Single Space
b. Double Space
c. A new Line
d. Double Lines
a. sep is !
b. separate = !
c. sep >> '!'
d. sep = '!'
14. Which of the following will provide a * character as alternative line ending
14. Which of the following will provide a * character as alternative line ending
for the print function?
a. end to *
b. end as *
c. end = '*'
d. ending = '*'
15. For which type of error does the interpreter halts and reports the error but
does not execute the program?
a. Semantic error
b. Syntax error
c. Runtime error
d. All type of errors
16. For which type of error does the interpreter runs the program but halts at
error and reports the error as an "Exception"?
a. Semantic error
b. Syntax error
c. Runtime error
d. All type of errors
17. For which type of error does the interpreter runs the program and does not
report an error?
a. Semantic error
b. Syntax error
c. Runtime error
d. All type of errors
x = 6
y = 3
print(x / y)
a. 2.0
b. 2
c. 18
d. 18.0
x = 8
y = 2
print(x // y)
a. 4.0
b. 4
c. 16
d. 16.0
x = 5
y = 4
print(x % y)
a. 0
b. 20
c. 1.0
d. 1
a. 3
b. 2
c. 5
d. 1
x = 5
y = 7
x *= y
print(x)
a. 7
b. 12
c. 5
d. 35
x = 25
y = 15
x -= y
print(x)
a. 10
b. 25
c. 15
d. -15
24. What will be the output after the following statements?
x = 30
y = 7
x %= y
print(x)
a. 4
b. 28
c. 2
d. 37
x = 3
y = 7
print(x == y)
a. y = 7 and x = 3
b. True
c. x = 3 and y = 3
d. False
x = 8
y = 6
print(x != y)
a. y = 6 and x = 8
b. True
c. x = 6 and y = 6
d. False
x = 83
y = 57
print(x > y)
a. True
b. False
c. Yes
d. No
x = 72
y = 64
print(x < y)
a. True
b. False
c. Yes
d. No
x = True
y = False
print(x and y)
a. True
b. False
c. Not defined
d. xy
x = True
y = False
print(x or y)
a. True
b. False
c. Not defined
d. xy
x = True
y = False
print(not x)
a. True
b. False
c. Not defined
d. y
x = True
y = False
print(not y)
a. True
b. False
c. Not defined
d. x
x = 20
y = 40
z = y if (y > x) else x
print(z)
a. True
b. False
c. 20
d. 40
x = 50
y = 10
z = y if (y > x) else x
print(z)
a. True
b. False
c. 50
d. 10
x = 65
y = 53
z = y if (x % 2 == 0) else x
print(z)
a. True
b. False
c. 65
d. 53
x = 46
y = 98
z = y if (y % 2 == 0) else x
print(z)
a. True
b. False
c. 46
d. 98
x = 2 * 4 + 7
print(x)
a. 30
b. 15
c. 22
d. 247
a. 63
b. 16
c. 33
d. 35
x = '24' + '16'
print(x)
a. 40
b. 2416
c. 21
d. 46
x = 15 + 35
print(x)
a. 40
b. 153
c. 50
d. 1535
41. What will be the data type of x after the following statement if input entered
is 18 ?
42. What will be the data type of y after the following statements if input entered
is 50?
a. Float
b. String
c. List
d. Integer
43. What will be the data type of y after the following statements?
x = 71
y = float(x)
a. Float
b. String
c. List
d. Integer
44. What will be the data type of y after the following statements?
x = 48
y = str(x)
a. Float
b. String
c. List
d. Integer
x = y = z = 8
print(y)
a. x
b. 8
c. z
d. y
46. What will be the value of x, y and z after the following statement?
x = y = z = 300
47. What will be the value of x, y and z after the following statement?
x, y, z = 3, 4, 5
x = [7, 8, 9, 10]
a. List
b. Dictionary
c. Tuple
d. String
a. List
b. Dictionary
c. Tuple
d. String
a. x1
b. Today
c. Tomorrow
d. Yesterday
a. x0
b. 25
c. 35
d. 45
a. 20
b. 30
c. 40
d. 50
a. MondayTuesday
b. SundayMonday
c. SunMonday
d. Monday Tuesday
a. 0.0
b. 1.0
c. 5.0
d. 6.0
a. 1.0
b. 4.0
c. 5.0
d. 6.0
x = 3
y = 4
print(x*y)
a. 3
b. 4
c. 3 4
d. 12
a. 30
b. 40
c. 50
d. 10
x = [5, 4, 3, 2]
print(x)
a. [5, 4, 3, 2]
b. 5, 4, 3, 2
c. 5432
d. (5, 4, 3, 2)
x = [5, 4, 3, 2]
x.append(1)
print(x)
a. [5, 4, 3, 2]
b. 5, 4, 3, 2, 1
c. 5432
d. [5, 4, 3, 2, 1]
x = [5, 4, 3, 2]
x.insert(1, 0)
print(x)
a. [5, 1, 3, 2, 0]
b. [5, 0, 4, 3, 2]
c. [0, 5, 4, 3, 2]
d. [1, 5, 4, 3, 2]
x = [5, 4, 3, 2]
x.remove(2)
print(x)
a. [5, 3, 2]
b. [5, 4, 3]
c. [5, 4, 2]
d. [3, 2]
x = [5, 4, 3, 2, 1]
print(x.pop(3))
a. 4
b. 3
c. 2
d. 1
x = [5, 4, 3, 2, 1]
print(x.index(1))
a. 4
b. 3
c. 2
d. 1
x = [5, 4, 3, 2, 1]
x.extend(x)
print(x)
a. [5, 4, 3, 2, 1]
b. []
c. [1, 2, 3, 4, 5]
d. [5, 4, 3, 2, 1, 5, 4, 3, 2, 1]
x = [5, 4, 3, 2, 1]
y = [0, 5, 10]
x.extend(y)
print(x)
a. [5, 4, 3, 2, 1, 0, 5, 10]
b. []
c. [5, 4, 3, 2, 1]
d. [0, 5, 10, 5, 4, 3, 2, 1]
x = [5, 4, 3, 2, 1]
y = [10, 5, 0]
x.extend(y)
print(y)
a. [5, 4, 3, 2, 1, 10, 5, 0]
b. []
c. [10, 5, 0, 5, 4, 3, 2, 1]
d. [10, 5, 0]
x = [5, 4, 3, 2, 1]
y = [10, 5, 0]
y.extend(x)
print(y)
a. [5, 4, 3, 2, 1, 10, 5, 0]
b. [10, 5, 0, 5, 4, 3, 2, 1]
c. [5, 4, 3, 2, 1]
d. [10, 5, 0]
x = [5, 4, 3, 2, 1]
x.reverse()
print(x)
a. [0, 1, 2, 3, 4, 5]
b. [0, 5, 4, 3, 2, 1]
c. [5, 4, 3, 2, 1, 0]
d. [1, 2, 3, 4, 5]
a. 25
b. 3
c. 53
d. 35
a. 25
b. 5
c. 7
d. 35
x = [5, 3, 6, 2, 4, 0, 1]
del x[2:3]
print(x)
a. [5, 3, 6, 4, 0, 1]
b. [5, 3, 2, 4, 0, 1]
c. [5, 6, 2, 4, 0, 1]
d. [5, 4, 0, 1]
x = [5, 3, 6, 2, 4, 0, 7]
del x[0:7]
print(x)
a. []
b. [5, 3, 6, 2, 4, 0, 7]
c. [5, 3, 6, 2, 4, 0]
d. [3, 6, 2, 4, 0]
x = [5, 3, 6, 2, 4, 0, 7]
del x[0:4]
print(x)
a. []
b. [5, 3, 6, 2, 7]
c. [5, 3, 6, 2, 4, 0]
d. [4, 0, 7]
x = [5, 3, 6, 2, 4, 0, 7]
del x[:]
print(x)
a. []
b. [5, 3, 6, 2, 7]
c. [5, 3, 6, 2, 4, 0]
d. [4, 0, 7]
x = [4, 0, 7]
y = str(x[0]) + str(x[1])
print(y)
a. 11
b. 4
c. 40
d. 7
x = [4, 0, 7]
y = float(x[0] + x[2])
print(y)
a. 11
b. 11.0
c. 47.0
d. 47
82. What will be the data type of x after the following statement?
a. List
b. String
c. Dictionary
d. Tuple
83. What will be the data type of x after the following statement?
x = 'Python 3 Test'
a. List
b. String
c. Dictionary
d. Tuple
84. What will be the data type of x after the following statement?
a. List
b. String
c. Dictionary
d. Tuple
85. What will be the data type of x after the following statement?
a. List
b. Set
c. Dictionary
d. Tuple
86. What will be the data type of x after the following statement?
a. List
b. Set
c. Dictionary
d. Tuple
87. What will be the data type of x after the following statement?
a. List
b. String
c. Dictionary
d. Boolean
88. What will be the data type of x after the following statement?
x = False
a. List
b. String
c. Dictionary
d. Boolean
89. Which of the following function can be used to find the data type of a
variable?
a. data()
b. type()
c. true()
d. str()
a. x[0]
b. [24]
c. True
d. False
a. x[1]
b. ['B']
c. True
d. False
x = 'Python'
y = 'y' in x
print(y)
a. [1]
b. y
c. True
d. False
a. x[0]
b. [24]
c. True
d. False
a. x[0]
b. [24]
c. True
d. False
95. What will be the data type of x after the following statements?
a. List
b. String
c. Dictionary
d. Boolean
a. List
b. Dictionary
b. Dictionary
c. Tuple
d. Set
a. List
b. Dictionary
c. Tuple
d. Set
a. dict_keys([0, 1, 2, 3])
b. dict_keys{0, 1, 2, 3}
c. dict_keys(0, 1, 2, 3)
d. dict_keys[0, 1, 2, 3]
a. Jan
b. Feb
c. March
d. April
a. [4, 8]
b. [4, 8, 16]
c. 16
d. 8
x = 7
if x > 5:
print(20)
a. 20
b. 5
c. x
d. 7
x = 8
if x > 8:
print(20)
else:
print(10)
a. 20
b. x
c. 10
d. 8
a. 20
b. 40
c. 10
d. 30
x = 15
if x > 15:
print(0)
elif x == 15:
print(1)
else:
print(2)
a. 0
b. 1
c. 2
d. 15
x = 5
if x > 15:
print('yes')
elif x == 15:
print('equal')
else:
print('no')
a. 15
b. yes
c. equal
d. no
x = 50
if x > 10 and x < 15:
print('true')
elif x > 15 and x < 25:
print('not true')
elif x > 25 and x < 35:
print('false')
else:
print('not false')
a. true
b. false
c. not true
d. not false
x = 25
if x > 10 and x < 15:
print('true')
elif x > 15 and x < 25:
print('not true')
elif x > 25 and x < 35:
print('false')
else:
print('not false')
a. true
b. false
c. not true
d. not false
x = 15
if x > 10 and x <= 15:
print('true')
elif x > 15 and x < 25:
print('not true')
elif x > 25 and x < 35:
print('false')
else:
print('not false')
a. true
b. false
c. not true
d. not false
x = 25
if x > 10 and x <= 15:
print('true')
elif x >= 15 and x < 25:
print('not true')
elif x >= 25 and x < 35:
print('false')
else:
print('not false')
a. true
b. false
c. not true
d. not false
x = 25
if x >= 10 and x <= 15:
print('true')
elif x >= 15 and x <= 25:
print('not true')
elif x >= 25 and x <= 35:
print('false')
else:
print('not false')
a. true
b. false
c. not true
d. not false
x = 20
if x <= 10 or x >= 75:
print('true')
elif x <= 15 or x >= 55:
print('not true')
elif x <= 25 or x >= 35:
print('false')
else:
print('not false')
a. true
b. false
c. not true
d. not false
x = 30
if x <= 10 or x >= 75:
print('true')
elif x <= 15 or x >= 55:
print('not true')
elif x <= 25 or x >= 35:
print('false')
else:
print('not false')
a. true
b. false
c. not true
d. not false
x = 80
if x <= 10 or x >= 75:
print('true')
elif x <= 15 or x >= 55:
print('not true')
elif x <= 25 or x >= 35:
print('false')
else:
print('not false')
a. true
b. false
c. not true
d. not false
117. What will be the output after the following statements?
x = 60
if x <= 10 or x >= 75:
print('true')
elif x <= 15 or x >= 55:
print('not true')
elif x <= 25 or x >= 35:
print('false')
else:
print('not false')
a. true
b. false
c. not true
d. not false
x = 68
if x <= 50 and x >= 25:
print('true')
elif x <= 60 or x >= 55:
print('not true')
elif x <= 70 and x >= 35:
print('false')
else:
print('not false')
a. true
b. false
c. not true
d. not false
a. true
b. false
c. not true
d. not false
x = 70
if x <= 30 or x >= 100:
print('true')
elif x <= 50 and x == 50:
print('not true')
elif x >= 150 or x <= 75:
print('false')
else:
print('not false')
a. true
b. false
c. not true
d. not false
x = 40
y = 25
if x + y >= 100:
print('true')
elif x + y == 50:
print('not true')
elif x + y <= 90:
print('false')
else:
print('not false')
a. true
b. false
c. not true
d. not false
x = 1
while x < 10:
print(x, end='')
x = x + 1
a. 123456789
b. 1
c. 10
d. 2
x = 0
while x < 10:
print(x, end='')
x += 4
a. 0123456789
b. 123456789
c. 4123456789
d. 048
x = 0
y = 4
while x + y < 10:
print(x, end='')
x += 1
a. 012345
b. 0123456789
c. 4123456789
d. 048
x = 0
y = 4
while x + y < 10:
x += 1
print(x, end='')
a. 012345
b. 0123456
c. 123456
d. 0123456
x = 1
y = 4
while x * y < 10:
print(y, end='')
y += 1
a. 012345
b. 456789
c. 123456789
d. 0123456789
x = 1
y = 4
while x * y < 10:
print(y, end='')
x += 1
y += 1
a. 4
b. 48
c. 148
d. 0123456789
x = 1
y = 4
while x * y <= 10:
print(x, end='')
x += 1
y += 1
a. 4
b. 48
c. 14
d. 12
129. What will be the output after the following statements?
x, y = 2, 5
while y - x < 5:
print(x*y, end=' ')
x += 3
y += 4
a. 1045
b. 10 45
c. 34
d. 3 4 10 45
x, y = 0, 1
while y < 10:
print(y, end=' ')
x, y = y, x + y
a. 1 1 2 3 5 8
b. 112358
c. 0123456789
d. 0 2 4 6 8
x = 1
while x < 4:
x += 1
y = 1
while y < 3:
print(y, end=' ')
y += 1
a. 1 1 2 2
b. 1 1 2 2 3 3 4 4
c. 1 2 3 4
d. 1 2 1 2 1 2
x = y = 1
while x < 4:
x += 1
while y < 3:
print(y, end=' ')
y += 1
a. 1 1 2 2
b. 1 2
c. 1 2 3 4
d. 1 2 1 2 1 2
x = 1
while x < 5:
print(x, end='')
a. Closed loop
b. One time loop
c. Infinite loop
d. Evergreen loop
a. h
b. hello
c. h e l l o
d. i x
for i in range(5):
print(i, end='')
a. 5
b. 1 5
c. 012345
d. 01234
for i in range(1,5):
print(i, end='')
a. 15
b. 12345
c. 1234
d. 012345
a. 1 6 11 16 21
b. 1 5 10 15 20 25
c. 1 5 25
d. 16111621
a. P
b. python
c. Pytho
d. Python
a. abcd
b. a b c d
c. False
d. True
a. x z y
b. xzy
c. False
d. True
a. x y z
b. 1 2 3
c. x:3 y:2 z:1
d. True
a. ('P')('y')('t')('h')('o')('n')
b. python
c. python
d. (0, 'P')(1, 'y')(2, 't')(3, 'h')(4, 'o')(5, 'n')
a. x y z
b. 1 2 3
c. x:1 y:2 z:3
d. True
a. x y z
b. x 1 y 2 z 3
c. x:1 y:2 z:3
d. x, 1, y, 2, z, 3
a. ('P')('y')('t')('h')('o')('n')
b. python 0 1 2 3 4 5
c. ('p', '0')('y', '1')('t', '2')('h', '3')('o', '4')('n', '5')
d. (0, 'P')(1, 'y')(2, 't')(3, 'h')(4, 'o')(5, 'n')
146. What will be the output after the following statements?
for i in range(1,5):
print(i, end='')
if i == 3:
break
a. 123
b. 1234
c. 12
d. 12345
for i in range(0,5):
if i == 2:
break
print(i, end='')
a. 12
b. 01
c. 012
d. 0123
for i in range(1,5):
if i == 3:
continue
print(i, end=' ')
a. 1 2 4
b. 1 2 3 4
c. 1 2
d. 1 2 3
for i in range(0,5):
print(i, end='')
if i == 2:
continue
a. 0124
b. 01234
c. 12
d. 1345
myvar = 5
def printvar() :
print(myvar)
printvar()
a. 01245
b. 12345
c. 5
d. 1234
myvar = 5
def printvar() :
print(myvar)
printvar()
a. A list
b. A string
c. An integer
d. A function
myvar = 5
def printvar() :
print(myvar, end ='')
printvar()
printvar()
a. 55
b. 5 5
c. 5
d. 10
def call(var) :
print(var, end ='')
call(45)
a. 55
b. 4 5
c. 45
d. var
a. 10
b. 50
c. 40
d. 10 + 40
a. 1000
b. 10
c. 30
d. 10 10 10
a. 100
b. 1000
c. 2052
d. 200
a. 597
b. 315
c. 2052
d. 200
a. 57
b. 315
c. 70
d. 200
a. 17
b. 98
c. 70
d. 11
a. 17
b. 98
c. 26
d. 11
def call(x, y) :
return x * y
print(call(5, 3))
a. 18
b. 5, 3
c. 15
d. 8
def call(y, x) :
return x / y
z = call(4, 9)
print(z)
a. 0.444445
b. 2
c. 0
d. 2.25
163. What will be the output after the following statements?
def call(x,y) :
if y == 0:
return
return y - x
print(call(8,2))
a. 6
b. -6
c. 2
d. 6.0
def call(x,y) :
if x == 0:
return
return y + x
print(call(0,5))
a. 5
b. 5.0
c. 0
d. None
y = lambda x: x*4
print(y(6))
a. 24
b. 24.0
c. 6: 24
d. 36
x = 27
if x < 25:
print(x)
else:
pass
a. None
b. 25
c. 27
d. No output
a. List
b. Module
c. Dictionary
d. Tuple
def gen():
x = 0
while True:
yield x
x += 1
y = gen()
print(next(y), end='')
print(next(y), end='')
print(next(y), end='')
a. 012
b. 123
c. 111
d. 000
def gen():
x = 2
while True:
yield x
x += 1
y = gen()
for i in y:
if i >= 5:
break
else:
print(i, end='')
a. 0123
b. 123
c. 12345
d. 234
170. What do you type to enter the interactive help mode of Python?
a. HELP
b. save
c. help()
d. help
import random
a. Imports the random module
b. Imports a random module from a list of modules
c. Imports the random function
d. imports the directory named random
import random as rd
print(rd.randint(4,7))
import random as rd
print(rd.random())
176. Which of the following can be a possible output after the following
statements?
import sys
print(sys.version)
import sys
print(sys.executable)
import keyword
print(keyword.kwlist)
import math
print(math.floor(67.3))
a. 67
b. 68
c. 67.0
d. 68.0
181. What will be the output after the following statements?
import math
print(math.ceil(21.4))
a. 21
b. 22
c. 21.0
d. 22.0
import math
print(math.sqrt(4))
a. 2.1
b. 2
c. 2.0
d. 4.0
import math
print(math.pow(3,2))
a. 6
b. 9
c. 6.0
d. 9.0
184. What does the following statements do?
import datetime
print(datetime.datetime.today())
a. Displays the current time in seconds since the Epoch as a floating point
number
b. Displays the current time in minutes since the Epoch as a floating point
number
c. Displays the current time in seconds since the Epoch as an integer
d. Displays the current time in minutes since the Epoch as an integer
x = 'Python'
y = 'MCQ'
print(x + y)
a. Python Python
b. MCQ MCQ
c. Python MCQ
d. PythonMCQ
x = 'Python '
print(x[4])
a. h
b. t
c. Python Python Python Python
d. o
x = 'Python'
print(x[2:4])
a. Pyth
b. th
c. tho
d. thon
x = 'Python'
print(x[:])
a. yth
b. Pn
c. Python
d. PythonPythonPython
x = 'Python'
print('y' in x)
a. y
b. Y
c. Python
d. True
x = 'Python'
print('p' not in x)
a. p
b. P
c. True
d. False
a. Python MCQ
b. MCQ Test
c. Test MCQ Python
d. Python MCQ Test
a. Python 3
b. 3 Version
c. Python 3 Version
d. Python Version 3
a. Python 3 or Python 2
b. Python 2 or Python 3
c. Python 2 or Python 2
d. Python 23
x = 'Python'
print(x.capitalize())
a. Python
b. Python.capitalize
c. PYTHON
d. pYTHON
225. What will be the output after the following statements?
x = 'python jobs'
print(x.upper())
a. PYTHON JOBS
b. Python jobs
c. Python Jobs
d. python jobs
x = 'python jobs'
print(x.lower())
a. PYTHON JOBS
b. Python jobs
c. Python Jobs
d. python jobs
228. What will be the output after the following statements?
x = 'Python Jobs'
print(x.swapcase())
a. PYTHON JOBS
b. pYTHON jOBS
c. Python Jobs
d. python jobs
x = 'Python'
print(x.join('33'))
a. Python33
b. 3Python3
c. Python3
d. Python 33
x = 'Python Test'
print(x.join('33'))
a. 3Python Test3
b. 3Python3Test
c. Python3Test3
d. Python Test33
a. Python 3
b. 3Python3
c. Python3
d. Python+3
x = 'Python '
y = '3 '
print(x.rstrip()+y.rstrip())
a. Python 3
b. 3Python3
c. Python3
d. Python+3
a. Python 3 Questions
b. Python3Questions
c. Python3 Questions
d. Python 3Questions
234. What will be the output after the following statements?
x = 'Interview'
print(x.replace('e',' '))
a. Interview
b. Intrviw
c. I n t e r v i e w
d. Int rvi w
x = 'MCQs'
print(x.ljust(10,'*'))
a. MCQs******
b. M C Q S
c. ******MCQs
d. M C Q s
x = 'MCQs'
print(x.rjust(10,'*'))
a. MCQs******
b. M C Q S
c. ******MCQs
d. M C Q s
a. MCQs******
b. ***MCQs***
c. ******MCQs
d. M C Q s
x = 'Python Pi Py Pip'
print(x.count('p'))
a. 1
b. 0
c. 4
d. 5
x = 'Python Pi Py'
print(x.find('p'))
a. -1
b. 0
c. 1
d. 3
x = 'Python Pi Py'
print(x.find('P'))
a. -1
b. 0
c. 1
d. 3
x = 'Pi Py Python'
print(x.startswith('p'))
a. 1
b. 0
c. True
d. False
x = 'Pi Py Python'
print(x.endswith('n'))
a. 1
b. 0
c. True
d. False
x = 'Python'
print(x.isalpha())
a. 1
b. 0
c. True
d. False
x = 'Python 3'
print(x.isnumeric())
a. 1
b. 0
c. True
d. False
x = 'Python 3 MCQ'
print(x.isalnum())
a. 1
b. 0
c. True
d. False
x = 'Python 3 MCQ'
print(x.islower())
a. True
b. False
c. 1
d. 0
x = 'Python 3 MCQ'
print(x.istitle())
a. True
b. False
c. 1
d. 0
x = 'MCQ'
print(x.isupper())
a. True
b. False
c. 1
d. 0
x = '\n'
print(x.isspace())
a. True
b. False
c. 1
d. 0
x = '2000'
print(x.isdigit())
a. True
b. False
c. 1
d. 0
x = '2.7'
print(x.isdecimal())
a. True
b. False
c. 1
d. 0
x = open('python.csv', 'r')
x = open('python.csv', 'w')
x = open('python.csv', 'a')
x = open('python.txt', 'r+')
x = open('python.txt', 'w+')
a. Opens a text file named python.txt to read
b. Opens a text file named python.txt to write to or read from
c. Opens a text file named python.txt to write
d. Opens a new file named python.txt to append
x = open('python.txt', 'a+')
x = open('python.bat', 'rb')
x = open('python.bat', 'wb')
x = open('python.bat', 'ab')
x = open('python.txt', 'r')
print(x.name)
a. python
b. python.txt opened
c. python.txt or FileNotFoundError
d. python r
x = open('python.csv', 'w')
print(x.mode)
a. python write
b. python.txt
c. r
d. w
x = open('python.csv', 'w')
print(x.closed)
a. open
b. closed
c. True
d. False
x = open('python.csv', 'w')
x.close()
print(x.closed)
a. open
b. closed
c. True
d. False
x = open('python.csv', 'w')
print(x.readable())
a. readable
b. writable
c. True
d. False
266. What will be the output after the following statements?
x = open('python.csv', 'w')
print(x.writable())
a. readable
b. writable
c. True
d. False
x = open('python.csv', 'a')
print(x.writable())
a. readable
b. writable
c. True
d. False
268. In IDLE shell, the output will be the same for all the following statements
except one. Which one?
a. 4+4
b. 4 + 4
c. 4*2
d. 4**2
269. In IDLE shell, what is the keyboard shortcut for the previous command in
history on Windows/Linux?
a. Page Down
a. Page Down
b. Page Up
c. Alt + P
d. Ctrl + P
270. In IDLE shell, what is the keyboard shortcut for the next command in
history on Windows/Linux?
a. Page Down
b. Page Up
c. Ctrl + N
d. Alt + N
271. In IDLE shell, what is the keyboard shortcut for the previous command in
history on Mac OS X?
a. Page Down
b. Page Up
c. Alt + P
d. Ctrl + P
272. In IDLE shell, what is the keyboard shortcut for the next command in
history on Mac OS X?
a. Page Down
b. Page Up
c. Ctrl + N
d. Alt + N
273. In IDLE file editor, what is the keyboard shortcut for executing the program
in shell?
a. F5
b. F1
c. Shift
d. Alt
274. What type of error is shown when you use a variable without assigning an
initial value?
a. Not declared
b. Not defined
c. Not assigned
d. Not a variable
a. High level
b. Low level
c. Top level
d. Bottom level
a. Bill Gates
b. Guido Van Rossum
c. Jeff Bezos
d. Larry Page
a. Dynamic typing
b. Static typing
c. Slow typing
d. Auto typing
d. Auto typing
a. Single quotes
b. Double quotes
c. Either single quotes or double quotes
d. ! symbol
280. Which of the following is used to add an invisible tab character to the
output?
a. \t
b. \tab
c. \a
d. \b
print('2\\t4')
a. 2 t 4
b. 2\t4
c. 2 4
d. 2 tab 4
a = True
b = False
c = 5 if (a == 1) else b
print(c)
a. True
b. False
c. b
d. 5
a = True
b = False
c = 'a' if (b == 0) else 'b'
print(c)
a. True
b. False
c. a
d. b
a = False
b = False
print(a and b)
a. True
b. False
c. ab
d. ba
285. In the order of precedence, which of the operation will be completed first in
the following statement?
3 * 6 + 5 - 4 / 2
a. Multiplication
b. Division
c. Addition
d. Subtraction
286. In the order of precedence, which of the operation will be completed last in
the following statement?
3 * 6 + 5 - 4 / 2
a. Multiplication
b. Division
c. Addition
d. Subtraction
10 * 4 - 1 + 8 / 5
288. What will be the data type of x after the following statement if input entered
is 64?
a = 27 / 3 % 2 * 4**2
print(a)
a. 0
b. 16.0
c. 32
d. 4.0
a = 3 / 3 47 - 3*3
print(a)
a. 20.0
b. 1.0
c. 36.0
d. 0.0
a = [1,3,5,7,9,11,13,15,17,19]
print(a[1:5],a[3:17])
a. [3, 5, 7, 9]
b. [1, 3, 5] [3, 5, 7, 9, 11, 13, 15, 17]
c. [3, 5, 7, 9] [7, 9, 11, 13, 15, 17, 19]
d. [3, 5, 7, 9, 11, 13, 15, 17, 19]
a = [1,3,5]
print(a * 2)
a. [1, 3, 5, 1, 3, 5]
b. [1, 2, 3, 5]
c. [3, 5]
d. [11, 33, 55]
a. abc
b. abc123
c. 123abc
d. abc_123
a. a$1
b. a1
c. 1a
d. abc 123
a = 15
b = a
a = 25
print(a,b)
a. 25 15
b. 15 25
c. a 15
d. 25 a
x = 16 / 4 * 5
y = 16 / 4 * 5.0
z = 16 / 4.0 * 5
print(x, y, z)
a. 25 15 20
b. 20.0 20.0 20.0
c. 20.0 20 20.0
d. 20 20.0 20
297. What will be the data type of x after the following statement?
x = 1/2
a. Integer
b. List
c. String
d. Float
def x(y,z):
pass
x(1,4)
a. 1,4
b. y,z
c. No output
d. None
b = 1
for a in range(1, 10, 3):
b += a + 1
print(b)
a. 14
b. 16
c. 20
d. 25
b = 1
for a in range(1, 10):
b += a - 1
print(b)
a. 37
b. 47
c. 44
d. 38
b = 3
for a in range(10, 1):
b -= a + 1
print(b)
a. 7
b. 4
c. 3
d. 8
b = 1
for a in range(1, 5):
b *= a + 1
print(b)
a. 120
b. 40
c. 36
d. 250
a = True
print(a and not a)
a. a
b. False
c. not a
d. True
a. a == b
b. False
c. not b
d. True
a = 'Hello'
b = 'hello'
print(a is b)
a. a is b
b. False
c. not b
d. True
a = 'Python'
b = 'Python'
print(a is b)
a. a is b
b. False
c. not b
d. True
a. a is b
b. False
c. not b
d. True
a = [4, 7, 9]
b = [7, 4, 9]
print(a is not b)
a. a is b
b. False
c. not b
d. True
a = [3, 6, 9]
b = [3, 6, 9]
print(a is b, a == b)
a. True True
b. False False
c. False True
d. True False
310. What will be the output after the following statements?
a = 0
b = 5
c = 10
a = b
b = c
c = a
print(a, b, c)
a. 0 5 10
b. 5 10 10
c. 5 10 5
d. 5 5 10
b = 15
c = 20
a = b
b = c
c = a
print(b, c)
a. 20 15
b. 15 20
c. a 20
d. 15 a
312. In IDLE shell, the output will be the same for all the following statements
except one. Which one?
a. 4*3
b. 60//5
c. 17-5
d. 12/1
313. In IDLE shell, the output will be an error for one of the following
statements. Which one?
a. P = 'python' * int('1')
b. P = 'python' + 1
c. P = 'python' + str(1)
d. P = 'python' * 1
a = 4**3
b = pow(4,3)
print(a, b)
a. 4 4
b. 4 3
c. 12 12
d. 64 64
a = round(5.3)
b = round(5.6)
c = round(5.5)
print(a, b, c)
a. 5 5 5
b. 6 5 6
c. 5 6 6
d. 5 6 5
318. How many times will "Python 3" be printed after the following statements?
a. 3
b. 4
c. 5
d. 6
a. 4
b. 5
c. 4.0
d. 4.5
320. What will be the output for a function that does not return any value?
a. None
b. No value
c. Zero
d. Bool
321. What type of error will be shown after the following statement?
a = b
a. SyntaxError
b. TypeError
c. ValueError
d. NameError
322. What type of error will be shown after the following statement?
a = int('hello')
a. SyntaxError
b. TypeError
c. ValueError
d. NameError
323. What type of error will be shown after the following statement?
a = {7)
a. SyntaxError
b. TypeError
c. ValueError
d. NameError
324. What type of error will be shown after the following statement?
a = 'Python' + 3
a. SyntaxError
b. TypeError
c. ValueError
d. NameError
a. List
b. Dictionary
c. Tuple
d. Set
a. List
b. Dictionary
c. Tuple
d. Set
a = (1, 4, 3, 6)
a. List
b. Dictionary
c. Tuple
d. Set
a = [1, 4, 3, 6]
a. List
b. Dictionary
c. Tuple
d. Set
329. What is the data type used to store values in key values pair?
a. List
b. Dictionary
c. Tuple
d. Set
330. In IDLE shell, which of the following statements gives SyntaxError?
a. "Python\tis\tEasy\n"
b. "Hello, it's very easy to learn Python"
c. "Python", "easy"
d. "Python is easy'
a = 45
b = 55
c = (a + b) / 2
print(c)
a. 45
b. 50.0
c. 45.0
d. 55.0
a. Parentheses
b. Exponential
c. Division
d. Subtraction
a = 4*3**2
print(a)
a. 32
b. 144
c. 36
d. 24
334. What is the name of Python's built-in module for regular expressions?
a. regex
b. regexes
c. REG
d. re
335. What is the name of Python's built-in module for delimited files?
a. csv
b. tsc
c. delimited
d. pipe
336. What is the name of Python's built-in module for basic date and time types?
a. date
b. time
c. datetime
d. dates
337. What is the name of Python's built-in module for email related tasks?
a. mailserver
b. email
c. message
d. mail
338. What is the name of Python's built-in module for reading passwords?
a. getpass
a. getpass
b. password
c. login
d. readpass
339. What is the name of Python's built-in module for IPv4/IPv6 manipulation?
a. getip
b. ipman
c. ip
d. ipaddress
340. What is the name of Python's built-in module for encoding/decoding JSON
format?
a. json
b. jcode
c. jsonencode
d. jsoncode
341. What is the name of Python's built-in module for Python keywords?
a. string
b. keyword
c. stringtest
d. keytest
342. What is the name of Python's built-in module for mathematical functions?
a. maths
b. mathematics
c. math
d. mathfunc
343. What is the name of Python's built-in module for operating system
interfaces?
interfaces?
a. windows
b. liunx
c. operatingsystem
d. os
344. What is the name of Python's built-in module for data pretty printer?
a. pprint
b. print
c. prettyprint
d. printp
345. What is the name of Python's built-in module for generating pseudo-random
numbers?
a. psrandom
b. random
c. psuedo
d. randomnum
346. What is the name of Python's built-in module for general purpose event
scheduler?
a. scheduler
b. eventsched
c. sched
d. schedule
347. What is the name of Python's built-in module for high level file operations?
a. shutil
b. fileutil
c. futility
d. fileop
348. What is the name of Python's built-in module for low level networking
interface?
a. net
b. socket
c. webking
d. webworking
349. What is the name of Python's built-in module for SQLite databases?
a. SQL
b. sqldb
c. dbase
d. sqlite3
350. What is the name of Python's built-in module for TLS/SSL wrapper for
socket objects?
a. ssl
b. swrap
c. tlsssl
d. sslobj
351. What is the name of Python's built-in module for mathematical statistics
functions?
a. mathstats
b. statistics
c. statmath
d. statfunc
352. What is the name of Python's built-in module for subprocess management?
a. sub
b. mansub
b. mansub
c. submng
d. subprocess
353. What is the name of Python's built-in module for Python's configuration
information?
a. config
b. pysys
c. sysconfig
d. pycon
354. What is the name of Python's built-in module for telnet client class?
a. telnetlib
b. tellib
c. tnet
d. telnet
355. What is the name of Python's built-in module for generating temporary files
and directories?
a. temp
b. tempdir
c. temporary
d. tempfile
356. What is the name of Python's built-in module for thread based parallelism?
a. thread
b. threadall
c. threading
d. thrpar
357. What is the name of Python's built-in module for time access and
357. What is the name of Python's built-in module for time access and
conversions?
a. timely
b. time
c. primetime
d. mytime
358. What is the name of Python's built-in module for working with calendars?
a. calendars
b. calendar
c. yearcal
d. calc
359. What is the name of Python's built-in module for measuring execution time
of code snippets?
a. timeit
b. selftime
c. codetime
d. timer
360. What is the name of Python's built-in module for interface to Tcl/Tk for
graphical user interfaces?
a. tkgui
b. guitk
c. intertk
d. tkinter
361. What is the name of Python's built-in module for simple educational
graphical applications?
a. torque
b. tedu
c. turtle
c. turtle
d. moveturtle
362. What is the name of Python's built-in module for url handling?
a. urls
b. urllib
c. URL
d. httpurl
363. What is the name of Python's built-in module for interface to WAV sound
format?
a. wav
b. WAVE
c. WAV
d. wave
364. What is the name of Python's built-in module for web browser controlller?
a. browser
b. browse
c. webrowser
d. webbrowser
365. What is the name of Python's built-in module for xml processing?
a. xml
b. XML
c. allxml
d. onlyxml
366. What is the name of Python's built-in module for reading and writing ZIP
archive files?
a. readzip
a. readzip
b. zipfile
c. writezip
d. rwzip
367. What is the name of Python's built-in module for running Python scripts via
CGI?
a. pcgi
b. pycgi
c. cgi
d. cgipy
368. What is the name of Python's built-in module for mathematical functions
for complex numbers?
a. complexmath
b. cmath
c. mathc
d. mathplex
369. What is the name of Python's built-in module for conversions between color
systems?
a. color
b. colors
c. colours
d. colorsys
370. What is the name of Python's built-in module for shallow and deep copy
operations?
a. copyd
b. copyme
c. copy
d. copys
d. copys
371. What is the name of Python's built-in module for comparing files?
a. filecmp
b. cmpfile
c. compare
d. filecompare
372. What is the name of Python's built-in module for FTP protocol client?
a. ftp
b. ftplib
c. FTP
d. pftp
373. What is the name of Python's built-in module for unix style pathname
pattern expansion?
a. upattern
b. pathpat
c. upath
d. glob
374. What is the name of Python's built-in module for html manipulation?
a. hyper
b. xml
c. html
d. uml
x = [5, 4, 3, 2, 1]
x.clear()
print(x)
a. [0, 1, 2, 3, 4, 5]
b. [0]
c. []
d. [1, 2, 3, 4, 5]
x = [5, 4, 3, 2, 1]
y = x.copy()
print(y)
a. [0, 1, 2, 3, 4, 5]
b. [5, 4, 3, 2, 1]
c. []
d. [1, 2, 3, 4, 5]
x = []
for i in range(10):
x.append(i**2)
print(x)
a. [0, 1, 2, 3, 4, 5]
b. [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
c. [0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
d. [1, 4, 9, 16, 25, 36, 49, 64, 81]
a. [0, 1, 2, 3, 4, 5]
b. [1, 4, 9, 16, 25]
c. [0, 1, 4, 9, 16, 25]
d. [0, 1, 4, 9, 16]
a. [0, 1, 2, 3, 4, 5]
b. [1, 4, 9]
c. [0, 1, 4, 9]
d. [0, 1, 4, 9, 16]
a. [0, 1, 2, 3, 4, 5]
b. [(1, 3), (1, 4), (1, 5), (2, 3), (2, 4), (2, 5)]
c. [(0, 1, 2), (3, 4, 5)]
d. [(0, 3), (0, 4), (0, 5), (1, 3), (1, 4), (1, 5), (2, 3), (2, 4), (2, 5)]
a. [(0, 2)]
b. [(0, 0), (2, 2)]
c. [(0, 2), (2, 4, 0)]
d. [(0, 2), (0, 4), (0, 0), (2, 2), (2, 4), (2, 0)]
a. [(0, 2)]
b. [(0, 0), (2, 2)]
c. [(0, 2), (0, 4), (2, 4), (2, 0)]
d. [(0, 2), (0, 4), (0, 0), (2, 2), (2, 4), (2, 0)]
a = []
for x in [0, 1, 2]:
for y in [3, 4, 5]:
if x!=y:
a.append((x,y))
print(a)
a. [0, 1, 2, 3, 4, 5]
b. [(1, 3), (1, 4), (1, 5), (2, 3), (2, 4), (2, 5)]
c. [(0, 1, 2), (3, 4, 5)]
d. [(0, 3), (0, 4), (0, 5), (1, 3), (1, 4), (1, 5), (2, 3), (2, 4), (2, 5)]
a = [-2, -1, 0, 1, 2]
print([i**3 for i in a])
a. [(0, 2)]
b. [-2, -1, 0, 1, 2]
c. [8, 1, 0, 1, 8]
d. [-8, -1, 0, 1, 8]
a = [-3, -1, 0, 1, 3]
print([i**4 for i in a])
a. [81, 1, 0, 1, 81]
b. [-81, -1, 0, 1, 81]
c. [16, 1, 0, 1, 16]
d. [-16, -1, 0, 1, 16]
a = [-3, -1, 0, 1, 3]
print([x for x in a if x>=0])
a. [-3, -1, 0, 1, 3]
b. [0, 1, 3]
c. [1, 3]
d. [-1, 0, 1]
a = [-3, -1, 0, 1, 3]
print([abs(x) for x in a])
a. [-3, -1, 0, 1, 3]
b. [0, 1, 3]
c. [3, 1, 0, 1, 3]
d. [-1, 0, 1]
a. [0, 1, 2, 4, 5, 6, 7, 8, 9]
b. [0, 1, 2, 7, 8, 9, 4, 5, 6]
c. [(0, 1, 2), (7, 8, 9), (4, 5, 6)]
d. [(0, 7, 4), (1, 8, 5), (2, 9, 6)]
a = []
b = [[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11]]
for i in range(4):
a.append([row[i] for row in b])
print(a)
a = [0, 1, 2, 3]
del a
print(a)
a. None
b. Null
c. [0, 1, 2, 3]
d. NameError
a = [0, 1, 2, 3]
del a[:]
print(a)
a. None
b. []
c. [0, 1, 2, 3]
d. NameError
a. [0, 1, 2, 3, 4, 5]
b. [0, 1, 2, 3, 4]
c. [-4, -2, 0, 2, 4]
d. [0, 1, 4, 9, 16]
a. [0, 2, 36]
b. [0, 1, 2, 3, 4]
c. [0, 6, 2]
d. [0, 2, 14]
a. [0, 2, 36]
b. [0, 2, 21]
c. [0, 6, 2]
d. [0, 2, 14]
a. print("Hello World!")
b. print "Hello World!"
c. print("Hello World!")!
d. print("Hello World!"):
x = 90
y = 'I ran for %s minutes'
print(y % x)
x = 'She'
y = 60
z = 'ran for %s minutes'
print(x, z % y)
x = 75
y = 60
z = 'ran for %s minutes'
print(z % y)
x = 7
y = 6
z = 'He ran for %s minutes for %s days'
print(z % (x, y))
x = ' '
print(x*5)
a. Displays a tab
b. Displays 5 spaces
c. Displays a newline
d. Displays 10 quotes
x = 'no'
y = 'yes'
z = 'may be'
a = [y, z, x]
print(a)
a. Addition
b. Multiplication
c. Division
d. Deletion
a. Braces
b. Indentation
c. Commas
d. Expressions
a. temperature temperature
b. temperature
c. temperature temperature temperature
d. Yesterday's Today's Tomorrow's
x = 25
y = 10
while x < 26 and y < 11:
x = x + 1
y = y + 1
print(x,y)
a. 26 11
b. 25 11
c. 25 10
d. 26 10
x = 25
y = 10
while x < 26 and y < 11:
print(x,y)
x = x + 1
y = y + 1
a. 26 11
b. 25 11
c. 25 10
d. 26 10
print(list(range(0,5)))
a. list(range(0,5))
b. list(0, 1, 2, 3, 4)
c. 0, 1, 2, 3, 4
d. [0, 1, 2, 3, 4]
def abc(world):
print('hello %s' % world)
abc('Python')
a. hello world
b. hello Python
c. hello
d. hello % world
b = 'Python'
a = 'world'
def pypi(x, y):
print('hello %s %s' % (y, x))
pypi(a, b)
a. hello world
b. hello Python world
c. hello Python
d. hello world Python
a = 12
b = 45
c = 10
def pypi(x, y, z):
return(z * y - x)
print(pypi(b, c, a))
a. 15
b. 45
c. 75
d. 120
426. What will be the output after the following statements?
def pypi():
b = 25
c = 20
return(a * b - c)
a = 12
print(pypi())
a. 280
b. Error
c. 60
d. 215
class Furniture:
def legs(x):
print('has %s legs' % x)
Furniture.legs(4)
class Furniture:
def legs():
print('is made of wood')
Furniture.legs()
class Furniture:
def chair(x):
print('It has %s legs' % x)
def table(x):
print('It has %s legs' % x)
Furniture.table(6)
a. It has 4 legs
b. It has no legs
c. It has 0 legs
d. It has 6 legs
class Furniture:
def chair():
print('It has 4 legs')
def table():
print('It has 6 legs')
Furniture.chair()
a. It has 4 legs
b. It has no legs
c. It has 0 legs
d. It has 6 legs
a. None
b. Error
c. Wrong Value
d. This is absolute value
x = -3
if abs(x) < 3:
print(x)
else:
print(0)
a. No output
b. Error
c. 0
d. -3
x = -4
if bool(x):
print(x)
else:
print(0)
a. No output
b. Error
c. 0
d. -4
434. What will be the output after the following statements?
x = 0
if bool(x):
print(x)
else:
print(5)
a. No output
b. Error
c. 5
d. 0
x = 'None'
if bool(x):
print('Yes')
else:
print('No')
a. None
b. Yes
c. No
d. 0
x = ''
if bool(x):
print('Yes')
else:
print('No')
a. None
b. Yes
c. No
d. 0
x = ' '
if bool(x):
print('Yes')
else:
print('No')
a. None
b. Yes
c. No
d. 0
x = []
if bool(x):
print('Yes')
else:
print('No')
a. No
b. Yes
c. None
d. 0
a. No
b. Yes
c. None
d. 0
x = ''
if not bool(x):
print('Yes')
else:
print('No')
a. Yes
b. No
c. None
d. 0
x = 'print("Python")'
eval(x)
a. x
b. print("Python")
c. Python
d. 0
442. What will be the output after the following statements if input entered is
45*2?
a. 45*2
b. eval("90")
c. 90
d. 0
a. a
b. A
c. b
d. c
445. What will be the output after the following statements?
a. a
b. A
c. b
d. c
a. a
b. A
c. 1
d. c
a. a
b. A
c. 1
d. c
a. 3
b. 2
c. 1
d. 6
a = list(range(0,10,3))
print(sum(a))
a. 10
b. 100
c. 18
d. 30
a = list(range(10,-10,3))
print(sum(a))
a. 10
b. 0
c. 18
d. 90
a = list(range(-10,5,2))
print(sum(a))
a. -24
b. 0
c. 24
d. 20
x = [5, 4, 3, 2, 1]
y = x.copy()
x[0] = 6
print(y)
a. [6, 4, 3, 2, 1]
b. 6
c. [5, 4, 3, 2, 1]
d. 5
import copy
x = [5, 4, 3, 2, 1]
y = copy.copy(x)
x.append(6)
print(y[0])
a. [6, 4, 3, 2, 1]
b. 6
c. [5, 4, 3, 2, 1]
d. 5
a. True
b. keyword
c. for
d. False
import keyword
print(keyword.iskeyword('for'))
a. True
b. keyword
c. for
d. False
import keyword
print(keyword.iskeyword('Python'))
a. True
b. keyword
c. for
d. False
import random
x = [3, 8, 6, 5, 0]
random.shuffle(x)
print(x)
import random
x = [3, 8, 6, 5, 0]
y = random.shuffle(x)
print(y)
import sys
x = sys.stdout.write('Python Jobs')
import time
print(time.time())
a. Current time in seconds since the Epoch at 00:00:00 GMT on January 1, 1970
b. Today's time in hours
c. None
d. Today's time in minutes
462. What will be the data type of the output after the following statements?
import time
print(time.time())
a. String
b. Integer
c. List
d. Float
463. What will be the data type of the output after the following statements?
import time
print(time.asctime())
a. String
b. Integer
c. List
d. Float
import time
print(time.asctime())
a. Current time in seconds since the Epoch at 00:00:00 GMT on January 1, 1970
b. Current date and time
c. None
d. Today's time in minutes
import time
y = (2016, 2, 10, 12, 45, 32, 5, 0, 0)
print(time.asctime(y))
a. Current time in seconds since the Epoch at 00:00:00 GMT on January 1, 1970
b. Current date and time
c. Sat Feb 10 12:45:32 2016
d. No output
a. 2016
b. 3:40
c. Mon
d. 04
import random
print(int(random.random()*10))
a. 10
b. A random integer number within the range of 0 to 9
c. None
d. A random floating point number within the range of 0 to 9
import random
print(int(random.random()*10) + 1)
a. 11
b. A random integer number within the range of 0 to 11
c. None
d. A random whole number within the range of 1 to 10
import random
print(random.sample(range(20), 5))
import random
print(random.sample(range(5, 20), 4))
print(a)
a. SyntaxError
b. TypeError
c. ValueError
d. NameError
a = "Python Practice'
a. SyntaxError
b. TypeError
c. ValueError
d. NameError
a = true
a. No Error
b. TypeError
c. ValueError
d. NameError
a. undefined
b. Null
c. Nan
d. None
def xyz():
a = 56
xyz()
print(a)
a. NameError
b. 56
c. a = 56
d. xyz
476. What will be the output after the following statements?
def xyz():
x = 40
abc()
print(x)
def abc():
a = 32
x = 10
xyz()
a. NameError
b. 40
c. 10
d. 32
def xyz():
x = 40
def abc():
xyz()
a = 32
x = 10
print(x)
abc()
a. NameError
b. 40
c. 10
d. 32
def abc():
print(x)
x = 10
abc()
a. NameError
b. x
c. 10
d. 0
def abc():
x = 12
print(x)
x = 10
abc()
a. NameError
b. 12
c. 10
d. 0
def abc():
x = 10
print(x)
abc()
x = 12
a. NameError
b. 12
c. 10
d. 0
481. What will be the output after the following statements?
def abc():
global x
x = 23
x = 10
abc()
print(x)
a. NameError
b. 23
c. 10
d. 0
def abc():
print(x)
x = 10
abc()
x = 20
a. NameError
b. 20
c. 10
d. UnboundLocalError
def abc(x):
return 20 / x
print(abc(4))
a. NameError
b. 5
c. 5.0
d. ZeroDivisionError
def abc(x):
return 20 / x
print(abc(0))
a. NameError
b. Undefined
c. 5.0
d. ZeroDivisionError
def abc(x):
try:
print(20 / x)
except:
print('Not a valid argument', end=' ')
print(abc(0))
a. NameError
b. Not a valid argument
c. Not a valid argument None
d. ZeroDivisionError
def abc(x):
try:
print(20 / x)
except:
print('Not a valid argument', end=' ')
finally:
print(0, end=' ')
print(abc(0))
x = [1, 2, 3, 4]
print(x[4])
a. 4
b. 3
c. [1, 2, 3, 4]
d. IndexError
a. 20
b. 30
c. [20]
d. IndexError
a. 2
b. 3.0
c. TypeError
d. IndexError
a. 2
b. 3.0
c. TypeError
d. IndexError
a. Today is a niceday
b. Today is a nice day
c. Todayis aniceday
d. Todayisaniceday
x = 'Monday'
print('Mon' in x)
a. 'Mon' in x
b. 'Monday' in x
c. True
d. False
x = 'Monday'
print('Day' not in x)
a. 'Day' not in x
b. 'Monday' not in x
c. True
d. False
a. x
b. ['hot', '100', True]
c. 'hot', '100', True
d. hot 100 True
a. ValueError
b. ['hot', '100', True]
c. 'hot', '100', True
d. hot 100 True
a. ValueError
b. hot 100
c. hot True
d. hot 100 True
a. ValueError
b. hot 100
c. hot True
d. hot 100 True
a. SortError
b. ['a', 'b', 'c', 'A', 'B', 'C']
c. ['a', 'A', 'b', 'B', 'c', 'C']
d. ['A', 'B', 'C', 'a', 'b', 'c']
a. SortError
b. ['a', 'b', 'c', 'A', 'B', 'C']
c. ['a', 'A', 'b', 'B', 'c', 'C']
d. ['A', 'B', 'C', 'a', 'b', 'c']
a. TypeError
b. ['a', 'b', 'c', 'A', 'B', 'C']
c. ['a', 'A', 'b', 'B', 'c', 'C']
d. ['A', 'B', 'C', 'a', 'b', 'c']
a. TypeError
b. ['a', 'b', 'c', 'A', 'B', 'C']
c. ['a', 'A', 'b', 'B', 'c', 'C']
d. ['A', 'B', 'C', 'a', 'b', 'c']
507. What will be the output after the following statements?
import random
x = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday',
'Saturday', 'Sunday']
print(x[random.randint(0, len(x) - 1)])
a. IndexError
b. A random day from all the seven days
c. A random day from all the days except Sunday
d. A random day from all the days except Monday
a. SyntaxError
b. Today is a nice day
c. I will go for a walk today
d. Today is a nice day I will go for a walk today
a. TypeError
b. Today is a nice day
c. SyntaxError
d. Today is not a nice day
510. What will be the output after the following statements?
a. TypeError
b. Today is a nice day
c. SyntaxError
d. Today is not a nice day
a. TypeError
b. Today is a nice day
c. SyntaxError
d. Today is not a nice day
a. TypeError
b. Today is a nice day
c. SyntaxError
d. Today is not a nice day
a. TypeError
b. ('Today', 'nice', 'day')
c. SyntaxError
d. ('Today', 'not', 'nice', 'day')
514. What will be the data type of the output after the following statements?
x = ('Today')
print(x)
a. TypeError
b. String
c. Tuple
d. List
515. What will be the data type of the output after the following statements?
x = ('Today',)
print(x)
a. TypeError
b. String
c. Tuple
d. List
516. What will be the data type of y after the following statements?
x = [1, 2, 3, 4]
y = tuple(x)
a. TypeError
b. String
c. Tuple
d. List
517. What will be the data type of z after the following statements?
x = [1, 2, 3, 4]
y = tuple(x)
z = list(y)
a. TypeError
b. String
c. Tuple
d. List
518. What will be the data type of the output after the following statements?
x = 'Python'
y = list(x)
print(y)
a. TypeError
b. String
c. Tuple
d. List
519. What will be the data type of the output after the following statements?
x = 'Python'
y = tuple(x)
print(y)
a. TypeError
b. String
c. Tuple
d. List
x = ('Python')
print(x)
x = ('Python',)
print(x)
a. ('Python',)
b. Python
c. P y t h o n
d. ('Python')
522. What will be the output after the following statements?
x = [0, 2, 4, 6]
print(tuple(x))
a. [0, 2, 4, 6]
b. (0, 2, 4, 6)
c. 0, 2, 4, 6
d. 0 2 4 6
x = (0, 2, 4, 6)
print(list(x))
a. [0, 2, 4, 6]
b. (0, 2, 4, 6)
c. 0, 2, 4, 6
d. 0 2 4 6
x = 'Python'
print(list(x))
x = [4, 5, 7, 8, 9]
y = x
y[1] = 6
print(y)
a. [4, 5, 7, 8, 9]
b. [4, 5, 6, 7, 8, 9]
c. [4, 6, 7, 8, 9]
d. [4, 7, 8, 9]
x = [4, 5, 7, 8, 9]
y = x
y[1] = 6
print(x)
a. [4, 5, 7, 8, 9]
b. [4, 5, 6, 7, 8, 9]
c. [4, 6, 7, 8, 9]
d. [4, 7, 8, 9]
528. What will be the output after the following statements?
def abc(z):
z.append(44)
x = [7, 8, 9]
abc(x)
print(x)
a. [7, 8, 9]
b. [7, 8, 9, 44]
c. [7, 44, 8, 9]
d. [44, 7, 8, 9]
import copy
x = [5, 4, 3, 2, 1]
y = copy.copy(x)
x.append(6)
print(y[-1])
a. 5
b. 6
c. [5, 4, 3, 2, 1, 6]
d. 1
import copy
x = [5, 4, 3, 2, 1]
y = copy.copy(x)
x[2] = 6
print(y[2])
a. 3
b. 6
c. [5, 4, 6, 3, 2, 1]
d. 4
import copy
x = [5, 4, 3, 2, 1]
y = [7, 8, 9]
z = [x, y]
a = copy.copy(z)
x[2] = 6
print(a)
import copy
x = [5, 4, 3, 2, 1]
y = [7, 8, 9]
z = [x, y]
a = copy.deepcopy(z)
x[2] = 6
print(a)
x = {'day':'Sunday', 'week':10}
print(x['year'])
a. day
b. KeyError
c. Sunday
d. 10
x = {'day':'Sunday', 'week':10}
for i in x.values():
print(i, end=' ')
a. Sunday 10
b. KeyError
c. Sunday
d. 10
x = {'day':'Sunday', 'week':10}
for i in x:
print(i, end=' ')
a. Sunday 10
b. day week
c. Sunday
d. 10
536. What will be the output after the following statements?
x = {'day':'Sunday', 'week':10}
for i in x.keys():
print(i, end=' ')
a. Sunday 10
b. day week
c. Sunday
d. 10
x = {'day':'Sunday', 'week':10}
for i in x.items():
print(i, end=' ')
x = {'day':'Sunday', 'week':10}
print(list(x.keys()))
a. Sunday 10
b. day week
c. ['day', 'week']
d. (day, week)
539. What will be the output after the following statements?
x = {'day':'Sunday', 'week':10}
print(tuple(x.items()))
x = {'day':'Sunday', 'week':10}
print(tuple(x.values()))
a. Sunday 10
b. ('Sunday', 10)
c. ['Sunday', 10]
d. 10
x = {'day':'Sunday', 'week':10}
for i, j in x.items():
print(i, j, end=' ')
a. Sunday
b. True
c. False
d. day
x = {'day':'Sunday', 'week':10}
print('day' in x.keys())
a. Sunday
b. True
c. False
d. day
x = {'day':'Sunday', 'week':10}
print(x.get('day', 'Friday'))
a. Friday
b. True
c. Sunday
d. day
a. Friday
b. True
c. Sunday
d. day
x = {'day':'Sunday', 'week':10}
print(x.get('weak', 5))
a. 10
b. 5
c. Sunday
d. day
x = {'day':'Sunday', 'week':10}
print(x.get('week', 5))
a. 10
b. 5
c. Sunday
d. day
x = {'day':'Sunday', 'week':10}
print(x.get('year', 2016))
a. year
b. 2016
c. Sunday
d. 10
a. ('day', 'Tuesday')
b. {'day': 'Tuesday', 'month': 'March'}
c. 'day': 'Tuesday', 'month': 'March', 'year': 2016
d. {'day': 'Tuesday', 'month': 'March', 'year': 2016}
a. ('day', 'Tuesday')
b. {'day': 'Tuesday', 'month': 'March'}
c. 'day': 'Tuesday', 'month': 'March', 'year': 2016
d. {'day': 'Tuesday', 'month': 'March', 'year': 2016}
a. ('day', 'Monday')
b. {'day': 'Monday', 'month': 'March'}
c. {'day': 'Tuesday', 'month': 'March', 'year': 2016}
d. {'day': 'Monday', 'month': 'March', 'year': 2016}
552. What will be the data type of x after the following statement?
x = {}
a. Tuple
b. Set
c. List
d. Dictionary
x = 'python jobs'
x.upper()
print(x)
a. PYTHON JOBS
b. Python jobs
c. Python Jobs
d. python jobs
x = 'Python Jobs'
x.lower()
print(x)
a. PYTHON JOBS
b. Python jobs
c. Python Jobs
d. python jobs
x = 'Python Jobs'
if x.lower() == 'python jobs':
print('Python jobs')
else:
print('python 3 jobs')
a. python 3 jobs
b. Python jobs
c. Python Jobs
d. python jobs
a. python 3 jobs
b. Python jobs
c. Python Jobs
d. python jobs
x = 'Python Jobs'
y = x.upper().lower().upper()
print(y)
a. python Jobs
b. PYTHON JOBS
c. Python Jobs
d. python jobs
x = 'Python Jobs'
y = x.upper().lower().isupper()
print(y)
a. python jobs
b. PYTHON JOBS
c. False
d. True
560. What will be the output after the following statements?
x = 'Python is interesting'
y = x.split()
print(y)
a. ['Today is a nice day.', "Let's go for a walk.", "We'll also go to the park."]
b. Today is a nice day.
c. Let's go for a walk.
d. We'll also go to the park.
a. Python 2
b. Python 3
c. Python 2 and Python 3
d. Python 2 Python 3
a. Python 2
b. Python 2 and Py
c. Python 2 and Python 3
d. Python 2 Python 3
#! python3
x = 'Python 3'
a. A comment
b. Python String
c. Shebang line
d. Python Variable
566. What will be the output after the following statements?
import re
x = re.compile(r'\d\d\d-\d\d\d\d')
y = x.search('The phone number is 444-4444')
print(y.group())
import re
x = re.compile(r'(\d\d\d)-(\d\d\d\d)')
y = x.search('The phone number is 444-4444')
print(y.group(2))
import re
x = re.compile(r'(\d\d\d)-(\d\d\d\d)')
y = x.search('The phone number is 444-4444')
print(y.group(1))
import re
x = re.compile(r'(\d\d\d)-(\d\d\d\d)')
y = x.search('The phone number is 444-4444')
print(y.group(0))
import re
x = re.compile(r'(\d\d\d)-(\d\d\d\d)')
y = x.search('The phone number is 444-4444')
print(y.groups())
a. ('444', '4444')
b. 4444
c. 444-4444
d. 444
import re
x = re.compile(r'(\(\d\d\d\))-(\d\d\d\d)')
y = x.search('The phone number is (444)-4444')
print(y.group(1))
a. ('444', '4444')
b. 444
c. 444-4444
d. (444)
import re
x = re.compile(r'Python 2|Python 3')
y = x.search('Python 3 MCQ')
print(y.group())
a. Python 2|Python 3
b. Python 2
c. Python 3
d. Python 3 MCQ
import re
x = re.compile(r'Python 2|Python 3')
y = x.search('Python 2.7')
print(y.group())
a. Python 2.7
b. Python 2
c. Python 3
d. Python 2|Python 3
import re
x = re.compile(r'day')
y = x.search('Today is a nice day and a Sunday')
print(y.group())
a. day
b. Today
c. nice day
d. Sunday
import re
x = re.compile(r'(Sun)?day')
y = x.search('Today is a nice day and a Sunday')
print(y.group())
a. day
b. Today
c. nice day
d. Sunday
import re
x = re.compile(r'(Sun|To)?day')
y = x.search('Today is a nice day and a Sunday')
print(y.group())
a. day
b. Today
c. nice day
d. Sunday
a. nice day
b. Today
c. day
d. Sunday
import re
x = re.compile(r'(Sun)+day')
y = x.search('Today is a nice day and a Sunday')
print(y.group())
a. day
b. Today
c. nice day
d. Sunday
import re
x = re.compile(r'(Python){2}')
y = x.search('PythonPythonPython')
print(y.group())
a. PythonPythonPython
b. PythonPython
c. Python
d. Python 2
580. What will be the output after the following statements?
import re
x = re.compile(r'(Python){2,3}')
y = x.search('PythonPythonPython')
print(y.group())
a. PythonPythonPython
b. PythonPython
c. Python
d. Python 2
import re
x = re.compile(r'(Python){1,3}?')
y = x.search('PythonPythonPython')
print(y.group())
a. PythonPythonPython
b. PythonPython
c. Python
d. Python 2
import re
x = re.compile(r'day')
y = x.findall('Today is a nice day and a Sunday')
print(y)
a. day
b. Today
c. ['day', 'day', 'day']
d. ('day', 'day', 'day')
import re
x = re.compile(r'(Sun)?day')
y = x.findall('Today is a nice day and a Sunday')
print(y)
import re
x = re.compile(r'(Sun|To)?day')
y = x.findall('Today is a nice day and a Sunday')
print(y)
import re
x = re.compile(r'(Sun)*day')
y = x.findall('Today is a nice day and a Sunday')
print(y)
a. ('day', 'day', 'day')
b. ['', '', 'Sun']
c. ['day', 'day', 'day']
d. ['To', '', 'Sun']
import re
x = re.compile(r'(Sun)+day')
y = x.findall('Today is a nice day and a Sunday')
print(y)
import re
x = re.compile(r'(\(\d\d\d\))-(\d\d\d\d)')
y = x.findall('The phone number is (444)-4444')
print(y)
a. [('(444)', '4444')]
b. [('444)', '4444']
c. (('(444)', '4444'))
d. ('444', '4444')
a. [('(444)', '4444')]
b. '4', '4', '4', '4', '4', '4', '4'
c. (('(444)', '4444'))
d. ['4', '4', '4', '4', '4', '4', '4']
import re
x = re.compile(r'\D')
y = x.findall('Python 3')
print(y)
a. ['Python', '3']
b. ['P', 'y', 't', 'h', 'o', 'n', ' ', '3']
c. ['P', 'y', 't', 'h', 'o', 'n', ' ']
d. ['P', 'y', 't', 'h', 'o', 'n']
import re
x = re.compile(r'\w')
y = x.findall('Python_3')
print(y)
a. ['Python', '3']
b. ['P', 'y', 't', 'h', 'o', 'n', '3']
c. ['P', 'y', 't', 'h', 'o', 'n', ' ']
d. ['P', 'y', 't', 'h', 'o', 'n', '_', '3']
591. What will be the output after the following statements?
import re
x = re.compile(r'\W')
y = x.findall('Python_3')
print(y)
a. ['Python', '3']
b. []
c. ['P', 'y', 't', 'h', 'o', 'n', ' ']
d. [' ']
import re
x = re.compile(r'\s')
y = x.findall('Python 3')
print(y)
a. ['Python', '3']
b. []
c. ['P', 'y', 't', 'h', 'o', 'n', ' ']
d. [' ']
import re
x = re.compile(r'\S')
y = x.findall('Python 3')
print(y)
import re
x = re.compile(r'[0-9]')
y = x.findall('Python 3')
print(y)
import re
x = re.compile(r'[ptPT]')
y = x.findall('Python 3')
print(y)
import re
x = re.compile(r'[p-t0-6]')
y = x.findall('Python 3')
print(y)
a. ['P', 't', '3']
b. ['P', 't']
c. []
d. ['t', '3']
import re
x = re.compile(r'[D-S0-2]')
y = x.findall('Python 3')
print(y)
import re
x = re.compile(r'[^A-Za-z0-2]')
y = x.findall('Python_3')
print(y)
a. ['_', '3']
b. ['P', 't']
c. [' ', '3']
d. ['t', '3']
import re
x = re.compile(r'^Py')
y = x.search('Python_3')
print(y.group())
a. ['Py']
b. Py
c. ['P', 'y']
d. ['P', 'y', '3']
import re
x = re.compile(r'3$')
print(x.search('Python_3') == None)
a. ['3']
b. Python_3
c. True
d. False
import re
x = re.compile(r'.day')
y = x.findall('Today is a nice day and a Sunday')
print(y)
a. ['oday', 'nday']
b. ['oday', ' day', 'nday']
c. ['day', 'day', 'day']
d. ['Today', ' day', 'Sunday']
a. ['To']
b. ['Today is a nice day and a Sunday']
c. ['Today is a nice day and a Sun']
d. ['Today is a nice day']
import re
x = re.compile(r'(.*?)day')
y = x.findall('Today is a nice day and a Sunday')
print(y)
import re
x = re.compile('.*')
y = x.search("Today is a nice day.\n Let's go for a walk.\n We'll
also go to the park.")
print(y.group())
a. Today is a nice day.\n Let's go for a walk.\n We'll also go to the park.
b. Today is a nice day.\n Let's go for a walk.
c. ['Today is a nice day.']
d. Today is a nice day.
605. What will be the output after the following statements?
import re
x = re.compile('.*', re.DOTALL)
y = x.search("Today is a nice day.\n Let's go for a walk.\n We'll
also go to the park.")
print(y.group())
import re
x = re.compile('Day')
y = x.search('Today is a nice day')
print(y)
import re
x = re.compile('Day', re.I)
y = x.search('Today is a nice day')
print(y.group())
a. Today is a nice day.
b. None
c. ['Today is a nice day.']
d. day
import re
x = re.compile('day', re.IGNORECASE)
y = x.findall('Today is a nice day and a Sunday')
print(y)
import re
x = re.compile('Sunday')
y = x.sub('Wednesday', 'Today is a nice day and a Sunday')
print(y)
import webbrowser
webbrowser.open('http://google.com')
a. Ping http://google.com
b. Display http://google.com in the shell
c. Download http://google.com as a text file
d. Launch a browser window to http://google.com
import sys
print(sys.argv)
1. b
2. c
3. c
4. b
5. a
6. d
7. b
8. d
9. c
10. b
11. b
12. a
13. d
14. c
15. b
16. c
17. a
18. a
19. b
20. d
21. c
22. d
23. a
24. c
25. d
26. b
27. a
28. b
29. b
30. a
31. b
32. a
33. d
34. c
35. c
36. d
37. b
38. a
39. b
40. c
41. b
42. d
43. a
44. b
45. b
46. c
47. c
48. a
49. a
50. c
51. b
52. d
53. a
54. d
55. c
56. d
57. c
58. a
59. d
60. b
61. b
62. c
63. a
64. d
65. a
66. d
67. b
68. d
69. a
70. c
71. b
72. b
73. c
74. d
75. a
76. b
77. a
78. d
79. a
80. c
81. b
82. d
83. b
84. a
85. c
86. b
87. a
88. d
89. b
90. c
91. d
92. c
93. c
94. d
95. b
96. c
97. d
98. a
99. a
100. b
101. c
102. d
103. b
104. a
105. c
106. a
107. b
108. d
109. d
110. d
111. a
112. b
113. c
114. b
115. d
116. a
117. c
118. c
119. d
120. b
121. b
122. a
123. d
124. a
125. c
126. b
127. a
128. d
129. b
130. a
131. d
132. b
133. c
134. b
135. d
136. c
137. a
138. d
139. b
140. b
141. c
142. d
143. a
144. b
145. c
146. a
147. b
148. a
149. b
150. c
151. d
152. a
153. c
154. b
155. a
156. d
157. b
158. c
159. a
160. c
161. c
162. d
163. b
164. d
165. a
166. d
167. b
168. a
169. d
170. c
171. a
172. b
173. d
174. a
175. c
176. d
177. a
178. c
179. b
180. a
181. b
182. c
183. d
184. a
185. c
186. b
187. d
188. b
189. c
190. a
191. b
192. a
193. c
194. c
195. d
196. b
197. a
198. b
199. d
200. c
201. d
202. c
203. a
204. a
205. b
206. d
207. c
208. b
209. a
210. b
211. d
212. c
213. d
214. b
215. c
216. d
217. c
218. a
219. b
220. d
221. c
222. b
223. d
224. a
225. c
226. a
227. d
228. b
229. b
230. a
231. a
232. c
233. b
234. d
235. a
236. c
237. b
238. a
239. a
240. b
241. d
242. c
243. c
244. d
245. d
246. b
247. b
248. a
249. a
250. a
251. b
252. c
253. a
254. b
255. a
256. b
257. d
258. d
259. a
260. b
261. c
262. d
263. d
264. c
265. d
266. c
267. c
268. d
269. c
270. d
271. d
272. c
273. a
274. b
275. a
276. b
277. b
278. a
279. c
280. a
281. b
282. d
283. c
284. b
285. a
286. d
287. b
288. d
289. b
290. a
291. c
292. a
293. c
294. b
295. a
296. b
297. d
298. c
299. b
300. a
301. c
302. a
303. b
304. d
305. b
306. d
307. b
308. d
309. c
310. c
311. a
312. d
313. b
314. d
315. b
316. c
317. c
318. b
319. a
320. a
321. d
322. c
323. a
324. b
325. d
326. b
327. c
328. a
329. b
330. d
331. b
332. a
333. c
334. d
335. a
336. c
337. b
338. a
339. d
340. a
341. b
342. c
343. d
344. a
345. b
346. c
347. a
348. b
349. d
350. a
351. b
352. d
353. c
354. a
355. d
356. c
357. b
358. b
359. a
360. d
361. c
362. b
363. d
364. d
365. a
366. b
367. c
368. b
369. d
370. c
371. a
372. b
373. d
374. c
375. c
376. b
377. b
378. d
379. c
380. d
381. a
382. b
383. c
384. d
385. d
386. a
387. b
388. c
389. d
390. a
391. b
392. c
393. b
394. b
395. b
396. d
397. b
398. c
399. a
400. a
401. b
402. a
403. a
404. d
405. c
406. c
407. b
408. d
409. c
410. b
411. d
412. c
413. b
414. a
415. d
416. b
417. c
418. c
419. a
420. c
421. d
422. b
423. d
424. b
425. c
426. a
427. c
428. b
429. d
430. a
431. d
432. c
433. d
434. c
435. b
436. c
437. b
438. a
439. b
440. a
441. c
442. c
443. b
444. d
445. b
446. d
447. c
448. d
449. c
450. b
451. a
452. c
453. d
454. d
455. a
456. d
457. a
458. b
459. c
460. b
461. a
462. d
463. a
464. b
465. c
466. c
467. b
468. d
469. a
470. c
471. d
472. a
473. d
474. d
475. a
476. b
477. c
478. c
479. b
480. c
481. b
482. d
483. c
484. d
485. c
486. a
487. d
488. d
489. c
490. b
491. a
492. a
493. c
494. a
495. d
496. b
497. c
498. c
499. d
500. d
501. a
502. c
503. d
504. c
505. b
506. a
507. b
508. d
509. a
510. d
511. b
512. b
513. a
514. b
515. c
516. c
517. d
518. d
519. c
520. b
521. a
522. b
523. a
524. c
525. a
526. c
527. c
528. b
529. d
530. a
531. b
532. a
533. b
534. a
535. b
536. b
537. a
538. c
539. a
540. b
541. d
542. c
543. b
544. c
545. a
546. b
547. a
548. b
549. d
550. d
551. c
552. d
553. a
554. d
555. c
556. b
557. a
558. b
559. c
560. b
561. d
562. a
563. c
564. b
565. c
566. c
567. b
568. d
569. c
570. a
571. d
572. c
573. b
574. a
575. a
576. b
577. c
578. d
579. b
580. a
581. c
582. c
583. b
584. d
585. b
586. b
587. a
588. d
589. c
590. d
591. b
592. d
593. a
594. c
595. b
596. d
597. c
598. a
599. b
600. d
601. b
602. c
603. a
604. d
605. a
606. b
607. d
608. c
609. d
610. c
611. d
612. b
Thank You
Thanks for buying this book. I hope you enjoyed this book, the second book in
the 'Python 3 Beginners Guide' series. If you'd like to be notified when I release
the next book in this series and others, do let me know at
sclewis2016@outlook.com This e-book is lending-enabled. You can tell others
what you liked about this book by writing a review.
If you find an errors or have any suggestions, feel free to let me know at
sclewis2016@outlook.com
More Books by the Author
If you liked this book, you might want to check the other books by the author
too.
1.) Python 3 MCQ - Multiple Choice Questions n Answers for Tests, Quizzes -
Python Students & Teachers
2.) Python3 101 MCQ - Multiple Choice Questions Answers for Jobs, Tests and
Quizzes