Assignment
1. State True or False:
“In a Python program, if a break statement is given in a nested loop, it terminates the execution of all loops in one
go.”
2. What will be the output of the following statement:
print(3-2**2**3+99/11)
a. 244 b. 244.0 c. -244.0 d. Error
3. Select the correct output of the code:
Options:
a. PYTHON-IS-Fun b. PYTHON-is-Fun c. Python-is-fun d. PYTHON-Is -Fun
4. Which of the following will delete key-value pair for key = “Red” from a dictionary D1?
a. delete D1("Red") b. del D1["Red"] c. del.D1["Red"] d. [Link]["Red"]
5. Consider the statements given below and then choose the correct output from the given options:
pride="#G20 Presidency"
print(pride[-[Link]-2])
Options a. ndsr b. ceieP0 c. ceieP d. yndsr
6. Which of the following statement(s) would give an error during execution of the following code?
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
7. What possible outputs(s) will be obtained when the following code is executed?
Options:
a. b. c. d.
RED* YELLOW* WHITE* WHITE* YELLOW*
WHITE* WHITE* YELLOW* YELLOW* WHITE*WHITE*
BLACK* BLACK* BLACK* BLACK* BLACK* BLACK* BLACK*
RED* RED* RED* RED* RED* RED* RED* RED*
RED*
8. Consider the code given below:
Which of the following statements should be given in the blank for #Missing Statement, if the output produced is
110?
Options: a. global a b. global b=100 c. global b d. global a=100
9. State whether the following statement is True or False:
An exception may be raised even if the program is syntactically correct.
Q10 and 11 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
10. Assertion(A): List is an immutable data type
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.
11. Assertion(A): Python standard library consists of number of modules.
Reasoning(R): A function in a module is used to simplify the code and avoids repetition.