Xii CS W1 - Python Revision Tour 1 - 2

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

SRI NACHAMMAL VIDYAVANI SENIOR SECONDARY SCHOOL

Devarayampalayam Bye-pass Road


Avinashi – 641654.

XII - Computer Science with Python

WORKSHEET - 1

Topics: Python Revision Tour (Chapter -1 & 2)

1 “Welcome‟ is literals
2 $ symbol can be used in naming an identifier (True/False)
3 Write any 2 data types available in Python
4 “Division by zero‟ is an example of error.
5 range(1,10) will return values in the range of to
6 randint(1,10) will return values in the range of to
“Computer Science”[0:6] =
“Computer Science”[3:10] =
7
“Computer Science”[::-1] =
“Computer Science”[-8:]=
8 Output of : print(“Ok”*4 + “Done”)
9 Output of : print(print(“Why?”))

Raj was working on application where he wanted to divide the


two number (A and B) , he has written the expression as C =
10 A/B, on execution he entered 30 and 7 and expected answer was 4
i.e. only integer part not in decimal, but the answer was 4.285
approx, help Raj to correct his expression and achieving the
desired output.
Correct Expression :
Which of the following is a valid arithmetic operators in Python
11 (i) // (ii) ? (iii) < (iv) and
Which of the following operator(s) are valid logical operators
12 (i) Like (ii) and (iii) or (iv) is
What will be the output of following expressions:
13 (i) 7/2 (ii) 7//2
If given A=20, B=15, C=30, What will be the output of
14 following expression: print((A>B) and (B>C) or (C>A))
What will be the output of following expressions:
15 (i) 15//2 (ii) 15%2
What will be the output of following expression:
16 2**2**4

Write the type of tokens from the following


17 (i) If (ii) roll_no
Identify the valid identifier(s) from the given list:
18 Marks1, $Roll, Avg Marks, IF, _sales2008, while, name
Identify the invalid identifiers from the given list:
19 Average, RegNo. , break, Sales_Q1
Write the datatype of following literals:
20 (i) 100 (ii) False
Write the datatype of following literals:
21 (i) 50.7 (ii) “India”
What will be the output of following code:
22 print(print(10))

Part – 2 (19 x 2 = 38)


23 Write 2 advantages and disadvantages of Python programming
language

24 Identify the valid and Invalid identifiers names:


Emp-Code, _bonus, While, SrNo. , for, #count, Emp1, 123Go, Bond007
25 Identify the type of literals for each:
(i) 123
(ii) “Hello‟
(iii) “Bye\nSee You‟
(iv) “A‟
(v) (v)345.55
(vi) 10+4j
(vii) 0x12
26 What is the size of each string?
(i) „Python‟
(ii) „Learning@\nCS‟
(iii) „\table‟
Output of :
27 (i) True + True =
(ii) 100 + False =
(iii) -1 + True =
(iv) bool(-1 + True) =
28 Output of
(i) 2 * 7 =
(ii) 2 ** 7 =
(iii) 2**2**3 =
(iv) 17 % 20 =
(v) not(20>6) or (19>7) and (20==20) =

Output of :
29 a,b,c =
20,40,60 b+=10
c+=b
print(a,b,c)
30 Write a program to enter 2 number and find sum and product
Write a program to enter temperature in Fahrenheit and convert it
31
in Celsius
32 Fill in the blanks to execute loop from 10 to 100 and 10 to 1
(i)for i in range( ): print(i)

(ii)for i in range( ):
print(i)
33 Name the Python Library module which need to be imported to invoke the
following function:
(i) floor() (ii) bar() (iii) randint() (iv) sin()
(v) linspace() (vi) connect() (vii) dump()
(viii) insort()

34 Rewrite the following code in python after removing all syntax


error(s). Underline each correction done in the code.
30=To
for K in range(0,To):
if k%4==0:
print (K*4)
else:
print (K+3)
35 for Name in [Ramesh,Suraj,Priya] :
if Name[0]='S':
print(Name)
36 Rewrite the following code in python after removing all syntax
error(s). Underline each correction done in the code:
a=b=10
c=a+b
while c=<20:
print(c,END="*")
c+=10
37 Find and write the output of the following python code:
msg = "Technology 2025"
print(msg[3:])
print(msg[:4],msg[4:])
print(msg[::-1])
print(msg[0:4],msg[11:10])
38 Find and write the output of the following python code:
P=6
Q=5
while P<=25:
Q+=10
P+=5
print(P)
print(Q)
39 Find and write the output of the following python code:

for i in range(1,6):
for j in range(1,6):
if i==j:
break
print(j, end='')
print()

You might also like