Practice Paper - Objective - I)
Practice Paper - Objective - I)
24 of 25 points
Atharva Chauhan
Break
WHILE
Math
False
Correct answer
False
_____________ function joins a string or character after each member of the 1/1
string.
<str>.join(<string iterable>)
<str>.split(<string/char>)
_________ function replaces a word or part of the string with the another in 1/1
a given string
<str>.join(<string iterable>)
<str>.split(<string/char>)
False
none
non_local
return
Other:
Name
pass
none
address
Identify the invalid identifier out of the options given below 1/1
IF
Turn.over
Qwer_12
Play123
Identify the valid arithmetic operator in Python from the following- 1/1
And
>
**
Which of the following will be the correct output, if the given expression is
evaluated?
True
Null
False
None
>>> x = 125
>>> y = 13
>>> x // = y
>>> x
125/13
10
9.62
1+(3-4)*2**10//6
171
-170
-171
Given the following Tuple Tup (10, 20, 30, 50) 1/1
Tup.insert (2,3)
print(len (Tup))
my_func()
def my_func()
return my_func
call my_func()
A function is defined as below, the function call parameters can be: 1/1
def first(a,b=9):
print(a,” “, b)
Two tuples
Two numbers
One number
def testify(b,a):
return a-b
sum=testify(22,55)
print(sum+30)
63
-33
33
Which of the following statements should be given in the blank for 1/1
#Missing Statement, if the output produced is 110?
b=100
def test(a):
--------------------------- # missing statement
b=b+a
test(10)
print(b)
global b
global a
global a=100
global b=100
num=100
def showval(X):
global num
num = 85
if(X%2==0):
num += X
else:
num -= X
print(num,end="#")
showval(33)
print(num)
52#52
100#52
85#33
52#100
[0, 1, 2, 3, 4]
[0, 1, 2, 3]
[0, 1, 2]
[0, 1, 2, 3, 4, 5]
import random
AR=[20,30,40,50,60,70]
Lower=random.randint(1,3)
Upper=randm.randint(2,4)
print(AR[K], end=’#’)
30#40#50#
50#60#70#
10#40#70#
40#50#70#
sum ()
count ()
total ()
add ()
Class1 2 3
Class123
Error
Class 1
islower(str)
str.lower()
str.tolower()
lower(str)
number = 5
if number < 5:
number = number + 1
print(number)
What are the values of var1 and var2 that are printed when the following 1/1
code executes?
output = ""
var1 = -2
var2 = 0
while var1 != 0:
var1 = var1 + 1
var2 = var2 - 1
var1 = 0, var2 = -2
var1 = 0, var2 = -1
Consider the following code and answer the questions that follow:
Ramesh needs to change the title in the dictionary book from ‘Crime’ to 1/1
‘Crime Thriller’. He has written the following command:
Book[‘Crime’]=’Crime Thriller’
But he is not getting the answer. Help him choose the correct command:
Book[2]=(’Crime Thriller’)
Book[2]=’Crime Thriller’
Book[3]=’Crime Thriller’
print(list(Library))
[‘5’,’6’]
In Python, the else block after a try block executes only if no exceptions are 1/1
raised.
False
True
One of the following statements will raise error. Identify the statement that 1/1
will raise the error.
a=b=c=35
x,y=20
a,b=6,7*9
In Python, you can have multiple except blocks to handle different types of 1/1
exceptions.
True
False
Raises an AssertionError and prints “5 > 10”, followed by “Finally block executed”
When raising an exception using the raise statement, what is the minimum 1/1
requirement?
Including a traceback
Which of the following steps is NOT part of the exception handling 1/1
process?
E→D→A→C→B
E→D→B→C→A
A→B→C→D→E
E→D→C→A→B
KeyError
ValueError
IndexError
TypeMismatchError
i. There can be try block without catch block but vice versa is not possible.
iii. The object must be created of a specific class of which the error has
occurred otherwise runtime error will occur.
iv. To execute a code with each and every run of program, the code is
written in finally block.
i and ii, iv
ii and iv Only
Only ii
Only iii
Which of the following is true about the else block in Python exception 1/1
handling?
Correct answer
To handle exceptions
This form was created inside of Tagore International School. Report Abuse
Forms