083 - Cs - Xii - Python Revision Tour
083 - Cs - Xii - Python Revision Tour
Ans. string
Ans. False
Ans. 1 to 9
Ans. 1 to 10
Ans. OkOkOkOkDone
9 Output of : print(print(“Why?”))
Ans. Why?
None
Ans. C = A//B
Ans. 1
Ans. Advantages
1) Easy to Use
2) Expressive Language
Disadvantages
1) Slow because of interpreted
2) Not strong on type binding
Ans. (i) 6
(ii) 12
(iii) 5
16 Output of :
(i) True + True =
(ii) 100 + False =
(iii) -1 + True =
(iv) bool(-1 + True) =
Ans. (i) 2
(ii) 100
(iii) 0
(iv) False
17 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) = ____
Ans. (i) 14
(ii) 128
(iii) 256
(iv) 17
(v) True
18 Output of :
a,b,c = 20,40,60
b+=10
c+=b
print(a,b,c)
Ans. 20 50 110
Ans. a) print(MyFamily[2])
b) print(MyFamily[::-1])
c) 'Sister' in MyFamily
d) MyFamily[len(MyFamily)-1]='Tiger' OR MyFamily[4]=‟Tiger‟
e) MyFamily.pop()
f) MyFamily.append(„Tommy‟)
23 Consider a Tuple:
Record = (10,20,30,40)
Raj wants to add new item 50 to tuple, and he has written
expression as
Record = Record + 50, but the statement is giving an error, Help
Raj in writing correct expression.
Correct Expression : _______________
Ans. List is mutable type whereas String is immutable. List can store
elements of any type like-string, list, tuple, etc. whereas String
can store element of character type only.
27 Consider a Dictionary
Employee = {„Empno‟:1,‟Name‟:‟Snehil‟,‟Salary‟:80000}
Write statements:
(i) to print employee name (ii) to update the salary from 80000 to
90000 (iii) to get all the values only from the dictionary
Ans. (i) print(Employee['Name'])
(ii) Employee['Salary']=90000
(iii) print(Employee.values())
28 Num = 100
Isok = False
print(type(Num)) = _______
print(type(Isok)) = _______
Ans. a) math
b) random
c) random
d) math
Ans. To=30
for K in range(0,To):
if K%4==0:
print(K*4)
else:
print(K+3)
31 Rewrite the following code in python after removing all
syntax error(s). Underline each correction done in the code:
a=5
work=true
b=hello
c=a+b
FOR i in range(10)
if i%7=0:
continue
Ans. a=5
work=True
b='hello'
c = a + b
for i in range(10):
if i%7==0:
continue
Ans. a=b=10
c=a+b
while c<=20:
print(c,end="*")
c+=10
(ii)
for i in range(_______):
print(i)
Ans. (i)
for i in range(10,101):
print(i)
(ii)
for i in range(10,0,-1):
print(i)
(ii)
for i in range(1,10):
if i % 4 == 0:
continue
print(i)
Ans. (i)
1
2
3
(ii)
1
2
3
5
6
7
9
10
Ans. (i)
Ans. (iii)
Ans. *
b
A
b
c
A
b
*
Ans. k = 10
while k<=20:
print(k)
k+=5
50 Give Output
colors=["violet", "indigo", "blue", "green", "yellow", "orange",
"red"] del colors[4]
colors.remove("blue")
p=colors.pop(3)
print(p, colors)
Ans. 65
52 Output of the following code:
X = 17
if X>=17:
X+=10
else:
X-=10
print(X)
Ans. 27
Ans. 6 times
Ans. cO*P*t*R
55 A=10
B=10
print( A == B) = ?
print(id(A) == id(B) = ?
print(A is B) = ?
Ans. True
True
True