Home
MCQS
Python MCQ Quiz Hub
MCQ Introduction to Python Section 2
Choose a topic to test your knowledge and improve your Python skills
1. Output of print(2 * 3 ** 2) is
16
64
18
Error
2. Write the output of the following: x = int(7) + int (‘9’) print(x)
79
16
Error
None of the above
3. Out of addition(+) and Subtraction (-) operator, which has more precedence?
Addition (+)
Subtraction (-)
Both have same precedence
None of the above
4. Which of the following statement will return error when x = 7 ?
print(x)
print(int(x))
print(eval(x)
None of the above
5. Which of the following store data in pair?
List
Tuple
String
Dictionary
6. What is the return type of function id( )?
float
string
int
None of the above
7. An ordered set of instructions to be executed by a computer to carry out a specific task is called ___
Algorithm
Pseudocode
Program
None of the above
8. Computers understand the language of 0s and 1s which is called _______
Machine Language
Low level Language
Binary Language
All the above
9. A program written in a high-level language is called _________ code
Object
Source
Machine
None of the above
10. Python uses ____ to convert its instructions into machine language.
Interpreter
Compiler
Both of the above
None of the above
11. Language translator convert ______________ code to _______________ code.
Source, Object
Object, Source
Machine , Source
None of the above
12. Which of the following is not the feature of python language?
Python is a proprietary software.
Python is not case-sensitive.
Python uses brackets for blocks and nested blocks.
All the above
13. In which of the following mode, the interpreter executes the statement and displays the result as soon as we press ‘Enter’ key?
Interactive mode
Script mode
Hybrid mode
None of the above
14. By default, the Python scripts are saved with ____________ extension.
pyp
pys
py
None of the above
15. By default, the Python scripts are saved in ____
Document
Desktop
Python installation folder
D drive
16. ________ are reserved words.
Keywords
Identifiers
Variables
Comments
17. Which of the following is not correct for naming an identifier in Python?
Identifier can be of any length
Identifier should not be a keyword
We cannot use special symbols like !, @, #, $, %, etc., in identifiers
Spaces are allowed in identifiers
18. Comments in python program are ________________ by interpreter
executed
not executed
given
shared
19. In Python single line comment starts with __
%
/*
!
#
20. In Python multi line comment starts with _________
%
/*
!
#
21. Which of the following is a sequence data type?
String
Integer
Float
Dictionary
22. _________ is a set of valid characters that a language can recognize.
identifier
Token
Character set
Character group
23. The smallest individual unit in a program is known as _
Token
Punctuators
Literals
Operators
24. Which of the following is token in Python?
Punctuators
Literals
Keywords
All the above
25. Which of the following is String literal?
ABC
123”
Both of the above
None of the above
26. Variables of data types like integers, float etc., hold __
single value
multiple values
exact 2 values
None of the above
27. Which of the following is invalid data type in python?
List
String
tuple
values
28. Multiline string in python can be created by enclosing text in ____
Single quotes(‘ ‘)
Double quotes(” “)
Triple quotes(”’ ”’)
All the above
29. Which of the following is mapping data type in Python?
String
List
Dictionary
Tuple
30. Variables whose values can be changed after they are created and assigned are called __
mutable
immutable
changeable
None of the above
31. An _______________ is a symbol which is used to perform specific mathematical or logical operation on values.
Operand
Operator
Keyword
Identifier
32. Operators work on values called ___
Operating
Operand
data value
Opvalue
33. Which operator returns remainder?
/
//
%
\
34. 86. Which of the following is an exponent operator?
*
/
**
***
35. Which of the following statement display “RAM” two times?
>>> “RAM” + 2
>>> “RAM” * 2
>>> “RAM” ** 2
None of the above
36. Write the output of the following: >>> 7 % 3 ** 3
1
7
3
27
37. Which of the following is not an integer literal?
1
7
98
“4”
38. Which escape sequence represent newline character?
e
T
39. Which of the following is number data type in python?
Integer
Complex
Boolean
All the above
40. Which of the following is an invalid relational operator in Python?
!=
==
>=
<>
41. print(3 != 4) will evaluates __
True
False
Error
None of the above
42. Which of the following is an assignment operator?
=
/=
*=
All the above
43. Statement x += y is equivalent to ______
x = x + y
x = x * y
y = x + y
y = y * x
44. Write the output of the following : >>> num1 = 7 >>> num2 = 3 >>> num1 //= num2 >>> num1
3
7
2
8
45. Write the output of the following : >>> a = 'India' >>> a *= 3 >>> a
IndiaIndiaIndia
India3
3India
None of the above
46. Which of the following is invalid logical operator?
and
or
not
xor
47. print(bool(3 and 6)) evaluates to __
False
True
Error
None of the above
48. print(bool(True and True or False)) evaluates to ___
False
True
Error
None of the above
49. 101. >>> bool(0) evaluates to _
False
True
Error
None of the above
50. __________ operators are used to check if a value is a member of the given sequence or not.
Logical
Identity
Membership
Relational
Submit