Page 331 - C++
P. 331
SECTION B
[Only for candidates, who opted for Python]
1. (a) Differentiate between Syntax Error and Run-Time Error. Also, write
a suitable example in Python to illustrate both. 2
(b) Name the Python Library modules which need to be imported to
invoke the following functions : 1
(i) sin()
(ii) search()
(c) Rewrite the following code in Python after removing all syntax
error(s). Underline each correction done in the code. 2
Val = int(rawinput("Value:"))
Adder = 0
for C in range(1,Val,3)
Adder+=C
if C%2=0:
Print C*10
Else:
print C*
print Adder
(d) Find and write the output of the following Python code : 2
Data = ["P",20,"R",10,"S",30]
Times = 0
Alpha = ""
Add = 0
for C in range(1,6,2):
Times = Times + C
Alpha = Alpha + Data[C-1]+"$"
Add = Add + Data[C]
print Times,Add,Alpha
91 12