[go: up one dir, main page]

0% found this document useful (0 votes)
100 views7 pages

Xii CSC - QB (Functions)

Uploaded by

Sudarshan D
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
100 views7 pages

Xii CSC - QB (Functions)

Uploaded by

Sudarshan D
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

N.S.N.

MEMORIAL SENIOR SECONDARY SCHOOL


Thirumurugan Salai, Thirumurugan Nagar, Chitlapakkam, Chennai – 600064

QUESTION BANK (2024 – 25)

Class: XII Unit 3: FUNCTIONS Subject: Computer Science

I. Answer the following in a word/sentence (1 Mark)


Fill in the blank
1. Write the syntax for User defined function?
2. Write the following from the program
i. Function name
ii. Function header
iii. Formal Parameters
iv. Body of the function
v. Function call
vi. Actual arguments

3. What is a function?
4. What are the types of functions?
5. What are the advantages of functions?
6. What is module?
7. What is modularization?
8. What are the types of Arguments?
9. What are the rules for combining all the three types of arguments?
10. Write a Python program to find the factorial of a number using function
11. Function name must be followed by ___________
12. __________keyword is used to define a function
13. Function will perform its action only when it is ________
14. Function can alter only Mutable data types? (True/False)
15. A Function can call another function or itself? (True/False)
16. Write statement to call the function.
def Add(X,Y):
Z = X+Y
print(Z)
#statement to call the above function
1
17. Write statement to call the function.
def Add(X,Y):
Z = X+Y
return Z
#statement to call the above function
print(“Total =”,C)
18. Which Line Number Code will never execute?
def Check(num): #Line 1 if
if num%2==0: #Line 2
print("Hello") #Line 3
return True #Line 4
print("Bye") #Line 5
else: #Line 6
return False #Line 7
C= Check (20)
print(C)
19. What will be the output of following code?
def Cube(n):
print(n*n*n)

Cube(n) # n is 10 here
print(Cube(n))
20. What are the different types of actual arguments in function? Give
example of any one of them.
21. What will be the output of following code:
def Alter(x, y = 10,z=20):

sum=x+y+z
print(sum)
Alter(10,20,30)
Alter(20,30)
Alter(100)
22. Ravi a python programmer is working on a project, for some requirement,
he has to define a function with name CalculateInterest(), he defined it as:
def CalculateInterest(Principal,Rate=.06,Time):
# code
But this code is not working, Can you help Ravi to identify the error in
the above function and what is the solution.
23. Call the given function using KEYWORD ARGUMENT with values 100 and 200
def Swap(num1,num2):
num1,num2=num2,num1
print(num1,num2)

Swap( ____ ,___ )

2
14.Which line number of code(s) will not work and why?
def Interest(P,R,T=7):
I=
(P*R*T)/100
print(I)

Interest(20000,.08,15) #Line 1
Interest(T=10,20000,.075) #Line 2
Interest(50000,.07) #Line 3
Interest(P=10000,R=.06,Time=8) #Line 4
Interest(80000,T=10) #Line 5
15. What will be the output of following code?
def Calculate(A,B,C):
return A*2, B*2, C*2
val = Calculate(10,12,14)
print(type(val))
print(val)
16.What will be the output of following code?
def display(s):
l = len(s)
m=""
for i in range(0,l):
if s[i].isupper():
m=m+s[i].lower()
elif s[i].isalpha():
m=m+s[i].upper()
elif s[i].isdigit():
m=m+"$"
else:
m=m+"*"
print(m)
display("EXAM20@cbse.com")
17.What will be the output of following code?

def Total(Number=10):
Sum=0
for C in range(1,Number+1):
if C%2==0:
continue
Sum+=C
return Sum
print(Total(4))
print(Total(7))
print(Total())
18. What will be the output of following code?
X = 100
def Change(P=10, Q=25):
global X
3
if P%6==0:
X+=100
else:
X+=50
Sum=P+Q+X
print(P,'#',Q,'$',Sum)
Change()
Change(18,50)
Change(30,100)

II. Answer the following (2 Marks):

1. What is Local Variable and Global Variables? Illustrate with example


2.What will be the output of following code?
def check():
num=50
print(num)
num=100 print(num)
check()
print(num)
3. What will be the output of following code?
def Calculate(A,B,C):
return A*2, B*2, C*2
val = Calculate(10,12,14)
print(type(val))
print(val)
4. What will be the output of following code?
def check():
global num
num=1000
print(num)
num=100
print(num)
check()
print(num)
5. What will be the output of following code?
print(“Welcome!”)
print(“Iam “, name ) # is double underscore
6. What will be the output of following code?
def drawline(char='$',time=5):
print(char*time)
drawline()
drawline('@',10)
drawline(65)
drawline(chr(65))

4
III. Answer the following questions (3 Mark s)

1. What will be the output of following code?


def Updater(A,B=5):
A = A // BB = A
%B
print(A,'$',B)
return A + B
A=100
B=30
A = Updater(A,B)
print(A,'#',B)
B = Updater(B)
print(A,'#',B)
A = Updater(A)
print(A,'$',B)

2. What will be the output of following code?


X = 50
def Alpha(num1):
global X num1
+= XX += 20
num1 = Beta(num1)return
num1
def Beta(num1):
global X num1
+= XX += 10
num1 = Gamma(num1)
return num1
def Gamma(num1):X =
200
num1 += X
return num1
num = 100
num = Alpha(num)
print(num,X)

3.What will be the output of 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]
5
4. What will be the output of 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)

5. What will be the output of following code?


def Fun1(num1):
num1*=2
num1 = Fun2(num1)
return num1

def Fun2(num1):
num1 = num1 // 2
return num1

n = 120
n = Fun1(n)
print(n)
6. What will be the output of following code?
a=100
def show():
global aa=200

def invoke():

global a
a=500

show()
invoke()
print(a)

Understanding & Remembering Level of questions Percentage 25%

6
Application-Level of questions Percentage 35%

Analyzing-Level of questions Percentage 40%

**********************

You might also like