
Python programming objective questions and answers for Python 3 language. Below python 3 mcq questions includes includes coding examples with multiple choice answers. 50 most asked mcqs on python fundamentals, functions and basics for practice. The coding examples can also help you to crack various tests like infytq, tcs and other recruiters. We also trying to add python mcq pdf download link.
Q.1. Which of the following version of Python was released in December,
2015 by Python.org?
a. 3.3
b. 3.5.1
c. 2.4
d. 2.6
3.5.1
Q.2. Python files are saved with the extension as …?
a. .python
b. .pe
c. .py
d. .pi
.py
Q.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
IDLE
Q.4. IDLE stands for … ?
a. Indigenous Development Lab
b. Integrated Development Environment
c. Integrated Developers Local Environment
d. Indie Developers Environment
Integrated Development Environment
Q.5. The function to display a specified message on the screen is … ?
a. print
b. display
c. run
d. output
Python mcq questions and answers
Q.6. Which of the following is an assignment operator in Python?
a. ==
b. ===
c. >>>
d. =
=
Q.7. Which of the following is used to initialize multiple variables with a
common value?
a. x = y: y = 33
b. x = y = z = 33
c. x = z; y = z; x = 33;
d. x & y & z = 33
x = y = z = 33
Q.8. Comments in Python begin with …?
a. {
b. %
c. *
d. #
#
Q.9. A user-specified value can be assigned to a variable with this function …
a. user
b. enter
c. input
d. value
input
Q.10. User input is read as …?
a. Floating Decimal
b. Text String
c. Boolean Value
d. Integer
Text String
Q.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
\n
Q.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
Single Space
Q.13. Which of the following will provide an ! character as alternative
separator for the print function?
a. sep is !
b. separate = !
c. sep >> ‘!’
d. sep = ‘!’
sep = ‘!’
Q.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 = ‘*’
end = ‘*’
Q.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
Syntax error
python multiple choice questions and answers
Q.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
Runtime error
Q.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
Semantic error
Q.18. What will be the output after the following statements?
x = 6
y = 3
print(x / y)
a. 2.0
b. 2
c. 18
d. 18.0
2.0
Q.19. What will be the output after the following statements?
x = 8
y = 2
print(x // y)
a. 4.0
b. 4
c. 16
d. 16.0
4
Q.20. What will be the output after the following statements?
x = 5
y = 4
print(x % y)
a. 0
b. 20
c. 1.0
d. 1
1
Q.21. What will be the output after the following statements?
x = 3
y = 2
x += y
print(x)
a. 3
b. 2
c. 5
d. 1
5
Q.22. What will be the output after the following statements?
x = 5
y = 7
x *= y
print(x)
a. 7
b. 12
c. 5
d. 35
35
Q.23. What will be the output after the following statements?
x = 25
y = 15
x -= y
print(x)
a. 10
b. 25
c. 15
d. -15
10
Q.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
2
Q.25. What will be the output after the following statements?
x = 3
y = 7
print(x == y)
a. y = 7 and x = 3
b. True
c. x = 3 and y = 3
d. False
False
python objective type questions and answers
Q.26. What will be the output after the following statements?
x = 8
y = 6
print(x != y)
a. y = 6 and x = 8
b. True
c. x = 6 and y = 6
d. False
True
Q.27. What will be the output after the following statements?
x = 83
y = 57
print(x > y)
a. True
b. False
c. Yes
d. No
True
Q.28. What will be the output after the following statements?
x = 72
y = 64
print(x < y)
a. True
b. False
c. Yes
d. No
False
Q.29. What will be the output after the following statements?
x = True
y = False
print(x and y)
a. True
b. False
c. Not defined
d. xy
False
Q.30. What will be the output after the following statements?
x = True
y = False
print(x or y)
a. True
b. False
c. Not defined
d. xy
True
python objective questions for infosys training
Q.31. What will be the output after the following statements?
x = True
y = False
print(not x)
a. True
b. False
c. Not defined
d. y
False
Q.32. What will be the output after the following statements?
x = True
y = False
print(not y)
a. True
b. False
c. Not defined
d. x
True
Q.33. What will be the output after the following statements?
x = 20
y = 40
z = y if (y > x) else x
print(z)
a. True
b. False
c. 20
d. 40
40
Q.34. What will be the output after the following statements?
x = 50
y = 10
z = y if (y > x) else x
print(z)
a. True
b. False
c. 50
d. 10
50
Q.35. What will be the output after the following statements?
x = 65
y = 53
z = y if (x % 2 == 0) else x
print(z)
a. True
b. False
c. 65
d. 53
65
Q.36. What will be the output after the following statements?
x = 46
y = 98
z = y if (y % 2 == 0) else x
print(z)
a. True
b. False
c. 46
d. 98
98
Q.37. What will be the output after the following statements?
x = 2 * 4 + 7
print(x)
a. 30
b. 15
c. 22
d. 247
15
Q.38. What will be the output after the following statements?
x = 7 * (4 + 5)
print(x)
a. 63
b. 16
c. 33
d. 35
63
Q.39. What will be the output after the following statements?
x = ’24’ + ’16’
print(x)
a. 40
b. 2416
c. 21
d. 46
2416
Q.40. What will be the output after the following statements?
x = 15 + 35
print(x)
a. 40
b. 153
c. 50
d. 1535
50
infosys python mcq questions
Q.41. What will be the data type of x after the following statement if input
entered is 18 ?
x = input(‘Enter a number: ‘)
a. Float
b. String
c. List
d. Integer
String
Q.42. What will be the data type of y after the following statements if input
entered is 50?
x = input(‘Enter a number: ‘)
y = int(x)
a. Float
b. String
c. List
d. Integer
Integer
Q.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
Float
Q.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
String
Q.45. What will be the output after the following statements?
x = y = z = 8
print(y)
a. x
b. 8
c. z
d. y
8
python infosys coding questions
Q.46. What will be the value of x, y and z after the following statement?
x = y = z = 300
a. All three will have the value of 3
b. All three will have the value of 100
c. All three will have the value of 300
d. x and y will have arbitrary values, while z will have the value of 300
All three will have the value of 300
Q.47. What will be the value of x, y and z after the following statement?
x, y, z = 3, 4, 5
a. All three will have the value of 3
b. All three will have the value of 345
c. x will have the value of 3, y will have the value 4 and z will have the
value of 5
d. x and y will have arbitrary values, while z will have the value of 345
x will have the value of 3, y will have the value 4 and z will have the value of 5
Q.48. What is the data type of x after the following statement?
x = [7, 8, 9, 10]
a. List
b. Dictionary
c. Tuple
d. String
List
Q.49. What is the data type of x after the following statement?
x = [‘Today’, ‘Tomorrow’, ‘Yesterday’]
a. List
b. Dictionary
c. Tuple
d. String
List
Q.50. What will be the output after the following statements?
x = [‘Today’, ‘Tomorrow’, ‘Yesterday’]
y = x[1]
print(y)
a. x1
b. Today
c. Tomorrow
d. Yesterday
Tomorrow