Chapter 1
Chapter 1
D. (0,1,2,3,4,5,6,7)
E. C
13. Which function can be used to display the output in python Analysis
A. show()
B. print()
C. display()
D. output()
B
28 (C)1971
(D)1975
(B) C
(B) \t
(C) \n
(D) \b
29 Knowledge,
Question:Which of the following functions print the output to
the console?
(A) Output( )
(B)Print( )
(C)Echo( )
(D)print( )
D
30
Understanding
Question:The default separator character of print( ) is ……….
(A) tab
(B)space
(C)newline
(D)dot
31 A
Knowledge
Which of the following is correct about python?
1. Graphical
2. Cross-platform
3. Independent
4. All of these
5. B
35 Python uses a/an............to convert source code to object code. Understanding
1. Interpreter
2. Compiler
3. Combination of Interpreter and compiler
4. Special virtual engine
5. A
36 The interpreter is also called …………………… Application
a. Python Editor
b. Python Kernel
c. Python shell.
a. >>
b. >>>
c. <<>
d. >>>>
e. B
38 What is the output after executing the following code: Evaluation
Print(“Hello World!”)
a. >>>Hello World!
b. Hello World
c. Hello World!
d. Error
e. D
>>>print(20/4 *5+8-10)
a. 1
b. 23
c. 23.0
d. 24
e. C
print(“150+300”)
(i) 450
(ii) 150300
(iii) 150+300
(iv) 300
(v) C
41 What do we use to define a block of code in Python language? Analysis
1. Key
2. Brackets
3. Indentation
4. None of these
5. C
42 Python interpreter executes.......................................statement Analysis
(Command) at a time.
1. Two
2. Three
3. One
4. All command
5. C
43 Which one is not the feature of Python- Understanding
1. Cross-platform
2. Interpreted
3. Free and Open source
4. Not a case-sensitive
5. D
1. Compile code
2. Object code
3. Source code
4. Binary Code
5. C
45 IDLE stands for Analysis
(A) 16
Knowledge
(B) 32
(C) 64
(A) eval
(C) nonlocal
(D) Pass
(E) A
48 All keywords in python except TRUE and FALSE are in
?
(C) Capitalized
(B) in
(C) it
(D) On
(E) B
(A) Knowledge,
(B) a **b
Understand
(C)
(D)
B
51 Who developed the Python language?
Knowledge
(B) Guido van Rossum
(A) 1995
(C) 1989
(D) 1981
(A) .py
Knowledge
(B) .p
(C) .python
(D) .pyt
54 Which of the characters is used in python to make a single
line comment?
Knowledge
(A) /
(B) //
(C) #
(D) !
(A) List
(C) Tuple
(D) Class
L=[1,3,”Hello”,5]
(B) Tuple
(C) Class
(D) Dictionary
57 Which one of these is the floor division operator?
(A) /
(B) // Knowledge
(C) %
(D) *
(A) Exponential
Knowledge
(B) Additin
(C) Parenthesis
(D) Division
>>>a+bc
(A) a Analysis
(B) b
(C) ab
(D) abc
60 What is math.factorial(4.0)?
(A) 20
(B) 24 Evaluation
(C) 16
(D) 64
61
Which of the following belongs to integer datatype Knowledge
A) -12
B) 4.0
C) 3+4J
D) -2.05
62
Which of the following belongs to float datatype Knowledge
A) -12
B) -14.0
C) 3+4J
D) 4
63
Which of the following belongs to complex datatype Knowledge
A) -12
B) 4.0
C) 3+4J
D) -2.05
64
An ordered collection of items, where each item is indexed by Application
an integer is called:
A) MAPPING
B) SEQUENCES
C) SETS
D) NUMBERS
65
is a sequence of items separated by commas and the Application
items are enclosed in square brackets [ ]
A) LIST
B) DICTIONARY
C) STRING
D) TUPLE
66
is a sequence of items separated by commas and the Application
items are enclosed in paranthesis ()
A) LIST
B) DICTIONARY
C) STRING
D) TUPLE
67
holds data items in key-value pairs. Application
A) LIST
B) DICTIONARY
C) STRING
D) TUPLE
68
is a sequence of items separated by commas and the Application
items are enclosed in paranthesis ()
A) LIST
B) DICTIONARY
C) STRING
D) TUPLE
69
is an unordered collection of items separated by Application
commas and the items are enclosed in curly brackets { }
A) LIST
B) SETS
C) STRING
D) TUPLE
70
None is a special data type with a single value. It is used to knowlegde
signify the absence of value in a situation
A) TRUE
B) FALSE
C) NONE
D) NULL
71
Datatype conversion can happen : Understanding
A) ONLY EXPLICITY
B) ONLY IMPLICITY
A) INTEGER
B) FLOAT
C) STRING
D) LIST
73
Which of the following is immutable Analysis
A) LIST
B) DICTIONARY
C) STRING
74
A list can contain the following: Application
A) ONLY NUMBERS
B) ONLY STRINGS
D) ONLY INTEGERS
75
String is a group of characters. These characters may be Application
A) ALPHABETS,
B) DIGITS
A. List
B. Tuple
C. Set
D. None of these
A. 3.1
B. 0
C. 1
D. 3
78 Which of the following is not a data type in python? Knowledge
A. List
B. Tuple
C. Dictionary
D. Book
A. datatype()
B. typeof()
C. type()
D. vartype()
A. Type Casting
B. Type Conversion
A=100
B=A
L = {1:”One”,2:”Two”}
A. list
B. dictionary
C. array
D. tuple
84 Find Example of sequence datatype. Application
A. List
B. Tuple
C. Both of them
D. None of them
A. True
B. False
A. Dictionary
B. List
C. String
A. List
B. Class
C. Dictionary
D. Tuple
90 In which data type, indexing is not valid? Knowledge
A. List
B. String
C. Dictionary
a. +
b. or
c. not
d. and
a. ()
b. .or
c. .not
d. .and
93 What is the output of the following code? Evaluation
a,b=8/4/2, 8/(4/2)
print(a,b)
a. Syntax error
b. 1.0,4.0
c. 4.0,4.0
d. 4,4
v1= True
v2=1
print(v1==v2, v1 is v2)
a) True False
b) False True
c) True True
d) False False
for i in str1_:
if i not in str2_:
print(i,end='')
a) Au
b) ou
c) Syntax Error
d) value Error
a) 10
b) 20
c) True
d) False
99 Find output for following given program : Understandin
a=2 g
b=3
print( a*b**2)
a) 18
b) 16
c) 64
d)12
a) Error
b)[20,40]
c)[10,10,20,20]
d)[10, 20, 10, 20]
a) True
b) False
c) 0
d) 1
102 Evaluate expression in following given program and Evaluation
find the output :
a=56
b=a//7//4
print(b)
a. 0
b. 2
c. 0.0
d. 2.0
print(b,c)
A) 2 12
B) 12 2
C) 0 0
D) Error
a) Type Error
b) Value Error
c) True will be assigned to V3
d) False will be assigned to v3
(A) 14
(B) 25
(C) 13
(D) 27
(A) x * z
(B) x^z
(C) x ** z
108 The expression 9/4/2 will evaluate equivalent to which of the Application
following expressions?
(A) 9/(4/2)
(B) (9/4)/2
(A) 14
(B) 15
(C) Error
(D) 14.5
+,-,/,*,%,<<,>>,( ),**
(A**
(B) ( )
(C) %
(D)-
(A) float(‘12’)
(B) int(‘12’)
(C) float(’12.5’)
(D) int(‘12.5’)
(A) xyz=1,000,000
(C) x,y,z=100,200,300
(D) x=y=z=1,000,000
113 What is the output of the following statements: Creation
A=5
B=6
print(A,B)
(A )5 6
(B) 5,6
(C) 5
(A) 2
(B) 2.0
(C) 10.6666
(D) 10
(A) 1
(B) 1.0
(C) Error
(D) 1.00
116 What is the output of the following: Application
print(“Hello\nWorld”)
(B) Hello
World
(C) Hello
World
(A) 3.2+5.3
(B) 2.0+5
(C) int(4.7)+3
S1=”my”
S2=”string”
print (int(s1+s2))
(A) my string
(B) mystring
(C) 2563859
(D) Error
119 What is the output of the following? Creation
print(“Python “, end= “ “)
print(“world”)
(B) Python
world
world
(A) 2.4
(B) 2
(C) 12.4
(D) 12
121
Which of the following defines SyntaxError? Understanding
123
Which of the following defines IOError? Understanding
125
Which of the following defines ImportError? Understanding
127
It is raised when the denominator in a division operation is Understanding
zero.
a) IndexError
b) IndentationError
c) ZeroDivisionError
d) TypeError
128
It is raised when the index or subscript in a sequence is out Understanding
of range.
a) IndexError
b) IndentationError
c) ZeroDivisionError
d) TypeError
129
It is raised when a local or global variable name is not Understanding
defined.
a) IndexError
b) IndentationError
c) ZeroDivisionError
d) NameError
130
It is raised due to incorrect indentation in the program Understanding
code.
a) IndexError
b) IndentationError
c) ZeroDivisionError
d) NameError
131
It is raised when an operator is supplied with a value of Understanding
incorrect data type.
a) IndexError
b) TypeError
c) ZeroDivisionError
d) NameError
132
It is raised when the result of a calculation exceeds the Understanding
maximum limit for numeric data type.
a) OverFlowError
b) TypeError
c) ZeroDivisionError
d) NameError
133
ZeroDivisionError is a type of: Understanding
a) SyntaxError
b) Logical Error
c) Runtime Error
d) Other
134
IndentationError is a type of: Understanding
a) SyntaxError
b) Logical Error
c) Runtime Error
d) Other
135
KeyboardInterrupt is a type of: Understanding
a) SyntaxError
b) Logical Error
c) Runtime Error
d) Other
136
Which of following is not a decision-making statement. Knowledge,
Understanding
a. if-elif statement
b. for statement
c. if -else statement
d. if statement
137
In Python,...............................defines a block of statements. Knowledge,
Understanding
a. Block
b.loop
c.indentation
d.{}
138 if 4+5==10:
Knowledge
print(“TRUE”)
else: Application
print(“false”)
Evaluation
print (“True”)
a. False
True
b. True
True
c. false
d. none
139
Predict the output of the following code: Knowledge
X=3
Application
if x>2 or x<5 and x==6:
print(“ok”) Evaluation
else:
print(“no output”)
a . ok
b. okok
c. no output
d. none of above
140
The for loop in Python is an Knowledge,
Understanding
a. Entry Controlled Loop
141
The..................statement terminates the execution of the Knowledge,
whole loop. Understanding
a. continue
b. exit
c. breake
d. break
142
An empty /null statement in Python is ……………. Knowledge,
Understanding
a. pass
b. none
c. null
d. none
143
The................operator tests if a given value is contained in Knowledge,
a sequence or Understanding
not.
a. In:
b in
c. not in
d. none
144
The order of statement execution in the form of top to Knowledge,
bottom is known as Understanding
construct.
a. alternate
b.sequence
c.flow of data
d. flow chart
145
What will be the output of given Python code? Knowledge
str1="hello"
Application
c=0
for x in str1: Evaluation
if(x!="l"):
c=c+1
else:
pass
print(c)
a. 2
b. 0
c. 4
d. 3
146
State which of the following statement are true . Knowledge
1. If,elif ,else are not compound statement.
Application
2. Else if can be used in python.
3. Indentation while working with blocks is Evaluation
not necessary in python.
4. A pass statement is a null operation;it
does nothing.
a.1
b.2 ,3
c.3
d.4
147
In a Python program, a control structure: Knowledge,
Understanding
a. Defines program-specific data structures
b. range(0,9)
c. range(10)
d. range(1,11)
151
Which statement is used to iterate itself over a range of Knowledge
values or a sequence
(A) if
(B) while
(C) do-while
(D) for
152
What abandons the current iteration of the loop? Understanding
(A) continue
(B) break
(C) stop
(D) infinite
153
Which of the following is not a loop statement in python? Knowledge,
(A) do-while
(B) while
(C) for
154
Which of the following is a valid keyword? Knowledge,
(A) IF
(B) if
(C) If
155
Symbol used to end the if statement is: Understanding
(A) ;
(B) :
(C) _
(D) #
156
A graphical representation of an algorithm to solve a given Knowledge,
problem:
(A) if-elif
(B) for
(C) if-else
(D) if
158
A loopthat never ends is called as Application
(B) continue
159
Find the output of the following: Application
if True:
print(101)
else:
print(202)
(A) 101
(B) 202
(C) 303
(D) 102
160
Which of the following is false? Knowledge,
161
Which of the following is used as a dummy statement? Knowledge,
(A) pass
(B) pie
(C) if
(D) else
162
If and else are Application
(A) literals
(B) operators
(C) keywords
163
How many statement must be present in a loop body . Analysis
(A) at least 2
(B) at least 1
(C) at least 4
(D) no required
164
Which is a jump statement? Application
A) break
(B) commit
(C) reflect
(D) do
165
loop is best when the no of iterations is known Analysis
(A) for
(B) if
(C) if else
166
In a Python program, a control structure: Understanding
(A) No
(B) Yes
168
What keyword would you use to add an alternative Knowledge
condition to an if statement?
(A) else if
(B) elseif
(C) elif
169
Which one of the following is a valid Python if statement? Analysis
(A) if a>=9:
(B) if (a>=9)
(C) if (a=>9)
(D) if a>=9
170
Which statement will check if a is equal to b? Analysis
(A) if a=b:
(B) if a==b:
(C) if a===b:
(D) if a==b
171
What does the following source code print? Evaluation
if 4+5 == 10:
print (“True”)
else:
print (“False”)
print (“True”)
(A) True
(B) True
False
(C) False
True
(D) True
False
True
172
What does the following source code print? Evaluation
x = -100
if x < 100:
x=0
a=5
b=5
if a>0:
if b<0:
x=x+5
elif a>5:
x=x+4
else:
x=x+3
else:
x=x+2
print (x)
(A) 0
(B) 4
(C) 2
(D) 3
174
Which code segment will NOT reach its print() function? Analysis
(A) if ‘yes’!=’no’:
175
What will be the output of following code fragment: Evaluation
a=input(“Enter a number”)
if (a = = 5):
print (“Five”)
else:
(B) Five
x=3
if x = = 0:
elif x = = 3:
else:
pass
(A) Am I here ?
177
Which of the following is a pictorial representation of an Knowledge
algorithm?
(A) Pseudocode
(B) Program
(C) Flowchart
(D) Algorithm
178
Terminal symbol in a flowchart indicates: Analysis
(A) End
(B) Processing
(D) Decision
179
In flowchart, diamond shaped symbol is used to represent: Understanding
180
Symbol used in flowchart such as rectangle with the Analysis
horizontal lines on two sides is used for:
if number < 5:
number = number + 1
print(number)
sum = 0
counter = counter + 2
print(sum)
A. 12
B. 9
C. 7
D. 8
183
What will be printed by the following code when it Knowledge
executes? and
application of
sum = 0 for loop
values = [1,3,5,7]
print(sum)
A. 4
B. 0
C. 7
D. 16
184
What is the last thing printed when the following code is Knowledge
run? and
application of
while loop
number = 0
number = number + 1
A. Number: 10
B. Number: number
C. Number: 0
D. Number: 11
185
How many asterisks will be printed when the following Knowledge
code executes? and
application of
nested loop
print('*')
A. 0
B. 4
C. 20
n = 10
answer = 1
while n > 0:
answer = answer + n
n=n+1
print(answer)
A. a for-loop or a while-loop
B. only a for-loop
C. only a while-loop
188
Which of the following statements won’t be printed when Knowledge
this Python code is run? and
application of
for loop
for letter in 'Python':
if letter == 'h':
continue
A. Current Letter : P
B. Current Letter : t
C. Current Letter : h
D. Current Letter : o
189
What will the following code print? Knowledge
and
def mystery(str): application of
for loop
out = ""
if char == "i":
break
if char == 'a':
continue
out += char
return out
print(mystery("walking"))
A. walking
B. wlking
C. wlk
D. wlkng
190
Which of the following will print five rows with five ‘*’ in Knowledge
each row? and
application of
1. range()
for i in range(0,5):
print("*" * i)
2.
for i in range(0,5):
print("*" * 5)
3.
for i range(1,5):
print("*" * i)
4.
for i in range(1,5):
print("*" * 5)
A. 1.
B. 2.
C. 3.
D. 4.
191
What will the following code print? Knowledge
and
application of
nested for loop
for i in range(1,4):
for j in range(1,4):
A. 1 1 2 2 3 3
B. 1 2 3 1 2 3 1 2 3
C. 1 1 1 2 1 3 2 1 2 2 2 3 3 1 3 2 3 3
D. 1 1 2 1 3 1 2 1 2 2 2 3 3 1 3 2 3 3
192
What will be the output of the following Python code? Knowledge
and
application of
for loop
for i in range(0,2,-1):
print("Hello")
A. Hello
B. Hello Hello
C. No Output
D. Error
193
Which of the following is a valid for loop in Python? Knowledge
and
application of
for loop
A. for(i=0; i < n; i++)
B. for i in range(0,5):
C. for i in range(0,5)
D. for i in range(5)
194
When does the else statement written after loop executes? else
Statements and
it’s use
A. When break statement is executed in the loop
195
Flowchart and Algorithms are used for Knowledge
and
A. Better Programming application of
Flowchart
B. Easy Testing and Debugging
C. Efficient Coding
D. All
196 Which of the following is a valid for loop in Python? Knowledge
code? x = “abcdef”
i = “i”
while i in x:
print(i, end=“ ”)
(A) a b c d e f
(B) abcdef
(C) i i i i i ….
(D) No output
198 What will be the output of the following Python Understanding
code? x = 12
for i in x:
print(i, end=“”)
(A) 12
(B) 1 2
(C) 2 1
(D) Error
199 What will be the output of the following Python code? Analysis
if x * y > 6:
break
print(x*y, end=“#”)
(A) 2#3#4#4#6#8#6#9#12#
(B) 2#3#4#5#4#6#6#
(C) 2#3#4#4#6#6#
(D) 2#3#4#6
200 What will be the output of the following Python Knowledge
code? i = 0
sum = 0
while i < 9:
if i%4 == 0:
sum = sum + i
i=i+2
print(sum)
(B) 12
(C) 14
(D) 10
(A) while(infinite):
(B) while(1):
(C) while(False):
count = 10
Count = count + 1
print(count)
203 When does the else statement written after the for loop Understanding
execute?
(A)
(B)
(C)
(D)
205 What will be the output of the following Python code? Application
num = 0
num = num + 1
if num == 3:
continue
print(num, end=“ ”)
(A) 1 2 3 4 5 6
(B) 0 1 2 4 5
(C) 1 2 4 5 6
(D) 0 1 2 3 4 5
206 What will be the output of the following Python code? Application
num = 4
for j in range(1, i +
1):
print(j, end=“ ”)
print(“## ”)
(A) 1 ## 1 2 ## 1 2 3 ## 1 2 3 4 ##
(B) 1 ## 1 2 ## 1 2 3 ## 1 2 3 4 ## 1 2 3 4 5 ##
(C) 1 ## 2 3 ## 3 4 5 ## 6 7 8 9 ##
(D) 1 ## 1 1 ## 1 1 1 ## 1 1 1 1 ##
207 What will be the output of the following Python code? Application
num = 5
m=1
if num < 0:
print(“wrong input”)
elif num == 0:
print(1)
else:
m=m*i
print(m)
(B) 5
(C) 120
(D) 720
208 X wants to allow the program to repeatedly ask the user to Application
enter their Choice if it does not equal the Answer. Which loop
option should X use?
Answer: Choice =
input()
Answer: Choice =
input()
Answer: Choice =
input()
209
(D) while Choice ==
Answer: Choice =
input()
range(monthDays):
print(days)
monthDays:
print(days)
range(len(monthDays)):
print(days)
211
(D) for days in
monthDays:
print(monthDays)
>>>str.isalnum()
213
What will be the output of the following command: Evaluating
>>>string.find("fox",9,34)
(A) 28
(B) 29
(C) 8
(D) 7
214
Raman is using string.isspace() in his command, Help him Applying
to choose the correct option.
>>>string=”Gagan Pandey”
>>>string.isspace( )
(C) Error
215
Kavita is using string.isdigit( ) in his command, Help him Understanding
to choose the correct option.
>>>string=”saregamapadhanisa”
>>>string.lstrip(“tears”)
(A) “regamapadhanisa”
(B) “Saregamapadhanisa”
(C) “gamapadhanisa”
(D) “gamapadhanisa”
217
Find the length of the following string using len( ) : Applying
(A) 14
(B) 15
(C) 16
(D) 17
218
Which one is the correct way of finding length of string Understanding
in python:-
(A) >>> “python”.len( )
(B) >>> length=“python”.len( )
(C) >>>len(“python”)
(D) >>>length(“python”)
219
Function “string.islower()” is used to :- Understanding
(A) To find the first lower case character in the string
(B) To check whether string is in lower case of not
(C) To convert the string into lower case.
(D) Display the strings lowercase character only
220
String function rstrip( ) matches from Understanding
(A) Left to right
(B) Both from right and left
(C) Right to left
(D) Matches from anywhere
221
What will be the output of the following Code: Understanding
(D) ERROR
222
The return type of string.split() is a Analysing
(A) string
(B) List
(C) Tuple
(D) Dictionary
223
Write the correct code for the following output:- Applying
Output: 'W$O$R$L$D'
(A) >>>str="$"
>>>str.join("WORLD")
(B) >>>str="$"
>>> join("WORLD",’$’)
>>> join("WORLD",’$’)
(D) >>>str="$"
>>> join("WORLD").str
224
The return type of x in the below code is Understanding
x = txt.partition("bananas")
(A) string
(B) List
(C) Tuple
(D) Dictionary
225
The number of element return from the partition function Analysing
is
226 Knowledge
Which of the following commands will create a list?
a) list1 = list()
b) list1 = []
b) [‘hello’].
c) [‘llo’].
d) [‘olleh’].
228 Knowledge
Suppose str1 is [‘h’,’e’,’l’,’l’,’o’], what is output of
len(str1)?
a) 5
b) 4
c) None
d) Error
229 Knowledge
Suppose list1 is [1, 5, 9], what is sum (list1) ?
a) 1
b) 9
c) 15
d) Error
230 Knowledge
Suppose list1 is [4, 2, 2, 4, 5, 2, 1, 0], Which of the
following is correct syntax for slicing operation?
a) print(list1[0])
b) print(list1[:2])
c) print(list1[:-2])
231 Knowledge
Suppose list1 is [2, 33, 222, 14, 25], What is list1[-1] ?
a) Error
b) None
c) 25
d) 2
232 Knowledge
Suppose list1 is [2, 33, 222, 14, 25], What is list1[:-1] ?
b) Error
c) 25
>>>print(names[-1][-1])
a) A
b) Daman
c) Error
d) n
234 Knowledge
Suppose list1 = [0.5 * x for x in range(0, 4)], list1 is :
a) [0, 1, 2, 3].
b) [0, 1, 2, 3, 4].
>>>list2 = [11, 2, 2]
a) True
b) False
c) Error
d) None
236 Knowledge
To add a new element to a list we use which command ?
a) list1.add(5)
b) list1.append(5)
c) list1.addLast(5)
d) list1.addEnd(5)
237 Knowledge
To insert 5 to the third position in list1, we use which
command ?
a) list1.insert(3, 5)
b) list1.insert(2, 5)
c) list1.add(3, 5)
d) list1.append(3, 5)
238 Knowledge
Suppose list1 is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after
list1.reverse() ?
239 Knowledge
What is the output when the following code is executed ?
>>>"Welcome to Python".split()
240 Knowledge
What is the output when following code is executed?
>>>list("a#b#c#d".split('#'))
b) [‘a b c d’].
c) [‘a#b#c#d’].
d) [‘abcd’].
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
ANSWER
Question No Answer
Q.No.1 C
Q.No.2 A
Q.No.3 B
Q.No.4 C
Q.No.5 B
Q.No.6 B
Q.No.7 C
Q.No.8 D
Q.No.9 A
Q.No.10 D
Q.No.11 B
Q.No.12 C
Q.No.13 B
Q.No.14 D
Q.No.15 C
16
Answer:- A
17
Answer:- D
18
Answer:- C
19
Answer:- C
20
Answer:- C
21
Answer:- A
22 Answer:- C
23 Answer:- C
24 Answer:- B
25 Answer:- B
26 Answer:- C
27 Answer:- A
28 Answer:- C
29
Answer:- B
30
Answer:- B
34 Cross-platform
35 Interpreter
Python shell
36
>>>
37
Error
38
23.0
39
150+300
40
Indentation
41
One
42
Not a case-sensitive
43
44 Source code
47 (A) eval
49 (B) in
50 (B)a**b
(C) 1989
52
(A) .py
53
(C) #
54
(D) class
55
(A) List
56
(B) //
57
(C) parenthesis
58
(D) abc
59
60 (B) 24
61
A
62
B
63
C
64
B
65
A
66
D
67 B
68 D
69 B
70 C
71 C
72 D
73 C
74
C
75
D
76 A
77 D
Explanation: int() will convert the float value into integer value.
78 D
79 D
80 C
C
81
A
82
B
83
C
84
85 B
86 A
87 B
88 D
89 C
90 C
91 C) not
b) or
92
b) 1.0,4.0
93
94 a) True False
95 42
96 a) Au
97 a)-
98 d) False
99 a)18
a) True
101
b)2
102
A) 2 12
103
c)-32
104
(B) 25
106
( C ) x**z
107
(B) (9/4)/2
108
109 (A)14
110 (B) ( )
113 (A ) 5 6
(C) Hello
116
World
(C) int(4.7)+3
117
(D) Error
118
(C) 12.4
120
121 b
122 c
123 a
124
b
125
b
126
d
127
c
128
a
129
d
130
b
131 b
132 a
133 b
134 a
135 c
136 (b)
137 (c)
138 (b)
139
(c)
140
(a)
141
(d)
142
(a)
143
(b)
144
(b)
145
(d)
146 (d)
147 (b)
148 (c)
149 (c)
150 (c)
151 D
152 A
153
A
154
B
155
B
156
A
157
B
158
A
159
A
160 D
161 A
162 C
163 B
164 A
165 A
166 (B) Directs the order of execution of the statements in the program
169
(A) if a>=9:
170
(B) if a==b:
171
(C) False
True
172
(B) The negative number -100 is not print here
It is always printed
173
(D) 3
174
(B) if ‘yes’ != ‘yes’:
182 B
183 D
184 A
185 B.
186 C
187 A
C
188
C
189
B
190
C
191
C
192
B
193
B
194
195 D
200 (B) 12
(C)
204
(C) 1 2 4 5 6
205
(A) 1 ## 1 2 ## 1 2 3 ## 1 2 3 4 ##
206
(C) 120
207
print(days)
211
(B)
212
(C)
213
(B)
214
(B)
215 (B)
216 (D)
217 (B)
218 (C)
219 (B)
220 (C)
221
(C)
222
(B)
223
(A)
224
(C)
225
(B)
a) 5
228
c) 15
229
c) 25
231
d) n
233
235 b) False
236
b) list1.append(5)
237
a) list1.insert(3, 5)
239
a) [“Welcome”, “to”, “Python”].
240
a) [‘a’, ‘b’, ‘c’, ‘d’].
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
E-mail ID – pal.avisek@gmail.com
Name of the Chapter- Python Revision Tour
Print (x)
22 Ans: 2.6
Evaluation
Reasoning (R) :
Tuple is immutable.
(a) Both A and R are
true and R is the
correct
explanation of A
(b) Both A and R are
true and R is not
the correct
explanation of A
(c) A is true , but R is
is false
(d) A is false , but R is
true
31 a=(1,2,3) Evaluation
a[0]=4
73. Assertion: When you open a file for writing, if the file Understanding
does not exist, an error occurs.
Reason: When you open a file for writing, if the file
exists, the existing file is overwritten with the new file.
for i in range(1,4):
for j in range (1,i+1):
print(j,end=’ ’)
print()
Assertion: output is
1
12
123
Reason: here, range function will generate value 1,2,3 in
the outer loop and the inner loop will run for each value
of “i” used in outer loop.
(A) Both Assertion and reason are true and reason is
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
82 Code to analyse: Analysis /
IF Application
True:
Print(103)
Assertion: for loop in Python makes the loop easy to Knowledge and
calculate factorial of a number application of for loop
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
A. list1.remove(“hello”)
B. list1.pop(list1.index('hello'))
C. both A and B
D. none of these
123 Q6. Which of the following command(s) will Understanding
create a list?
A. list1 = list()
B. list1 = []
C. list1 = list([1, 2, 3])
D. all of these
124 S1: Operator + concatenates one list to the end of another Understanding
list.
S2: Operator * is to multiply the elements inside the list.
Which option is correct?
A. S1 is correct, S2 is incorrect
B. S1 is incorrect, S2 is incorrect
C. S1 is incorrect, S2 is incorrect
D. S1 is incorrect, S2 is correct
a) Statement A is correct
b) Statement B is correct
c) Statement A is correct but Statement B is
not correct
ANSWER
Question No Answer
1 A
2 A
3 B
4 A
5 C
6 Answer:- A
7 Answer:- C
8 Answer:- B
9 Answer:- B
10 Answer:- D
11 Both Assertion and reason are true and reason is correct
explanation of assertion.
12 Both Assertion and reason are true and reason is correct
explanation of assertion.
13 Both Assertion and reason are True
14 Only Assertion is true reason is False
15 Both Assertion and reason are True
16 b
17
d
18
a
19 c
20
a
21 (A) Both A and R are true and R is the correct explanation of
assertion
26 (a)
27 (c)
28 (d)
29 (a)
30 (c)
31 A
32 C
33 A
34 D
35 A
(C)
Explanation : Data types are used to identify the type of data and
associated operations to handle it. Python has five standards data
types as number, Sequences, sets, None and Mapping
Q36
(A)
(A) Both Assertion and reason are true and reason is correct
Q54 explanation of assertion
Q55 (D) Assertion is false, reason is true.
(A) Both Assertion and reason are true and reason is correct
Q56 explanation of assertion.
(B) Assertion and reason both are true but reason is not the
Q57 correct explanation of assertion.
(A) Both Assertion and reason are true and reason is correct
Q58 explanation of assertion.
(A) Both Assertion and reason are true and reason is correct
Q59 explanation of assertion.
Q60 (D) Assertion is false, reason is true.
(B) Assertion and reason both are true but reason is not the correct
Q61 explanation of assertion.
(B) Assertion and reason both are true but reason is not the
Q62 correct explanation of assertion.
(A) Both Assertion and reason are true and reason is correct
Q63 explanation of assertion.
(A) Both Assertion and reason are true and reason is correct
Q64 explanation of assertion.
(A) Both Assertion and reason are true and reason is correct
Q65 explanation of assertion.
Q66 a
Q67 b
Q68 d
Q69 a
Q70 a
Q71 (D) Assertion is false, reason is true.
Q72 (C) Assertion is true, reason is false.
Q73 (D) Assertion is false, reason is true.
Q74 (C) Assertion is true, reason is false
(B) Assertion and reason both are true but reason is not the correct
Q75 explanation of assertion.
Q76 (B)
Q77 (A)
Q78 (A)
Q79 (C)
Q80 (D)
(A) Both Assertion and reason are true and reason is correct
Q81 explanation of assertion.
(A) Both Assertion and reason are true and reason is correct
Q82 explanation of assertion.
Q83 (C) Assertion is true, reason is false.
(A) Both Assertion and reason are true and reason is correct
Q84 explanation of assertion.
(A) Both Assertion and reason are true and reason is correct
Q85 explanation of assertion.
Q86 (A)
Q87 (B)
Q88 (D)
Q89 (A)
Q90 (C)
Q91 A
Q92 A
Q93 C
Q94 D
Q95 C
Q96 C
Q97 A
Q98 A
Q99 C
Q100 A
(A) Both Assertion and reason are true and reason is the correct
explanation of assertion.
Q102
(B) Assertion and reason both are true but reason is not the correct
explanation of assertion.
Q104
(B) Assertion and reason both are true but reason is not the correct
explanation of assertion
Q105
Q106 B
Q107 D
Q108 D
Q109 D
Q110 B
Q111 (D)
Q112 (A)
Q113 (C)
Q114 (A)
Q115 (D)
(B) Assertion and reason both are true but reason is not the correct
explanation of assertion.
Q116
Both Assertion and reason are true and reason is correct
Q117 explanation of assertion.
Q118 (C) Assertion is true, reason is false.
Q119 Assertion is false, reason is true.
(A) Both Assertion and reason are true and reason is correct
Q120 explanation of assertion.
Q121 C. Both Statement 1 and 2 are correct
Q122 A. S1 is correct, S2 is incorrect
Q123 C. Both Statement 1 and 2.
Q124 C. both A and B
Q125 D. all of these
Q126 (A)
Q127 (A)
Q128 (C)
Q129 (A)
Q130 (A)
Q131 b
Q132 a
Q133 b
Q134 c
Q135 c
E-mail ID - kamalkant.kv@gmail.com
Name of the Chapter- PYTHON REVISION TOUR
a. Code Editor
b. Code Interpreter
c. Debugger
d. All of the above
import_______________#1
7
num=int(input(“Enter a number: ”)) #2
sroot=math.sqrt(num) #3 Understand, Apply,
print(“Square root is…: ”, sroot) #4 Evaluate, Create
8 import_______________#1
print(random.randint(0,9)
11 Read the passage given below and answer the following Learning Objective
questions.
Rohini wants to calculate the average marks of n
students. She writes the code that is mentioned below.
Fill in the missing blanks so that the code gives the
desired output
n= (input()) #-------------------------------Statement
3
for i in range(0,n):
print("Enter marks of student",(i+1),":")
marks = int(input())
#append marks in the list
list1. (marks)
#--------------------------Statement 4
average = computeAverage(list1,n)
print("Average marks of",n,"students
is:",average)
i) Which of the following should be used to fill the blank Creation
in Statement 1
a) total
b) marks
c)list1
d)average
ii)Which of the following operators should be used to Creation
calculate the average in Statement 2
a) +
b) /
c) %
d) *
iii) Which of the following datatype should be used for Creation
typecasting the input in statement 3
a) string
b)int
c)list
d)tuple
iv) Which of the following functions must be used to Creation
insert a single value at the end of the list in statement 4
a) append()
b)extend()
c)insert
d)put()
12 Amit is trying to figure out the datatype of the variables
he used in his code that checks whether a number is
prime or not. The code is given below:
if num > 1 :
print(type(num>1))
#-----------------------------STATEMENT 4
for i in range(2, int(num / 2)):
if (num % i == 0):
flag = 1 #num is a not prime number
break #no need to check any further #presume
num is a prime number
if flag == 1:
print(num , msg1)
else:
print(num , msg2 )
i) What will be the output of STATEMENT 1 : Analysis
a) <class 'int'>
b) <class 'float'>
c) <class 'str'>
d) <class 'bool'>
if op=='+':
result= n1+n2
elif op=='-':
result=n1-n2
elif op=='*':
result=n1*n2
elif op==' ': # Statement 1i: operator to raise n1 to
the power n2
result = n1 n2 # Statement 1ii: operator to raise n1 to the
power n2
elif op==' ': # Statement 2i: operator to find floor
division
result=n1 n2 # Statement 2ii: operator to find floor
division
19 Karan wants to add 2 no.s and print the result. He has Creation
written the following code. As a programmer, help him
write the correct code:
X=input(“Enter the first number”) ) #S1
Y= int(input(“Enter the second number”)) #S2
Z=X+Y # S3
print(z) # S4
a) SyntazError
b) TypeError
c) ZeroDivisionErro
d) NameError
b Which type of Error will be raised in Statement 2? Evaluation
a) IndexError
b) IndentationError
c) TypeError
d) NameError
c Which type of Error will be raised in Statement 3? Evaluation
a) NameError
b) IndentationError
c) ZeroDivisionError
d) TypeError
d Which type of Error will be raised in Statement 3? Evaluation
a) NameError
b) SyntaxError
c) ZeroDivisionError
d) TypeError
26 Ramesh is learning Python in preparation for an Application
internship exam. He is having a problem with one
question in which she has been assigned an incomplete
Python code (given below) to create a CSV file called
‘Employee.csv.’ Assist her in completing the code that
generates the CSV file with the given content.
Incomplete Code:
#Statement 1
Csvfile = open( , , newline=’’)
#Statement 2
CsvObj = csv. (_________) #Statement 3
Rows = []
Fields = [‘Empnumber’, ‘EmpName’, ‘EmpDesig’,
‘EmpSalary’]
Rows.append(Fields)
for i in range(5):
Empno = input(“Enter Employee No:”)
Name = input(“Enter Employee Name:”)
Desig = input(“Enter Designation:”)
Salary = int(input(“Enter Salary:”))
records= [________________] #Statement 4
Rows. (_______) #Statement 5
________(Rows) #Statement 6
Csvfile.close()
statement i = 10
if (i > 15):
print("10 is less than 15")
print("I am Not in if")
find the correct output:
A) I am Not in if
B) 10 is less than 15
C) Both
D) None of them
30 # Explicit function Creation / Application
def digitSum(n):
dsum = 0
for ele in str(n):
dsum +=
int(ele)
return dsum
# Initializing list
List = [367, 111, 562, 945, 6726, 873]
31 Ramesh is looking for his dream job but has some Evaluation
restrictions. He loves Delhi and would take a job there if
he is paid over Rs. 40000 a month. He hates Chennai and
demands at least Rs. 100000 to work there. In any other
location he is willing to work for Rs. 60000 a month. The
following code shows his basic strategy for evaluating a
job offer.
Source code:
pay= …………
location= ………..
if location = = “Mumbai”:
print (“I will take it!”) #Statement1
elif location = = “Chennai”:
if pay < 100000:
print (“No way”) #Statement2
else:
print (“I am willing”) #Statement3
elif location = = “Delhi” and pay > 40000:
print (“I am happy to join”) #Statement4
elif pay > 60000:
print (“I accept the offer”) #Statement5
else:
print (“No thanks, I can find something better”)
#Statement6
On the basis of the above code, choose the right statement
which will be executed when different inputs for pay and
location are given:
1.1 If input: location=”Chennai” and pay=50000
(A) Statement1
(B) Statement2
(C) Statement3
(D) Statement4
1.2 If input: location=”Surat” and pay=50000
(A) Statement2
(B) Statement3
(C) Statement4
(D) Statement6
1.3 If input: location=”Any other city” and pay=10000
(A) Statement1
(B) Statement2
(C) Statement4
(D) Statement6
1.4 If input: location=”Delhi” and pay=500000
(A) Statement6
(B) Statement5
(C) Statement4
(D) Statement3
1.5 If input: location=”Lucknow” and pay=65000
(A) Statement2
(B) Statement3
(C) Statement4
(D) Statement5
32 Consider the following code segment for the questions Evaluation
2.1 – 2.5:
a=int(input(“Enter an integer:”))
b=int(input(“Enter an integer:”))
if a< = 0:
b=b + 1
else:
a=a + 1
if a > 0 and b > 0 :
print (“W”)
elif a > 0:
print (“X”)
if b > 0:
print (“Y”)
else:
print (“Z”)
2.1 What letters will be printed if the user enters 0 for a
and 0 for b?
(A) Only W
(B) Only X
(C) Only Y
(D) W and X
2.2 What letters wull be printed if the user enters 1 for a
and 1 for b?
(A) W and X
(B) W and Y
(C) X and Y
(D) X and Z
2.3 What letters will be printed if the user enters 1 for a
and -1 for b?
(A) W and X
(B) X and Y
(C) Y and Z
(D) X and Z
2.4 What letters will be printed if the user enters 1 for a
and 0 for b?
(A) W and X
(B) X and Y
(C) Y and Z
(D) X and Z
2.5 What letters will be printed if the user enters -1 for a
and -1 for b?
(A) Only W
(B) Only X
(C) Only Z
(D) No letters are printed
33 Read the passage given below and answer the Learning Objective
following questions……..
Anamika is a new programmer started writing python
program using continue statement.
if (x % 5 == 0) : continue
print(x)
A. range(10,21)
B. range(10,22)
C. range(10,22-2)
D. None
A. while
B. for
C. if
D. None
35 CASE A Understanding
Azriel wants to print a pyramid of stars.His friends &
Abhishek and Bhargav suggested him to use repetitive Application
control statement in the code.Finally he decides to use a
nested for loop to print the following pyramid of stars.
*
**
***
****
*****
The code which Azriel wrote is as follows:
36 CASE B Understanding
Arpita was asked by her Maths Teacher to make a &
program in python to find the factorial of a given Application
number.She asked her friends Vashaswati and Ritika
about factorial.Ritika explained her that factorial of a
number is the product of all integers from 1 to that
number.To which Vashaswati added that Factorial is only
defined for the positive numbers.F.E the factorial of 5 is
5*4*3*2*1=120.
Arpita finally wrote the code as follows:
num=int(int(“ENTER A NUMBER : “) #
statement 1
fact=1 #
statement 2
a=1 #
statement 3
while a<=num: #
statement 4
fact*= a #
statement 5
print(“The factorial is “,fact) #
statement 6
i If the 18th and 20th terms in the Fibonacci sequence are Understanding
1597 and 4181 respectively, what will be the 19th term?
(A) 1597
(B) 2584
(C) 4181
(D) 5778
ii Identify the suitable code for blank space in the line Evaluation
marked as Statement-1.
(A) 0
(B) n1
(C) nterms
(D) n2
iii Identify the suitable code for blank space in the line Analysis
marked as Statement-2.
(A) n1
(B) n2
(C) nterms
(D) nth
iv Identify the suitable code for blank space in the line Application
marked as Statement-3.
(A) n1
(B) n2
(C) nterms
(D) nth
38 In Physics class, during Mirror practicals students have
observed that some numbers written on papers have the
same mirror image whereas others have different.
Example:- number 1221 has mirror image 1221 whereas
number 1231 has mirror image 1321.
print("Not a palindrome!")
ii Identify the suitable code for blank space in the line Application
marked as Statement-1.
(A) number > 0
(B) number < 0
(C) reverse_num > 0
(D) reverse_num == 0
iii Identify the suitable code for blank space in the line Analysis
marked as Statement-2.
(A) 100
(B) 10
(C) 1
(D) 0
iv Identify the suitable code for blank space in the line Evaluation
marked as Statement-3.
(A) digit
(B) number
(C) temp
(D) None of the above
39 Consider the following case and write the code for the Analysis
same
//Fill in
the statement
A. print(s[(len(s) + 1) // 2:] +
s[:(len(s) + 1) // 2
B. print(s[(le
n(s) + 1)
// 2:]
C. (c)
s[:(le
n(s)
+ 1)
// 2
A. print(str1.count(' ') + 1)
B. print(str1.count(' ') )
C. print(str1.cnt(‘’))
D. print(str1.cnt(‘’)+1
Line=input(“Enter a line”)
Lower_count=upper_count=digit_count=alphabet_count=
0
for a in line:
if : #1-function to count the lower case
character
lower_count +=1
elif : #2-function to count number of
upper case
upper_count +=1 #character in the string
elif : #3- function to count digit in the
string
digit_count += 1
elif : #4 –Function to count alphabets in
the given string
alphabet_count += 1
(iii) my_tuple=('3','7','2','0')
Gap="buy"
print(Gap.join(my_tuple))
print(fun(data[0]))
#Stmt4
i The declaration of the LIST data is called Application
(i) Local (ii) Global(iii) local and global (iv) none of the
above
ii What will be printed after execution of the line #2 ? Application
(i) [1,2] (ii) [[1, 2], [3, 4]] (iii) [[5, 6], [7, 8]] (iv) [5,6]
iii What will be printed after execution of the line #3 ? Application
(i) 4 (ii) 5 (iii)2 (iv)1
iv What will be last line of the output after execution of the Application
line #4 ?
(i) 4 (ii) 5 (iii)2 (iv)1
v What will be the last line of the output of the above code, Application
if line #4 is replaced with print (fun (data (1)) ?
(i) 8 (ii) 5 (iii)2 (iv)1
44 Based on the following code answer the questions
given below
import_____________________#1
AR=[20,30,40,50,60,70]
START=random.randint(1,3)
END=random.randint(2,4)
for P in range(START, END+1):
print (AR[P],end=”#“)
i What module should be imported To execute the Application
above code #1?
(I) math (II) random (iii) pickle (iv) csv
ii What will Be the maximum value of the variables SATRT Application
and END?
(i) 3,4 (ii) 4,3 (iii) 2,4 (iv) 4,2
iii What will Be the minimum value of the variables START Application
and END?
(i) 2, 1 (ii) 1, 2 (iii) 1, 3 (iv) 1, 4
iv What possible outputs(s) are expected to be displayed on Application
screen at the time of execution of the program?
(i) 10#40#70# (ii) 30#40#50# (iii) 50#60#70# (iv)
40#50#70#
v What will be the output of print(AR[-2])? Application
(i) 30 (II) 40 (iii)50 (iv)
60
45 Read the passage given below and answer the following Learning
questions…….. Objective
.Ravi has made following list L1=[74,33,22,19,41,65]
L2=[20,40,60]
L1.extend(L2)
Print(L1)
46 Read the passage given below and answer the following Learning
questions…….. Objective
l1=['ab','cd']
for i in l1:
l1.append(i)
print(i)
A. 2
B. -2
C. 1
D. -1
52 Suresh is writing a function that returns multiple values
which should be immutable as they will be used as key
for dictionary. Suggest suresh, which kind of data
structure be used in this condition. Select the correct
answer from the option given below
A. List
B. Tuple
C. Stack
D. Dictionary
53 Mohan wants to store name, rollno and address of his 5 Knowledge
friends and he wants to update their details time to time Understanding
which one of the following is most appropriate one: Analysis
a. Tuple
b. List
c. String
d. Dictionary
54 If Mohan stores record in dictionary then he will use Knowledge
which function for retrieving the name Understanding
a. display( ) Analysis
b. print( )
c. get( )
d. set( )
55 Richa is working with a program where she gave some Knowledge
values to the function. She doesn’t know the term to
relate these values. Help her by selecting the correct
option.
a) function value
b) arguments or parameters
c) return values
d) function call
a) function header
b) function body
c) return statement
d) parameters
ANSWER
CBQ NO Answer
Q.No.1 (a) D
Q.No.1 (b) A
Q.No 2 (a) Answer:- print("This is My school")
Q.No 2 (b) Answer:- print("This is My\\ school")
Q.No.3
a) a. “Good Morning”
b) b.print
c) d.Error
d) b.Line-1 and Line-2
Q.No.4
a) c.greet1,greet2
b) a.name1,name2
c) b.case sensitive
d) d. Line4
QNo. 5 (i) a
(ii) c
(iii) d
(iv) d
Q No. 6 d
QNo.7 (A) (i) math (B) (ii) 8.0
QNO.11 i) C
ii) B
iii) B
iv) A
QNO. 12 i) A
ii) A
iii) C
iv) D
Q.No.13 Answer
I. List
Explanation : if we store the names of students of a
class in a list, then it is easy to update the list when
some new students join or some leave the course.
II. Dictionary
Explanation : If our data is being constantly modified
or we need a fast lookup based on a custom key or we
need a logical association between the key : value pair,
it is advised to use dictionaries
III. Sets
Explanation : When we need uniqueness of elements
and to avoid duplicacy it is preferable to use sets.
IV. Tuple
Explanation: Tuples are used when we do not need any
change in the data
Q.NO. 14 Boolean
QNo. 24 a) a
b) c
c) a
d) b
QNo. 25 a) a
b) d
c) d
d) b
QNo.26 a) (D) import csv
b) (C) “Employee.csv”, ’w’
c (D) writer(Csvfile)
d (A) Empno, Name, Desig, Salary
e (C) append(records)
f (D) CsvObj.writerows()
QNo. 27 a (A) pickle 51
b (B) open ‘wb’
c (C) dump(records,file)
d (D) pickle.load(f)
e (C) total_Amt+=R[4]
f (B) except
QNo. 28 1) (a)
2) (a)
Q.No. 29 A
Q.No. 30 C
QNo.31 1 (B) Statement2
2 (D) Statement6
3 (D) Statement6
4 (C) Statement4
5 (D) Statement5
QNo. 32 1 (C) Only Y
2 (B) W and Y
3 (D) X and Z
4 (D) X and Z
5 (C) Only Z
QNo.33 A
QNo.34 B
QNo. 35
1 2
2 1
3 1
4 2
Q.No 36
1 d
2 a
3 b
4 c
QNo.37 1
(B) 2584
2
(C) nterms
3
(B) n2
4
(D) nth
Q38. 1
(D) 1233443221
2
(A) number > 0
3
(B) 10
4
(C) temp
QNo. 39 A
QNo. 40 A
QNo. 41 (i) a.islower()
(ii) a.isupper()
(iii) a.isdigit()
(iv)a.isalpha()
iii (iv)1
iv (i) 4
v (i) 8
QNo. 44 (II) random
i (i) 3,4
ii (ii) 1, 2
iii (ii) 30#40#50#
iv (iv) 60
Q.No.45 (C)
Q.No.46 (D)
Q. No 47
QNo. 48
QNo. 49 B.T1[-1]
QNo. 50 C.L.remove(3)
Q.No.51 B
Q.No.52 B
Q.No 53 d
Q.No. 54 c
Q.No.55 b. arguments or parameters
Q.No.56 a. function header
E-mail ID - kamalkant.kv@gmail.com
Name of the Chapter- PYTHON REVISION TOUR
Q4 language.
Q8 input(T/F)
Python was named after famous BBC comedy show
Q18
The following python statements evaluates to
>>> x = 5
>>> y = x**2//5
Q19 >>> id(x) == id(y)
Write the output of following code:
>>> n1 = 5
>>> n2 = n1
Q20 >>> n2 is n1
Python is an open source, high level language
(A) True Knowledge
(B) False
Q21
Interactive mode is used when a user wants to run a single Knowledge, Apply
line or one block of code.
(A) True
(B) False
Q24
Script mode is used when the user is working with more Knowledge, Apply
than one single code or a block of code.
(A) True
(B) False
Q25
Q26 The data type of 55/5 is an integer.
Q27 The data type of 55//5 + 55 is an integer.
Q28 The data type of 55%5 is an integer.
Q29 The tuples are only immutable sequences in Python
Q36
List data structure is mutable. Understanding
A. True
B. False
Q37
In Python, a variable may be assigned a value of one type, Understanding
and then later assigned a value of a different type:
A. False
B. True
Q38
In Python, a variable must be declared before it is Knowledge
assigned a value:
A. True
B. False
Q39
Variable names can be of any length. Knowledge
A. True
B. False
Q40
the complement operator inverts the value of each bit of the
Q41 operand
immutable Types in Python mean that their values cannot be
changed in place
Q42
Q43 OR ,AND ,// is logical operators ?
Relational operator compare the value of their operand.
Q44
Q45 print( int(6>7-6-7*4) ) will print boolean value
Logical operator not has highest precedence among all the Knowledge
logical operators:
A) True
Q46 B) False
Expression ‘Ab’+2 will result into ‘Ab2’ Analysis
A) True
Q47 B) False
“is” is a membership operator in python Knowledge
A) True
Q48 B) False
Following code will produce True as output: Evaluation
x=10>5>1 and -3<-2<-1
print(x)
A) True
Q49 B)False
‘in’ and ‘not in” are membership operators available in python Knowledge
A) True
Q50 B) False
Q51 The expression str(b) implies that b is converted to string Knowledge
The value of expression 3/5*(7-2) and 3/(5*(7-2)) is Evaluation
Q52 same.
Q53 The expression 4**3**2 is evaluated as (4**3)**2 Understanding
The type casting where user intervention is needed is Knowledge
Q54 explicit type casting.
Q55 () have higher precedence that any other operator. Knowledge
A identifier is the name of any program related object Knowledge
such as variable , function, module, package etc. (True /
Q56 False)
print() always inserts a newline after each output. (True / Understanding
Q57 False)
The + operator (Addition) will always evaluate before * Knowledge
Q58 operator (multiplication). (True / False)
The associativity of operators is either left to right or right Evaluation
Q59 to left.(True / False)
Proper indentation is not necessary in python programs.
Q60 (True / False)
Syntax errors are detected when we have not followed the Knowledge
rules of the particular programming language while
writing a program.
a) Ture
Q61 b) False
Even if a statement or expression is syntactically correct, Knowledge
there might arise an error during its execution.
a) True
Q62 b) False
When syntax error is encountered, Python displays the Knowledge
name of the error and a small description about the error.
a) True
Q63 b) False
The execution of the program will start even there is Knowledge
syntax error.
a) True
Q64 b) False
When an error is encountered in a program, Python Knowledge
interpreter raises or throws an exception.
a) True
Q65 b) False
A relative path always begins with root folder Knowledge
(A) True
Q66 (B) False
readlines() reads the entire file at a time Understanding
(A) True
Q67 (B) False
‘with’ statement ensures that all the resources allocated to Understanding
the file objects get deallocated automatically
(A) True
(B) False
Q68
A binary file stores information in ASCII or Unicode Knowledge
Q69 character
(A) True
(B) False
Opening a file in write mode erases the previous data. Knowledge
(A)True
Q70 (B)False
An if-else statement has less number of conditional Knowledge
checks than Evaluation
A for loop can contain another for loop in it. Knowledge and
application of while
Q88 loop
a) False
b) True
Q94
Tell whether the statement is True or False : analysis
If the variable is initialized and is not increased or
decreased inside the loop ,then an INFINITE LOOP will
occur.The condition of the loops depends upon the
variable.
a) True
b) False
Q95
The statements within the body of the for loop are Understanding
executed till the range of values is exhausted.
Q96
for loop can not be used to iterate through the elements of Knowledge
strings.
Q97
a. True
b. False
Q101
String traversal can be done using ‘for’ loop only.(T/F) Knowledge
a. True
b. False
Q102
Strings have both positive and negative indexes. Knowledge
a. True
b. False
Q103
The find() and index() are similar functions. Understanding
a. True
b. False
Q104
String is mutable data type. Knowledge
a. True
b. False
Q105
Q107
Backward indexing in string starts from Zero. [True / Applying
False]
Q108
The Python strip() method removes any spaces or Applying
specified characters at the start and end of a string. [True /
False]
Q109
The startswith() string method checks whether a string Understanding
L1 = [1, 5, 9]
L2 = [2, 3, 4]
print(L1 + L1)
Q127 print(L1 * 2)
Q128 We can concatenate only two list at one time.
sort () function Sorts the elements of the given
Q129 list in-place(T/F)
The output of the following code would be:
L1 = [1, 2, 3]
L2 = [1, 2, 3, 4, 5, 6]
print(L1 in L2)
Q130
What is returned when the following code is run? Understanding
def tuple_comparison(tup1, tup2):
return tup1 < tup2
tup1 = (66, 4, 17, 4)
tup2 = (66, 4, 16, 5)
tuple_comparison(tup1, tup2)
A. True
Q131 B. False
True or False? A python tuple can be created without Knowledge
using any parentheses.
A. True
B. False
Q132
Whether Tuple_name[start:stop:step] is a correct syntax Knowledge
for tuple slicing?
A. True
Q133 B. False
True or False? ‘sorted()’ function cannot be used to sort a Knowledge
tuple element.
A.True
Q134 B.False
True or False? index() function finds the first index of a Knowledge
given item and returns the index.
A.True
Q135 F.False
Q136 tuples allowed to have mixed lengths
Q137 tuple have one element
Q138 We can make an empty tuple.
Q139 We Can concatenate tuples.
Q140 Tuples Are Mutable And Use More Memory Than Lists
Tuple data structure is mutable. Remembering and
A. True Understanding
Q141 B. False
The elements of the of a tuple can be deleted Remembering and
A. True Understanding
Q142 B. False
A tuple storing other tuples is called as nested tuple Remembering and
A. True Understanding
Q143 B. False
The + Operator adds one tuple to the end of another tuple Analysing, Evaluating
A. True and Creating
Q144 B. False
A tuple can only have positive indexing. Analysing, Evaluating
A. True and Creating
Q145 B. False
What will be the output of the following Python code snippet? Knowledge
d = {"john":40, "peter":45} Understanding
"john" in d Application
a) True
Q146 b) False
Dictionary values are immutable Knowledge
a) True Understanding
Q147 b) False
List can be converted in Dictionary Knowledge
Q148 a) True Understanding
b) False
It is always not necessary to enclose dictionary in { }. Knowledge
a. True Understanding
Q149 b. False
Dictionary keys are unique and always of string type Knowledge
a. True Understanding
Q150 b. False
A file containing a set of functions you want to include in Knowledge
your application is called a Module.
a. True
b. False
Q151
ord(65) will result into error. Evaluation
a. True
b. False
Q152
len(hello\n world’) will result into 13 Evaluation
a. True
b. False
Q153
Output of expression min(max(False,-3,-4),2,7) is false Evaluation
a. True
b. False
Q154
A function always returns a value Knowledge
a. True
b. False
Q155
Any folder with .py files is designated as Python
Q156 Package- TRUE/FALSE
By using import module anything in the current
Q157 namespace can be imported.- TRUE/FALSE
The file extension for a python program and python
Q158 module is same.- TRUE/FALSE
A package is a file that contains subpackages and