Holiday Home Work
Holiday Home Work
1 State True or False: “In a Python program, if a break statement is given in a nested loop, it terminates 1
the execution of all loops in one go.”
2 Which of the following will delete key-value pair for key = “Name” from a dictionary D1? 1
a. delete D1("Name") b. del D1["Name"] c. del.D1["Name"] d. D1.del["Name"]
3 Consider the statements given below and then choose the correct output from the given options: 1
pride="#G20 Presidency"
print(pride[2:14:2])
Options: (a) 2 ndsr (b) 2 ceieP0 (c) 0 ceieP (d) 2 rsdn
4 Which of the following statement(s) would give an error during execution of the following code? 1
Why
tup = (20,30,40,50,80,79)
print(tup) #Statement 1
print(tup[3]+50) #Statement 2
print(max(tup)) #Statement 3
tup[4]=80 #Statement 4
Options: a. Statement 1 b. Statement 2 c. Statement 3 d. Statement 4
5 Consider the code given below: 1
X=50
Y=0
def check(Y):
_________ # missing statement
X=Y+X
check(30)
print(X,Y)
Which of the following statements should be given in the blank for #Missing Statement,
if the output produced is (80,0)
options :
(a) global Y (b) global X=50 (c) global X (d) global Y=-30
Q 6and 7 are ASSERTION AND REASONING based questions. Mark the correct choice as
(a) Both A and R are true and R is the correct explanation for A
(b)Both A and R are true and R is not the correct explanation for A
(c) A is True but R is False
(d)A is false but R is True
6 Assertion(A): List is an immutable data type 1
Reasoning(R): When an attempt is made to update the value of an immutable variable, the old
variable is destroyed and a new variable is created by the same name in memory.
7 Assertion(A): Python Standard Library consists of various modules 1
Reasoning(R): A function in a module is used to simplify the code and avoids repetition.
8 What will be the output of the following code: 1
Color = ‘Color helps to give shadow to the picture’
newcolor = Color.replace(‘o’,’#’)
print(newcolor)
9 Which of following expression(s) is an example of type casting 1
(a) 4.0 +float(6) (b)5.3 +6.3 (c) 5.0 +3 (d) int(3.1) +7
10 The code given below accepts a number as an argument and returns the reverse number. Observe the 1
following code carefully and rewrite it after removing all syntax and logical errors. Underline all the
corrections made.
11 2
14 2
15 2