REVISION – REVIEW OF PYTHON
1)
What is the
difference between keyword and identifier?
2)
How many
ways are there to represent an integer literal?
3)
What will
be the sizes of following constants:
i)
‘\a’
ii)
“Reema\’s”
iii)
“XY \
YZ”
iv)
“””XY<Enter>
YZ”””
4)
How do you
create multi line strings
5)
Write the
following real constants in exponent form:
i)
17.25 ii) ).452
6)
Write a
program that displays a joke. But display the punchline only when the user
presses enter key.
7)
Input 2
dates from the user and display difference between 2 dates.
8)
What are augmented opertors? How are they useful?
9)
Evaluate
and Justify:
a)
0 or None
and “or”
b)
“abc”==”Abc”
and not(2==3 or 3==4)
c)
3<5 or
50/5 –(3+2))
d)
2*(2 *
(len(“01”)))
10)
What is the
result produced by i) bool(0) ,ii) bool(str(0))
11)
Predict the
output:
a)
a=va=3
b=va=3
print(a,b)
b)
a=3
b=3.0
print(a==b)
print(a is b)
c)
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)
d)
x,y=4,8
z=x/y*y
print(z)
e)
a=True
b=(0<5)+0
print(a,b)
print(a==b)
print(a is b)
c=str(a)
d=str(bool(b))
print(c==d)
print(c is d)
1