Function Chapter Test Class - 12 A Computer Science
GBSSS Khajoori Khas
Date: 29/04/2023
1. What will be the output of the following code?def check():
global num
num=1000
print(num)
num=100
print(num)
check()
print(num)
2. Function can alter only Mutable data types? (True/False)
3. What will be the output of the following code?
def drawline(char='$',time=5):
print(char*time)
drawline()
drawline('@',10)
drawline(65)
drawline(chr(65))
4. What will be the output of the following code?def Fun1(mylist):
for i in range(len(mylist)):
if mylist[i]%2==0:
mylist[i]/=2
else:
mylist[i]*=2
list1 =[21,20,6,7,9,18,100,50,13]
Fun1(list1)
print(list1)
5. What will be the output of the following code?X = 100
def Change(P=10, Q=25):
global X
if P%6==0:
X+=100
else:
X+=50
Sum=P+Q+X
print(P,'#',Q,'$',Sum)
Change()
Change(18,50)
Change(30,100)
6. What will be the output of the following code?def Alter(M,N=50):
M = M + N
N = M - N
print(M,"@",N)
return M
A=200
B=100
A = Alter(A,B)
print(A,"#",B)
B = Alter(B)
print(A,‟@‟,B)
7. A Function can call another function or itself? (True/False)
8. _______ keyword is used to define a function
9. What are the different types of function?
10. What are the different types of function arguments?
No comments:
Post a Comment