You are on page 1of 3

Periodic Test - 2

Subject :Informatics Practices(065)


Class : XI

Name : Date: 29/01/2022


Roll No. : Marks: 50
__________________________________________________________________

I. Choose the correct answer: 10

1. An empty/null statement in Python is _____.


a. go b. pass c. over d. ;

2. Consider the loop given below:


for i in range (-5):
print(i)
How many times will this loop run?
a. 5 b. 0 c. infinite d. Error

3. Which of the following is not a valid loop in Python?


a. for b. while c. do-while d. if-else

4. Function range(3) will yield an iteratable sequence like ______.


a. [0, 1, 2] b. [0, 1, 2, 3] c. [1, 2, 3] d. [0, 2]

5. Which of the following is not an immutable type in Python?


a. String b. Tuples c. Set d. dictionary

6.In for a in ____ :, the blank can be filled with


a. an iterable sequence b. a range() function
c. a single value d. an expression

7. What is the value of the expression 100 // 25?


a. 4 b. 4.0 c. 2.5 d. none of these

8. In the Python statement x = a + 5 – b, a + 5 – b is _____.


a. Operands b. Expression c. operators d. Equation

9. The operator used to check if both the operands reference the same object
memory, is the ______ operator.
a. in b. is c. id d. ==

10. Which of the following if statements will not execute successfully?


a. if (1, 2): b. if (1, 2) c. if (1, 2): d. if (1):
print(„foo‟) print(„foo‟) print(„foo‟) print(„foo‟)

PT-2 EXAM _2021-22_XI_IP Page 1


II. Answer in short: (Any five) 10

1. What is a statement? What is the significance of an empty statement?


2. There are two types of else clauses in Python. What are these two types of else
clause.
3. What is nested list?Explain with the help of example.
4. What is the purpose of range() function? Give one example.
5. Differentiate between break and continue statements using examples.
6. What do you understand by the term „immutable‟?

III. Define the following: (Any five) 15

1. Empty Statement (Null Statement)


2. Compound Statement
3. Sequence
4. Repetition Iteration (Looping)
5. Jump Statement
6. Membership Operators

IV. Application based question: (Any five) 15

1. Rewrite the following code fragment that saves on the number of comparisons:
if (a == 0):
print (“Zero”)
if (a == 1):
print (“One”)
if (a == 2):
print (“Two”)
if (a == 3):
print (“Three”)

2. What is the error in following code? Correct the code:


weather = „raining‟
if weather = „sunny‟:
print (“wear sunblock”)
elif weather = “snow”:
print (“going skiing”)
else:
print (weather)

3. What is the output of the following lines of code?


if int („zero‟) == 0:
print (“zero”)
elifstr(0) == „zero‟ :
print (0)
elifstr(0) == „0‟:

PT-2 EXAM _2021-22_XI_IP Page 2


print (str(0))
else:
print (“none of the above”)

4. What is following code doing? What would it print for input as 3?


n = int (input(“Enter an integer :”))
if n < 1:
print (“invalid value”)
else:
for i in range (1, n + 1):
print (i * i)

5. What is the error in the following code?


s = “Anata won”
s[3] = “y”

6. Give the output of the following with reason:


Membership operator
- “jap” in “Japan”
- “123” in “12345”
Comparison operator
- “ABC” == “abc”
- “abc” != “Abc”

PT-2 EXAM _2021-22_XI_IP Page 3

You might also like