Class 12 Computer Science Practice Assignments: CBSE Class 12 Computer Science Functions In Python Assignment
Review targeted academic assignments with the CBSE Class 12 Computer Science Functions In Python Assignment. Built according to official CBSE standards for the 2026-27 term, these downloadable Class 12 Computer Science worksheets support effective daily practice for Functions In Python.
Download Functions In Python Assignment PDF with Solutions
View or download the dedicated CBSE Class 12 Computer Science Functions In Python Assignment resource below. Engaging with these assignments under focused study conditions ensures continuous academic progress and mastery of the 2026-27 curriculum.
Short Answer Type Questions :
Question: What is default parameter?
Answer: A parameter having default value in the function header is known as a default parameter.
Question: What is a Library in Python?
Answer: A Library is a collection of modules that together caters to specific types of needs or applications.Like NumPy library of Python caters to scientific computing needs.
Question: Is it necessary to have a base case in a recursive function?
Answer: Yes
Question: What is base case in recursion?
Answer: Preknown case of recursive function, whose solution is pre-known is called base case.
Question: What is recursion?
Answer: Recursion refers to a programming technique in which function calls itself either directly or indirectly.,
Question:. What is module in Python?
Answer: A module is a file with .py extension that contains variables, class definitions, statements and functions related to a particular task.
Question: When is recursion endless?
Answer: An infinite recursion is when recursive function calls itself endlessly.
Question: Array for binary search should be sorted or not?
Answer: Yes
Question: Can a function return multiple values in python?
Answer: YES.
Question: What will be the output of the following code?
a=1
def f():
a=10
print(a)
Answer: The code will print 1 to the console.
Question: Consider the following function headers. Identify the correct statement: –
1) def correct(a=1,b=2,c): 2) def correct(a=1,b,c=3):
3) def correct(a=1,b=2,c=3): 4) def correct(a=1,b,c):
Answer: – 3) def correct(a=1,b=2,c=3)
Question: Write the features of a module.
Answer: – 1) Modules can be reused in other programmes
2) It is independent group of code and data
Question: Create a package ArithmeticOperations (named AO) contain sum, product and difference of two numbers and use it in your main programme.
Answer: – def ADD(X,Y):
return (X+Y)
def PRODUCT(X,Y):
return(X*Y)
def DIFFERENCE(X,Y):
return(X-Y)
Now lets save this file as AO.py then our module is created now.
Now we are creating our main python file: –
import AO
n1=int(input(‘Enter a Number’))
n2=int(input(‘Enter another Number’))
print(‘Sum = ‘, AO.ADD(n1,n2))
print(‘Difference=’,AO.DIFFERENCE(n1,n2))
print(‘Product=’,AO.PRODUCT(n1,n2))
Question: Find the output:
a) def out(n):
if(n==0):
return
else:
out(n-1)
print(n)
n=6
out(n)
b) def sum(n):
if(n==1):
return 1
return n*n+sum(n-1)
n=4
print(“Sum is:”,sum(n))
c) def compute(a,b):
if(b==0):
return a
else:
return compute(a,a%b)
a=6
b=2
c=compute(a,b)
print(“Computer data:”,c)
Answer: a)
1
2
3
4
5
6
b) Sum is: 30
c) Computer data: 6
Question: What are the advantage and disadvantage of recursion?
Answer: Advantages of Recursion:
i. Recursive functions make the code look clean and elegant.
ii. A complex task can be broken down into simpler sub-problems using recursion.
iii. Sequence generation is easier with recursion than using some nested iteration.
Disadvantages of Recursion:
i. Sometimes the logic behind recursion is hard to follow through.
ii. Recursive calls are expensive (inefficient) as they take up a lot of memory and time.
iii. Recursive functions are hard to debug.
Question: Write recursive code to compute the factorial of an integer.
Answer: def calc_factorial(x):
if x == 1:
return 1
else:
return (x * calc_factorial(x-1))
num = 4
print(“The factorial of”, num, “is”, calc_factorial(num))
Question: Rewrite the correct code after removing the errors: –
def SI(p,t=2,r):
return (p*r*t)/100
Answer: – def SI(p, r, t=2):
return(p*r*t)/100
Application Based Questions :
Question: How many values a python function can return? Explain how?
Answer: Python function can return more than one values.
def square_and_cube(X):
return X*X, X*X*X, X*X*X*X
a=3
x,y,z=square_and_cube(a)
print(x,y,z)
Question: Predict the output of the following code fragment?
def check(n1=1, n2=2):
n1=n1+n2
n2+=1
print(n1,n2)
check()
check(2,1)
check(3)
Answer: 3 3
3 2
5 3
Question: Write a python program to sum the sequence given below. Take the input n from the user. img
Answer: def fact(x):
j=1 , res=1
while j<=x:
res=res*j
j=j+1
return res
n=int(input(“enter the number : “))
i=1, sum=1
while i<=n:
f=fact(i)
sum=sum+1/f
i+=1
print(sum)
Question: Write a program to compute GCD and LCM of two numbers def gcd(x,y):
Answer: while(y):
x, y = y, x % y
return x
def lcm(x, y):
lcm = (x*y)//gcd(x,y)
return lcm
num1 = int(input(“Enter first number: “))
num2 = int(input(“Enter second number: “))
print(“The L.C.M. of”, num1,”and”, num2,”is”, lcm(num1, num2))
print(“The G.C.D. of”, num1,”and”, num2,”is”, gcd(num1, num2))
Free study material for Computer Science
CBSE Class 12 Computer Science Assignments for Functions In Python
Download Assignment: Functions In Python (Class 12 Computer Science)
Explore reliable practice questions for Functions In Python tailored for Class 12 learners. Use these structured worksheets to evaluate preparedness and strengthen core problem-solving skills.
Maximize Exam Scores with Chapter Practice Sets
- Syllabus Compliance: Sets reflect current CBSE evaluation criteria and official marking frameworks.
- Multi-Format Practice: Includes varied problem types designed to deepen comprehension across all sub-topics.
- Time Management: Routine practice optimizes pacing to finish school examinations comfortably within schedule.
Steps to Complete Functions In Python Assignments Successfully
- Concept Foundation: Review the NCERT book for Class 12 Computer Science thoroughly before diving into assignment tasks.
- Self-Evaluation: Solve exercises independently before inspecting professional answer guides.
- Progress Monitoring: Note down complex formulas or concepts, clearing them up using available online practice aids.
FAQs
You can download free PDF assignments for Class 12 Computer Science Functions In Python from StudiesToday.com. These practice sheets have been updated for the 2026-27 session covering all concepts from latest NCERT textbook.
Yes, our teachers have given solutions for all questions in the Class 12 Computer Science Functions In Python assignments. This will help you to understand step-by-step methodology to get full marks in school tests and exams.
Yes. These assignments are designed as per the latest CBSE syllabus for 2026. We have included huge variety of question formats such as MCQs, Case-study based questions and important diagram-based problems found in Functions In Python.
Practicing topicw wise assignments will help Class 12 students understand every sub-topic of Functions In Python. Daily practice will improve speed, accuracy and answering competency-based questions.
Yes, all printable assignments for Class 12 Computer Science Functions In Python are available for free download in mobile-friendly PDF format.