Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

ADHIYAMAN PUBLIC HR SEC SCHOOL, UTHANGARAI – 635207.

CLASS: 12 – CS(MATHS/CS) SUB CODE(083) MONTHLY EXAM MARK: 70MARKS


DATE: 26.12.2023 PYTHON REVISION TOUR 1 TIME : 03.00 Hours
---------------------------------------------------------------------------------------------------------------
General Instructions:

1. This question paper contains five sections, Sections A to E.


2. All questions are compulsory.
3. Section A has 18 questions carrying 01 mark each.
4. Section B has 07 Very Short Answer questions, carrying 02 marks each.
5. Section C has 05 Short Answer questions, carrying 03 marks each.
6. Section D has 03 Long Answer questions, carrying 05 marks each.
7. Section E has 02 questions carrying 04 marks each.
8. All programming questions are to be answered using Python Language only.

SECTION:A
Which of the following properly expresses the precedence of operators (using
parentheses) in
1 the following expression: 5*3 > 10 and 4+6==11 1
1.((5*3) > 10) and ((4+6) == 11) 2.(5*(3 > 10)) and (4 + (6 == 11))
3.((((5*3) > 10) and 4)+6) == 11 4.((5*3) > (10 and (4+6))) == 11
Based on the following code answer the questions (Follow Q,no2 to 6)
import ___________________ #1
AR=[20,30,40,50,60,70]
FROM=random.randint(1,3)
TO=random.randint(2,4)
2 1
for K in range(FROM,TO+1):
print (AR[K],end=”#“)
1. What module should be imported To execute the above code #1?
(i) math (ii) random (iii) pickle (iv) csv
What will Be the maximum value of the variables FROM and TO?
3 1
(i) 3,4 (ii) 4,3 (iii) 2,4 (iv) 4,2
What will Be the minimum value of the variables FROM and TO?
4 (i) 2, 1 (ii) 1, 2 (iii) 1, 3 (iv) 1, 4 1

What possible outputs(s) are expected to be displayed on screen at the time of


5 executionof the program? 1
(i) 10#40#70# (ii) 30#40#50# (iii) 50#60#70# (iv) 40#50#70#

What will be the output of random.random ( )


6 1
(i) 2 (ii) 3.2 (iii)0.82 (iv) -0.32
Which of the following symbol is used in Python for Multiline comments line
7 1
comment?
1. /*** 2. /* 3. „‟‟ 4. #

What is the type of inf?


8 1
a) Boolean b) Integer c) Float d) Complex
Which of the following is not a complex number?
9 1
a) k = 2 + 3j b) k = complex(2, 3) c) k = 2 + 3l d) k = 2 + 3J
What is the output of print 0.1 + 0.2 == 0.3?
10 1
a) True b) False c) Machine dependent d) Error
Select all options that print
hello-how-are-you
11 a) print(‘hello’, ‘how’, ‘are’, ‘you’) b) print(‘hello’, ‘how’, ‘are’, ‘you’ + ‘-‘ * 4) 1
c) print(‘hello-‘ + ‘how-are-you’)
d) print(‘hello’ + ‘-‘ + ‘how’ + ‘-‘ + ‘are’ + ‘you’)
Find the valid identifier from the following
12 1
1. 2_Myname 2. My name 3. True 4. Myname_2
What is the average value of the code that is executed below ?
>>>grade1 = 80
13 >>>grade2 = 90 1
>>>average = (grade1 + grade2) / 2
a) 85 b) 85.1 c) 95 d) 95.1
Which of the following operator can be used with string data type?
14 1. ** 2. % 3. + 4. / 1
= is known as Assignment Operator which is used to assign the ____________side value to
15 the_____________________ side operand. 1

16 ______________ operator is used for indentation. 1


17 The __________ statement prematurely ends the execution of the current while or for loop. 1
Relational Operator is:
18 (a) And (b) ! (c) < (d) === 1
SECTION:B
Fill in the blanks:
Tejas is writing the code for checking, even or odd of number help him by completing the blank :

19 2

a)What will be value of diff ? What output following program will produce
c1='A' v1='1'
20 c2='a' v2= 1
2
diff= ord(c1)-ord(c2) v3=v1==v2
print(diff)

Find output of following given program :


str1_ = "Aeiou"
str2_ = "Machine learning has no alternative"
21 for i in str1_: 2
if i not in str2_:
print(i,end='')
a)Find output for following given program
a=10
b=20
c=1
print(a !=b and not c)

22 b) identify one possible output of this code out of the following options: 2
from random import*
Low=randint(2,3)
High=randrange(5,7)
for N in range(Low,High):
print(N,end=' ')
(a) 3 4 5 (b) 2 3 (c) 4 5 (d) 3 4 5 6

What will the following code print?


for i in range(1,4):
23 for j in range(1,4): 2
print(i, j, end=' ')
Give the output of the following
for k in range(4):
for j in range(k):
print(‘*’, end = ‘ ‘)
print()
24 2
for k in range(5,0, -1):
for j in range(k):
print(‘*’, end=’ ‘)
print()
Give the output of the following
for x in range(1, 4):
for y in range(2, 5):
25 if x * y > 6: 2
break
print(x*y, end=“#”)

SECTION:C
a)What will be the output after the following statements?
x = 27
y=9
while x < 30 and y < 15:
x=x+1
y=y+1
print(x,y)

b)Given the nested if-else below, what will be the value x when the source code executed
successfully:

x=0
26 a=5 3
b=5
if a>0:
if b<0:
x=x+5
elif a>5:
x=x+4
else:
x=x+3
else:
x=x+2
print (x)
What will be the output of the following code:

27 3
(a) What will be the output of the above code?
(b) How many times the loop executed?

Choose the correct option.


(a) What is String data-type in Python?
(i) It is written in double quotes only. (ii) Its value can be changed.
(iii) It is enclosed in square brackets. (iv) It is immutable data-type.

(b) Ms. Ragini is confused on the way to compare the strings. Help her in choosing the
correctstatement.
(i) equal() (ii) equals() (iii) == (iv) compare()
28 3
(c) Tejas is confused in the output of the following code. Help him to choose the correct option.
age = 12
txt = "My name is Tejas, I am " , age
print(txt)
(i) ('My name is Tejas, I am ', 12) (ii) My name is Tejas, and I am 12
(iii) (My name is Tejas, I am , 12) (iv) [My name is Tejas, I am , 12]

1. Help mini to choose the correct output of the following Python code.
rollno = 3
name = "Mini"
Average = 88.76
Txt = "My name is {1}, having roll no {0} and scored {2} percent."
print(Txt.format(rollno, name, Average))
(i) My name is ‘Mini’, having roll no 3 and scored 88.76 percent.
(ii) My name is Mini, having roll no 3 and scored 88.76 percent.
(iii) ‘My name is Mini, having roll no 3 and scored 88.76 percent.’
29 (iv) (My name is Mini, having roll no 3 and scored 88.76 percent.) 3
2. Help Gurnika to choose the correct option for the following Python code.
b = "Hello, World!"
print(b[-5:2])
(i) Hello, World! (ii) orl (iii) Error (iv) No Output

3. What error occurs when you execute the following Python code snippet?
apple = mango
a) SyntaxError b) NameError c) ValueError d) TypeError

30 3

Write the output for the above code?


Section:D

31 Write the output for the following code: 5


(a) p=5/2 (b)p=2/5
q=p*4 q=p*4
r=p+q r=p*q
p+=p+q+r
32 r+=p+q+r
p+=p+q-r 5
q-=p+q*r r*=p-q+r
print(p,q,r) q+=p+q
print(p,q,r)
Evaluate the following expressions:
(i) (5 + 8) * 3 - 6 / 2
(ii) (2 + 3) * 5/4+(4 + 6)//2
33 (iii) 12 + (3 * 4 – 6) / 3 5
(iv) 12 + (3 **4 - 6)// 2
(v) 12 * 3 % 5 + 2 ** 6//4
(vi) 12 % 5 **3 +(2*6)//4
Section: E
How many times the given loops will be excecuted:

34 4

Find the output generated by the following code:


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

You might also like