Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
52 views5 pages

Python Class 11 Test Gen 001

The document contains a series of questions and code snippets related to Python programming, covering topics such as variable naming, output generation from code, and identification of keywords and data types. Each question is designed to test the understanding of Python syntax and logic. The document appears to be a test or quiz format for evaluating knowledge in Python programming.

Uploaded by

tutor nag
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views5 pages

Python Class 11 Test Gen 001

The document contains a series of questions and code snippets related to Python programming, covering topics such as variable naming, output generation from code, and identification of keywords and data types. Each question is designed to test the understanding of Python syntax and logic. The document appears to be a test or quiz format for evaluating knowledge in Python programming.

Uploaded by

tutor nag
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Roll No : Time -

Date : MM : 22

1. Single line comment entry can be given by:


(a) //
(b) $ 1
(c) #
(d) “

2. Write the output of:


x=5;
y = 10;
x += 2*y;
print(“x=”,x, “and y=”,y) 1
(a) x=10 and y= 25
(b) x=25 and y= 25
(c) x=25 and y= 10
(d) x=15 and y= 10

3. Find the output generated by the following code: 1


(a) x=2
y=3
x+=y
print(x,y)
(b) x=8
y=2
x+=y
y-=x
print(x,y)
(c) a=5
b=10
a+=a+b
b*=a+b
print(a,b)
(d) p=10
q=20
p*=q//3
q+=p+q**2
print(p,q)
(e) p=5/2
q=p*4
r=p+q
p+=p+q+r
r+=p+q+r
q-=p+q*r
print(p,q,r)
(f) p=2/5
q=p*4
r=p*q
p+=p+q-r
r*=p-q+r
q+=p+q
print(p,q,r)

4. How many times the given loops will be excecuted:

5. Find the output of the following code:

6. What will be the output for the following Python statements? [CBSE 2021] 1
D=("AMIT" : 90, "RESHMA":96, "SUKHBIR":92, "JOHN":95)
print("JOHN" in D, 90 in D, sep = "#")
(a) True#False
(b) True#True
(c) False#True
(d) False#False

7. Identify the output of the following Python statements: [CBSE 2021]


D={}
T=("ZEESHAN", "NISHANT", "GURMEET", "LISA")
for i in range (1, 5):
D[i]=T[i–1]
1
print(D)
(a) {"ZEESHAN", "NISHANT", "GURMEET", "LISA"}
(b) "ZEESHAN", "NISHANT", "GURMEET", "LISA"
(c) {[1,"ZEESHAN"], [2, "NISHANT"], [3,"GURMEET"], [4,"LISA"]}
(d) {1,"ZEESHAN", 2, "NISHANT", 3,"GURMEET", 4,"LISA"}

8. Which of the following is not a valid variable name in Python. Justify reason for
it not being a valid name: [CBSE 2021 (C)]
(a) 5Radius
1
(b) Radius_
(c) _Radius
(d) Radius

9. Which of the following are keywords in Python: [CBSE 2021 (C)]


(a) break
(b) check 1
(c) range
(d) while

10. Write the names of the immutable data objects from the following: [CBSE
2021 (C)]
(a) List
(b) Tuple 1
(c) String
(d) Dictionary

11. Consider the given expression : 1


57 or not 7>4
Which of the following will be the correct output, if the given expression· is
evalutated? [CBSE 2023]
(a) True
(b) False
(c) NONE
(d) NULL

12. Which of the following operators will return either True or false? [CBSE 2023]
(i) +=
(ii) != 1
(iii) =
(iv) *=

13. Rewrite the following code in python after removing all syntax error(s).
Underline each correction done in the code.
input(‘Enter a word’,W)
if W = ‘Hello’ 1
print(‘Ok’)
else:
print(‘Not Ok’)

14. What possible outputs(s) are expected to be displayed on screen at the time
of execution of the program from the following code? Also specify the
maximum values that can be assigned to each of the variables BEGIN and 3
LAST.

15. Based on the following python code, find out the expected correct output(s)
from the options (i) to (iv)
import random
lst=["Red","Blue","Green","Yellow"]
for i in range(5,2,-1):
print(lst[random.randint(1,2)],end="%") 3
(i) Blue%Green%Green%
(ii) Blue%Red%Green%
(iii) Blue%Green%Yellow%
(iv) Blue%Blue%Red%

16. Based on the following python code, find out the expected correct output(s) 3
from the options (i) to (iv)
tup=("Red","Blue","Green","Yellow")
for i in range(3):
print(tup[random.randrange(1,4,2)],end="#")
(i) Blue#Blue#Yellow#
(ii) Red#Green#Green#
(iii) Blue#Yellow#Green#
(iv) Blue#Green#Yellow#

You might also like