Indian School Al Wadi Al Kabir: Answer The Following
Indian School Al Wadi Al Kabir: Answer The Following
Indian School Al Wadi Al Kabir: Answer The Following
Class: XII Comp. Sci. Department: Computer Science Date of submission: 09/09/2
2.If return statement is not used inside the function, the function will return:
a) 0 b) None Object c) an arbitrary integer d) Error: Functions must have return statement
3.Which of the following keyword marks the beginning of the function block?
a)func b) define c) def d) function
4.What is the difference between the formal parameters and actual parameters? What are
their alternate names? Also, give a suitable Python code to illustrate both.
5.What is the difference between a global variable and a local variable? Also give a suitable
example to illustrate both.
6.From the program code given below, identify the parts mentioned below:
def processNumber(x):
x = 72
return x + 3
y = 54
res = processNumber(y)
1| 2 9 - 0 8 - 2 0 2 0 / P R E P A R E D B Y : M r . A . R a n j i t h K u m a r
7. return a
8.
9.N = 5
10. Result = calcCube(N) + power(3,3)
11. print(Result)
10. Following code intends to add a given value to global variable a. What will the following
code produce?
1.def increase(x):
2. a=a+x
3. return
4.
5.a = 20
6.b = 5
7.increase(b)
8.print(a)
11. Which names are local, which are global and which are built-in in the following code
fragment?
invaders = “Big names”
pos = 200
level = 1
def play():
max_level = level + 10
print(len(invaders) == 0)
return max_level
res = play()
print(res)
2| 2 9 - 0 8 - 2 0 2 0 / P R E P A R E D B Y : M r . A . R a n j i t h K u m a r
12. Predict the output of the following code fragment?
def func(message, num = 2):
print(message * num)
func(‘Python’)
func(‘Easy’,5)
13. Write User defined function to check whether the input argument is Primer No. or not.
14. Write a user defined functions to find out the No. of values divisible by 5 in a list of
elements passed as an argument.
15. Write a user defined functions to replace all the multiples of 4 as triple of its values in a list
of elements passed as an argument.
16. Write a Python function that checks whether a passed string is palindrome or not.
3| 2 9 - 0 8 - 2 0 2 0 / P R E P A R E D B Y : M r . A . R a n j i t h K u m a r