Teachers and Examiners (CBSESkillEduction) collaborated to create the Python Revision Tour 1 Class 12 MCQ. All the important Information are taken from the NCERT Textbook Computer Science (083) class 12.
Python Revision Tour 1 Class 12 MCQ
1. An ordered set of instructions to be executed by a computer to carry out a specific task is called a ___________.
a. Program
b. Instruction
c. Code
d. None of the above
2. Computers understand the language of 0s and 1s which is called __________.
a. Machine language
b. Low level language
c. Both a) and b)
d. None of the above
3. A program written in a high-level language is called _________.
a. Language
b. Source code
c. Machine code
d. None of the above
4. An interpreter read the program statements _________.
a. All the source at a time
b. One by one
c. Both a) and b)
d. None of the above
5. Python is a __________.
a. Low level language
b. High level language
c. Machine level language
d. All of the above
6. Python is __________.
a. Open source language
b. Free language
c. Both a) and b)
d. None of the above
7. Python support __________.
a. Compiler
b. Interpreter
c. Assembler
d. None of the above
8. Python programs are ___________.
a. Easy to understand
b. Clearly defined syntax
c. Relatively simple structure
d. All of the above
9. Python is _________.
a. Case – sensitive
b. Non case – sensitive
c. Both a) and b)
d. None of the above
10. Python is platform independent, meaning ___________.
a. It can run various operating systems
b. It can run various hardware platforms
c. Both a) and b)
d. None of the above
11. Python uses indentation for __________.
a. Blocks
b. Nested Blocks
c. Both a) and b)
d. None of the above
12. To write and run (execute) a Python program, we need to have a ___________.
a. Python interpreter installed on the computer
b. We can use any online python interpreter
c. Both a) and b)
d. None of the above
13. The interpreter is also called python _______.
a. Shell
b. Cell
c. Program
d. None of the above
14. To execute the python program we have to use __________.
a. Interactive mode
b. Script mode
c. Both a) and b)
d. None of the above
15. __________ allows execution of individual statements instantaneously.
a. Interactive mode
b. Script mode
c. Both a) and b)
d. None of the above
16. _________allows us to write more than one instruction in a file called Python source code.
a. Interactive mode
b. Script mode
c. Both a) and b)
d. None of the above
17. To work in the interactive mode, we can simply type a Python statement on the ________ prompt directly.
a. >>>
b. >>
c. >
d. None of the above
18. In the script mode, we can write a Python program in a ________, save it and then use the interpreter to execute it.
a. Prompt
b. File
c. Folder
d. All of the above
19. By default the python extension is __________.
a. .py
b. .ppy
c. .pp
d. .pyy
20. __________ are reserved words in python.
a. Keyword
b. Interpreter
c. Program
d. None of the above
21. The rules for naming an identifier in Python are ________.
a. Name should begin with an uppercase, lowercase or underscore
b. It can be of any length
c. It should not be a keyword
d. All of the above
22. To define variables in python _______ special symbols is not allowed.
a. @
b. # and !
c. $ and %
d. All of the above
23. A variable in a program is uniquely identified by a name __________.
a. Identifier
b. Keyword
c. Code
d. None of the above
24. Variable in python refers to an ________.
a. Keyword
b. Object
c. Alphabets
d. None of the above
25. The variable message holds string type value and so its content is assigned within _________.
a. Double quotes “”
b. Single quotes ”
c. Both a) and b)
d. None of the above
26. _________ must always be assigned values before they are used in expressions.
a. Keyword
b. Variable
c. Code
d. None of the above
27. ___________ are used to add a remark or a note in the source code.
a. Keyword
b. Source
c. Comment
d. None of the above
28. __________ are not executed by a python interpreter.
a. Keyword
b. Source
c. Comment
d. None of the above
29. In python comments start from _______.
a. #
b. @
c. %
d. $
30. Python treats every value or data item whether numeric, string, or other type (discussed in the next section) as an _________.
a. Object
b. Variable
c. Keyword
d. None of the above
31. _________ identifies the type of data values a variable can hold and the operations that can be performed on that data.
a. Data type
b. Data base
c. Both a) and b)
d. None of the above
32. Number data type classified into ________.
a. int
b. float
c. complex
d. All of the above
33. ________ data type is a subtype of integer
a. Boolean
b. string
c. list
d. None of the above
34. A Python sequence is an ordered collection of items.
a. Number
b. Sequence
c. Both a) and b)
d. None of the above
35. Sequence data type is classified into _________.
a. Strings
b. Lists
c. Tuples
d. All of the above
36. __________ is a group of characters in python.
a. Number
b. String
c. Boolean
d. All of the above
37. In the string data type you can store __________.
a. Alphabets
b. Digits
c. Special character including space
d. All of the above
38. _________ is a sequence of items separated by commas and the items are enclosed in square brackets [ ].
a. List
b. Tuple
c. String
d. None of the above
39. __________ is a sequence of items separated by commas and items are enclosed in parenthesis ( ).
a. List
b. Tuple
c. String
d. None of the above
40. _________ is an unordered collection of items separated by commas and the items are enclosed in curly brackets { }.
a. List
b. Set
c. String
d. None of the above
41. ________ data type cannot have duplicate entries.
a. List
b. Set
c. String
d. None of the above
42. None is a special data type with a single value. It is used to signify the absence of value in a situation.
a. List
b. Set
c. String
d. None
43. ___________ in Python holds data items in key-value pairs.
a. Dictionary
b. Set
c. String
d. None
44. Items in a dictionary are enclosed in __________.
a. Parenthesis ()
b. Brackets []
c. Curly brackets {}
d. All of the above
45. In the dictionary every key is separated from its value using a _________.
a. Colon (:)
b. Semicolon (;)
c. Comma (,)
d. All of the above
46. Variables whose values can be changed after they are created and assigned are called __________.
a. Immutable
b. Mutable
c. Both a) and b)
d. None of the above
47. Variables whose values cannot be changed after they are created and assigned are called _________.
a. Immutable
b. Mutable
c. Both a) and b)
d. None of the above
48. When we need uniqueness of elements and to avoid duplicacy it is preferable to use __________.
a. List
b. Set
c. Tuple
d. All of the above
49.The values that the operators work on are called __________.
a. Operands
b. Assignment
c. Mathematical Operator
d. All of the above
50. ____________ that are used to perform the four basic arithmetic operations as well as modular division, floor division and exponentiation.
a. Arithmetic Operator
b. Logical Operator
c. Relational Operator
d. All of the above
51. __________ calculation on operands. That is, raise the operand on the left to the power of the operand on the right.
a. Floor Division (//)
b. Exponent (**)
c. Modulus (%)
d. None of the above
52. _____________ compares the values of the operands on either side and determines the relationship among them.
a. Arithmetic Operator
b. Logical Operator
c. Relational Operator
d. All of the above
53. _________ assigns or changes the value of the variable on its left.
a. Relational Operator
b. Assignment Operator
c. Logical Operator
d. All of the above
54. Which one of the following logical operators is supported by python.
a. and
b. or
c. not
d. All of the above
55. _________ operator is used to check both the operands are true.
a. and
b. or
c. not
d. All of the above
56. ___________ are used to determine whether the value of a variable is of a certain type or not.
a. Relational Operator
b. Logical Operator
c. Identity Operator
d. All of the above
57. ___________ can also be used to determine whether two variables are referring to the same object or not.
a. Relational Operator
b. Logical Operator
c. Identity Operator
d. All of the above
58. Membership operators are used to check if a value is a member of the given sequence or not.
a. Identity Operator
b. Membership Operators
c. Relational Operators
d. All of the above
59. An __________ is defined as a combination of constants, variables, and operators.
a. Expressions
b. Precedence
c. Both a) and b)
d. None of the above
60. Evaluation of the expression is based on __________ of operators.
a. Expressions
b. Precedence
c. Both a) and b)
d. None of the above
61. Example of membership operators.
a. in
b. not
c. in
d. All of the above
62. Example of identity operators.
a. is
b. is not
c. Both a) and b)
d. None of the above
63. In Python, we have the ____________ function for taking the user input.
a. prompt()
b. input()
c. in()
d. None of the above
64. In Python, we have the ___________ function for displaying the output.
a. prompt()
b. output()
c. print()
d. None of the above
65. ____________, also called type casting, happens when data type conversion takes place because the programmer forced it in the program.
a. Explicit conversion
b. Implicit conversion
c. Both a) and b)
d. None of the above
66. __________, also known as coercion, happens when data type conversion is done automatically by Python and is not instructed by the programmer.
a. Explicit conversion
b. Implicit conversion
c. Both a) and b)
d. None of the above
67. A programmer can make mistakes while writing a program, and hence, the program may not execute or may generate wrong output. The process of identifying and removing such mistakes, also known as __________.
a. Bugs
b. Errors
c. Both a) and b)
d. None of the above
68. Identifying and removing bugs or errors from the program is also known as __________.
a. Debugging
b. Mistakes
c. Error
d. None of the above
69. Which of the following errors occur in python programs.
a. Syntax error
b. Logical error
c. Runtime error
d. All of the above
70. A _________ produces an undesired output but without abrupt termination of the execution of the program.
a. Syntax error
b. Logical error
c. Runtime error
d. All of the above
71. A ___________ causes abnormal termination of the program while it is executing.
a. Syntax error
b. Logical error
c. Runtime error
d. All of the above
72. Python is __________ language that can be used for a multitude of scientific and non-scientific computing purposes.
a. Open – source
b. High level
c. Interpreter – based
d. All of the above
73. Comments are __________ statements in a program.
a. Non – executable
b. Executable
c. Both a) and b)
d. None of the above
74. __________ is a user defined name given to a variable or a constant in a program.
a. Keyword
b. Identifier
c. Data type
d. All of the above
75. The process of identifying and removing errors from a computer program is called _______.
a. Debugging
b. Mistakes
c. Error
d. None of the above
76. The order of execution of the statements in a program is known as _______.
a. Flow of control
b. Flow of structure
c. Flow of chart
d. None of the above
77. Python supports ____________ control structures.
a. Selection
b. Repetition
c. Both a) and b)
d. None of the above
78. Which one is the correct syntax of if statement in python.
a. if condition:
statement(s)
b. if condition
statement(s)
a. if (condition)
statement(s)
a. if condition then
statement(s)
79. Number of ________ is dependent on the number of conditions to be checked. If the first condition is false, then the next condition is checked, and so on.
a. Elese if
b. If Else
c. Elif
d. All of the above
80. The statements within a block are put inside __________.
a. Single quotes
b. Double quotes
c. Curly brackets
d. Square brackets
81. Leading whitespace (spaces and tabs) at the beginning of a statement is called ________.
a. Indentation
b. Repetition
c. Code
d. None of the above
82. This kind of repetition is also called __________ .
a. Indentation
b. Iteration
c. Both a) and b)
d. None of the above
83. _________ constructs provide the facility to execute a set of statements in a program repetitively, based on a condition.
a. Conditional Statement
b. Looping Statement
c. Both a) and b)
d. None of the above
84. The statements in a loop are executed again and again as long as particular logical condition remains true.
a. For loop
b. While loop
c. Do-while loop
d. All of the above
85. What will happen when condition becomes false in the loop.
a. Loop Execute
b. Loop Terminates
c. Loop Repeat once again
d. All of the above
86. What keyword would you add to an if statement to add a different condition?
a. Else if
b. Ifelse
c. elif
d. None of the above
87. What is the output of the given below program?
if 4 + 2 == 8:
print(“Condition is True”)
else:
print(“Condition is False”)
a. Condition is True
b. Condition is False
c. No Output
d. Error
88. What is the output of the given below program?
if 4 + 2 == 8:
print(“Condition is True”)
else:
print(“Condition is False”)
print(“Welcome”)
a. Condition is True
b. Condition is False
Welcome
c. Condition is True
Welcome
d. Error
89. Find the output of the given Python program?
a = 50
b = 60
if a < 50:
print(“Condition is True”)
if b <= 60:
print(“Condition is True”)
else:
print(“Condition is False”)
a. Condition is True
b. Condition is False
c. No Output
d. Error
90. What is the output of the given below program?
a = 35
if a >= 35:
print(“Condition is True”)
if a <= 35:
print(“Condition is True”)
else:
print(“Condition is False”)
a. Condition is True
b. Condition is True
Condition is True
c. Condition is True
Condition is False
d. Condition is False
Condition is True
91. Find the output of the given Python program?
a, b, c = 1, 2, 3
if a > 0:
if b < 2:
print(“Welcome”)
elif c >= 3:
print(“Welcome to my School”)
else:
print(“New School”)
a. Welcome
b. Welcome to my School
c. New School
d. Run time error
92. Find the output of the given Python program?
a, b, c = 1, 2, 3
if a + b + c:
print(“Condition is True”)
else:
print(“Condition is False”)
a. Condition is True
b. Condition is False
c. No Output
d. Runt time error
93. What is the output of the given below program?
b = 5
if a < b:
print(“Condition is True”)
else:
print(“Condition is False”)
a. Condition is True
b. Condition is False
c. NameError: name ‘a’ is not defined
d. No Output
94. What is the output of the given below program?
a = b = true
if (a and b):
print(“Condition is True”)
else:
print(“Condition is False”)
a. Condition is True
b. Condition is False
c. NameError: name ‘true’ is not defined
d. No Output
95. Which of the following is not a Python loop?
a. for loop
b. do-while loop
c. while loop
d. None of the above
96. Regarding Python loops, which of the following statements is false?
a. Loops are utilized to repeat specific actions.
b. When several statements need to be performed repeatedly until the specified condition turns false, the while loop is employed.
c. When several statements need to be run repeatedly until the provided condition is true, a while loop is employed.
d. List elements can be repeated through using a for loop.
97. What does range() function returns ?
a. list of numbers.
b. integer object.
c. range object.
d. None of the above
98. Which of the following statements about Python loops is True?
a. The keyword “end” should be used to end loops.
b. The components of strings cannot be repeated over using a loop.
c. You can break control from the current loop by using the keyword “break.”
d. To continue with the remaining statements inside the loop, use the keyword “continue.”
99. What will be the output of given Python code?
a=7
b=0
while(a):
if(a>5):
b=b+a-2
a=a-1
else:
break
print(a)
print(b)
a. 4 7
b. 5 9
c. 4 10
d. 5 3
100. Which of the following is a valid for loop in Python?
a. for i in range(5,5)
b. for i in range(0,5)
c. for i in range(0,5):
d. for i in range(5)
101. What will be the output of given Python code?
str=”Welcome”
sum=0
for n in str:
if(n!=”l”):
sum=sum+1
else:
pass
print(sum)
a. 5
b. 6
c. 4
d. 9
102. How many times will the loop run?
i=5
while(i>0):
i=i-1
print (i)
a. 5
b. 4
c. 3
d. 2
103. What will be the output of the following code?
x = 12
for i in x:
print(i)
a. 12
b. 1 2
c. Error
d. None of the above
104. One loop may be used inside another loop using the Python programming language, which is known as?
a. switch
b. foreach
c. nested
d. forall
105. Which of the following loop is work on the particular range in python ?
a. while loop
b. for loop
c. do while loop
d. None of the above
106.What does break statement do?
a. Stop
b. Repeat
c. Skip
d. Print
107. What does continue statement do?
a. Print
b. Stop
c. Skip
d. Repeat
108. The if statement is used for _________.
a. Selection making
b. Decision making
c. Both a) and b)
d. None of the above
109. ___________ statement iterates over a range of values or a sequence.
a. For
b. While
c. Do-While
d. None of the above
110. The statements within the body of the ________ must ensure that the condition eventually becomes false; otherwise, the loop will become an infinite loop, leading to a logical error in the program.
a. For loop
b. While loop
c. Do-While loop
d. None of the above
111. The __________ statement immediately exits a loop, skipping the rest of the loop’s body. Execution continues with the statement immediately following the body of the loop.
a. Break
b. Continue
c. Exit
d. None of the above
112. When a _________ statement is encountered, the control jumps to the beginning of the loop for the next iteration.
a. Break
b. Continue
c. Exit
d. None of the above
113. A loop contained within another loop is called a __________.
a. Another Loop
b. Nested Loop
c. Next Loop
d. None of the above
114. Python executes one statement to another statement from starting to end, this is known as ____________.
a. Selection construct
c. Sequential Construct
b. Iteration Construct
d. All of the above
115. The sequence in which statements in a programme are executed is referred to as ___________.
a. Constant flow
c. Flow of control
b. Selection flow
d. None of the above
116. There are _______ types of control structures that Python supports.
a. 4
b. 3
c. 2
a. 1
117. Which of the following is a Python control structure?
a. Iteration
b. Selection
c. Both a) and b)
d. None of the above
118. With the use of a __________ statement, the idea of decision-making or selection is implemented in programming.
a. For loop
b. While loop
c. If & Else
d. Break & Continue
119. A program’s elif count depends on the _____________.
a. Dependent on the condition
b. Dependent on the writing methods
c. Dependent on the loop
d. None of the above
120. ________ is an empty statement in Python.
a. Fail
b. Pass
c. Null
d. None of the above
121. There are ______ spaces of indentation around a statement inside of “if.”
a. 4
b. 8
c. 16
d. 20
122. If the condition is True, Amit wants to display “Welcome,” else “Welcome to my webpage” if the condition is false. Which of the following statements makes it easier to put this into practice?
a. For Statement
b. While Statement
c. If & Else Statement
d. None of the above
123. In order to determine if a number is even or odd, Amit wants to develop a programme. He needs to have a solid understanding of _________ to do this.
a. Conditional Statement
b. Break Statement
c. Continue Statement
d. None of the above
124. When if-elif statement is used in python?
a. Only one condition
b. Multiple condition
c. Never used
d. None of the above
125. What is the purpose of “else” statement?
a. It will execute when condition is false
b. It will execute when condition is true
c. It will never execuite.
d. Both a) and b)