Home
MCQS
Python MCQ Quiz Hub
MCQ Introduction to Python Section 1
Choose a topic to test your knowledge and improve your Python skills
1. Which of the following is not in Python Character Set.
Letters : A-Z or a – z
Digits : 0 – 9
Whitespaces : blank space, tab etc
Images : Vector
2. Which of the following is not the mode of interacting with python?
Interactive Mode
Script Mode
Hybrid Mode
None of the above
3. What will be the data type of the following variable?
= ‘101’
Integer
String
Float
4. Write the output of the following: print(range(0,8,2))
0,2,4,6
range(0, 8, 2)
Error
None of the above
5. Which of the following is not correct about python?
Python is an open source language.
Python is based on ABC language.
Python is developed by Guido Van Rossum
None of the above
6. Which of the following is not correct about python?
Python is an open source language.
Python is based on ABC language.
Python is developed by Guido Van Rossum
None of the above
7. Smallest element of of python coding is called ________
Identifiers
Token
Keywords
Delimiters
8. Which of the following is not a token?
//
“X”
##
23
9. Write the output of the following code: x=2 x=5 x=x+x print(x)
7
4
10
error
10. Write the output of the following code : x=2 y=3 x+y+5 print(x+y)
10
5
Error
None of the above
11. Which of the following symbol is used to write comment?
?
//
#
**
12. Each statement in python is terminated by ___
Semicolon(;)
Colon(:)
Comma(,)
None of the above
13. Write the output of the following: print(‘Hello, world!’);print(“H”)
Hello world H
Hello worldH
Hello world H
error
14. ___ spaces should be left for indentation.
3
4
5
0
15. What type of error is returned by the following statement? def abc(a): print(a)
ErrorIndentation
IndentationError
SpaceError
No error in the given statement
16. Which keyword is used to define a function in python?
def
define
new
None of the above
17. Write the output of the following: a=8 def abc(a): print(a) abc(7)
8
Error
No Output
7
18. Statement below “function definition” begin with spaces called ____
Indentation
Condition
Definition
None of the above
19. Which of the following is invalid variable name? a.
Sum1
Num_1
Num1
N1
20. Write the output of the following. def abc(): print("abc")
abc
Error
0
No Output
21. Which statement will display square of number (n)
print(n * n)
print(math.pow(n,2)) # math module is already imported
All of the above
Only First
22. What type of error is returned by the following statement? print(eval(13))
SyntaxError
TypeError
ValueError
No Error in this statement
23. Which statement is adding remainder of 8 divided by 3 to the product of 5 and 6?
8 % 3 + 5 * 6
8/3 + 5 * 6
8 // 3 + 6.5
None of the above
24. Identify the invalid identifier. b. c. d.
Keyword
token
operator
and
25. Which keyboard key is used to run python programs?
F6
F5
F + n
Ctrl + r
26. Which method is used to find the memory location of variable?
id( )
add( )
type( )
None of the above
27. ________________ method is used to find the data type of a variable.
type( )
dtype( )
typed( )
None of the above
28. ____________ escape sequence is used for horizontal tab. a. b. c. T d. No
/n
/t
T
No
29. An escape sequence is represented by __________ slash followed by one or two characters.
back
forward
double
None of the above
30. Write the output of the following code : >>> x = 4 - 7j >>> print(x.imag, x.real)
4.0 -7.0
-7.0 4.0
Error
None of the above
31. Write the output of the following code : >>> a=9 >>> x=str(a) >>> b=5 >>> y=str(b) >>> x+y
14
9.5
9
None of the above
32. Write the output of the following code : >>> 7+2//1**2 > 5+2**2//3 a. b.
True
False
Error
None of the above
33. Write the output of the following code : >>> s = None >>> s
Nothing will be printed
None
Shows Error
None of the above
34. Which of the following assignment will return error?
a = b = c = 89
a = 6, b = 8
a, b, c = 1, 2, 3
None of the above
35. Which of the following is wrong in reference to naming of variable?
Keywords are not allowed for variable names.
Spaces are not allowed for variable names.
ariable names can start from number.
Special symbols are not allowed
36. Which of the following is invalid identifier?
_
_1st
1stName
While
37. Identifier name can be of maximum ____________ character
63
79
53
any number of
38. Which of the following can not be used as an identifier?
eval
max
pass
All the above
39. Which of the following statement is calculating x raise to power n?
x * n
x ** n
n ** x
x ^ n
40. Write the output of the following. m, n, p = 1, 2, 3 print(m, n, p)
1, 2, 3
1 2 3
Print 1, 2 and 3 vertically
Error
41. Which of the following is valid operator?
in
on
it
at
42. Output of print(7 % 21) is ____
3
7
Error
None of the above
43. Operators of same precedence are executed from _____
left to right
right to left .
in any order
None of the above
Submit