0% found this document useful (0 votes)
39 views4 pages

QSN 1

The document contains a set of Python programming questions for a Class XII semester exam, covering topics such as output prediction, data types, operator precedence, and string manipulation. Each question presents multiple-choice answers related to Python code snippets and concepts. The questions assess the understanding of Python syntax and behavior.

Uploaded by

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

QSN 1

The document contains a set of Python programming questions for a Class XII semester exam, covering topics such as output prediction, data types, operator precedence, and string manipulation. Each question presents multiple-choice answers related to Python code snippets and concepts. The questions assess the understanding of Python syntax and behavior.

Uploaded by

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

Python – WBCHSE – Semester-III – Class XII – Set-I

1. What will be the output of the following Python code?


i=1
while True:
if i%3 == 0:
break
print(i)
i+=1
a) 1 2 3
b) SyntaxError
c) 1 2
d) none of the mentioned

2. What is the order of precedence in python?


a) Exponential, Parentheses, Multiplication, Division, Addition, Subtraction
b) Exponential, Parentheses, Division, Multiplication, Addition, Subtraction
c) Parentheses, Exponential, Multiplication, Addition, Division, Subtraction
d) Parentheses, Exponential, Multiplication, Division, Addition, Subtraction

3. What will be the output of the following Python code snippet if x=1?
x<<2
a) 4
b) 2
c) 1
d) 8

4. What will be the output of the following Python function?


print(min(max(False,-3,-4), 2,7))
a) -4
b) -3
c) 2
d) False

5. Which of the following is not a core data type in Python programming?


a) Tuples
b) Lists
c) Class
d) Dictionary

6. What will be the output of the following Python expression if x=56.236? print("%.2f"%x)
a) 56.236
b) 56.23
c) 56.0000
d) 56.24

7. What will be the output of the following Python function? print(len(["hello",2, 4, 6]))
a) Error
b) 6
c) 4
d) 3
8. What will be the output of the following Python program?
def foo(x):
x[0] = ['def']
x[1] = ['abc']
return id(x)
q = ['abc', 'def']
print(id(q) == foo(q))

a) Error
b) None
c) False
d) True

9. What arithmetic operators cannot be used with strings in Python?


a) *
b) –
c) +
d) All of the mentioned

10. What will be the output of the following Python program?


i=0
while i < 5:
print(i)
i += 1
if i == 3:
break
else:
print(0)

a) Error
b)
0
1
2
3
0
c)
0
1
2
d) none of the mentioned

11. What will be the output of the following Python code?


x = 'abcd'
for i in range(len(x)):
print(i)
a) Error
b) 1 2 3 4
c) a b c d
d) 0 1 2 3
12. What will be the output of the following Python code snippet?
z=set('abc$de')
print('a' in z)
a) Error
b) True
c) False
d) No output

13. What will be the output of the following Python expression?


print(round(4.576))
a) 4
b) 4.6
c) 5
d) 4.5

14. Evaluate the expression given below if A = 16 and B = 15.


A % B // A
a) 0.0
b) 0
c) 1.0
d) 1

15. What will be the value of x in the following Python expression?


x = int(43.55+2/2)
print(x)
a) 43
b) 44
c) 22
d) 23

16. What is the value of the following expression?


(2+4.00, 2**4.0)
a) (6.0, 16.0)
b) (6.00, 16.00)
c) (6, 16)
d) (6.00, 16.0)

17. What will be the output of the following Python code?


for i in range(10):
if i == 5:
break
else:
print(i)
else:
print("Here")
a)
0
1
2
3
4
Here
b)
0
1
2
3
4
5
Here
c)
0
1
2
3
4
d) Error

18. What will be the output of the following Python code?


x = (i for i in range(3))
for i in x:
print(i)
for i in x:
print(i)
a) 0
1
2
b) error
c) 0
1
2
0
1
2
d) none of the mentioned

19. What will be the output of the following Python code?


string = "my name is x"
for i in string:
print (i, end=", ")
a) m, y, , n, a, m, e, , i, s, , x,
b) m, y, , n, a, m, e, , i, s, , x
c) my, name, is, x,
d) error

20. What will be the output of the following Python code?


X=345
print(“%06d”%X)
a) 345000
b) 000345
c) 000000345
d) 345000000

You might also like