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

Assignment - 1 Class 12 - Gargee - 2020-21

1) The document provides a Python revision assignment for Class XII students consisting of 20 questions covering topics like operators, data types, expressions, strings, comparisons, date calculations, and time conversions. 2) Students are asked to type their answers in a Word or Google Doc and email it to the provided address since markets are closed, and they are confined to their homes due to the COVID-19 outbreak. 3) A tutorial on using Google Docs is also provided to help students with submitting the assignment electronically.
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)
156 views4 pages

Assignment - 1 Class 12 - Gargee - 2020-21

1) The document provides a Python revision assignment for Class XII students consisting of 20 questions covering topics like operators, data types, expressions, strings, comparisons, date calculations, and time conversions. 2) Students are asked to type their answers in a Word or Google Doc and email it to the provided address since markets are closed, and they are confined to their homes due to the COVID-19 outbreak. 3) A tutorial on using Google Docs is also provided to help students with submitting the assignment electronically.
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

Class XII – Assignment – Computer Science (083)

Python Revision Tour – Chapter – 1


Good Morning dear students of class XII,
As we all are confined to our homes owing to the recent COVID-19 outbreak, our daily
work life and schedule seems to have come to a standstill these days. Classes have been
suspended for over one-two weeks now which would have a long-term effect in the
teaching-learning process.
St. Montfort School Computer Science department is very well aware of this fact. But
since, the situations are such, we have to find ways and means to cope up with them and
keep in touch with the academics as well.
Since, markets are closed except the necessary grocery supplies, hence instead of writing
them in your copy, you have to type the answers in an MS Word/Google docs document
and mail it to the following email address : [email protected]
Tutorial to use Google Docs –
https://www.youtube.com/watch?v=xJiUTXGv3PE
This assignment will be considered for assessment in the exams.
1. From the following, find out which assignment statement will produce an error.
State reason(s) too.
(a) 𝑥 = 55
(b) 𝑦 = 037
(c) 𝑧 = 0𝑜98
(d) 56𝑡ℎ𝑛𝑢𝑚𝑏𝑒𝑟 = 3300
(e) 𝑙𝑒𝑛𝑔𝑡ℎ = 450.17
(f) ! 𝑇𝑎𝑦𝑙𝑜𝑟 =′ 𝐼𝑛𝑠𝑡𝑎𝑛𝑡 ′
(g) 𝑡ℎ𝑖𝑠 𝑣𝑎𝑟𝑖𝑎𝑏𝑙𝑒 = 87. 𝐸02
(h) 𝑓𝑙𝑜𝑎𝑡 = .17𝐸 − 03
(i) 𝐹𝐿𝑂𝐴𝑇 = 0.17𝐸 − 03
2. Find out the error(s) in following code fragments :
(i)

a,b,c=2,8,9
print(a,b,c)
c,b,a=a,b,c
print(a,b,c)

(ii)
else = 21-5
3. What will be the output produced by following code
fragment(s) ?
first = 2
Page | 1
second = 3
third = first + second
print(first,second,third)
first=first+second+third
third = second + first
print(first,second,third)
4. What is the problem with the following code fragment?
a=3
s=a+10
a="New"
q=a/10
5. Predict the output :
x,y=20,60
y,x,y=x,y-10,x+10
print(x,y)
6. Consider the following code :
name = input("What is your name?")
print('Hi',name,',')
print("How are you doing?")

was intended to print output as

Hi <name>, How are you doing?

But it is printing the output as :

Hi <name>,
How are you doing?
7. What will be the output produced by the code :
(i) str(print())+"One"
(ii) str(print("hello"))+"One"
8. Write a short program that asks for your height in
centimetres and then converts your height to feet and
inches. (1 𝑓𝑜𝑜𝑡 = 12 𝑖𝑛𝑐ℎ𝑒𝑠, 1 𝑖𝑛𝑐ℎ = 2.54 𝑐𝑚)
9. Prepare a small cheat sheet showing the precedence of all
the python operators. (Refer to Chapter – Data Handling)
10. Write the following expressions in Python :
1 2
(i) 𝑏 ℎ
3
(ii) 𝑑 = √(𝑥2 − 𝑥1 )2 + (𝑦2 − 𝑦1 )2

Page | 2
−𝑥±√𝑏2 −4𝑎𝑐
(iii) 𝑥=
2𝑎

11. Two objects (say a and b) when compared using ==,


return True. But Python gives False when compared using is
operator. Why? (i.e., a==b is True by why is a is b False?)
12. Are these values equal? Why/Why not?
(a) 20 and 20.0
(b) 20 and int(20)
(c) str(20) and str(20.0)
(d) ‘a’ and “a”
13. Given str1 = “Pandemic”, what will be the values of?
(a) str1[0]
(b) str1[1]
(c) str[-5]
(d) str[-4]
(e) str[5]
14. If you give the following for str1 = “Hello”, why does
Python report error? Str1[2]=‘p’
15. Differentiate between (555/222)**2 and (555.0/222)**2.
16. What will be output produced by following code? State
reason for this output.
a,b,c=1,1,2
d=a+b
e=1.0
f=1.0
g=2.0
h=e+f
print(c==d)
print(c is d)
print(g==h)
print(g is h)
17. Write a program to take two inputs for day, month and
then calculate which day of the year, the given date is. For
simplicity, take 30 days for all months. For example, if you
give input as : Day3, Month2 then it should print “Day of
the year : 33”.
18. Write a program to take year as input and check if it
is a leap year or not.

Page | 3
19. Write a program to take an n-digit number and print its
reverse.
20. Write a program that reads a number of seconds and
prints it in form : mins and seconds, e.g., 200 seconds are
printed as 3 mins and 20 seconds.

Page | 4

You might also like