# Important QnA Working with functions Class 12

In this article, you will get important QnA Working with functions Class 12.

Topics Covered

## Output Questions Working with functions Class 12

1. def Fun1():
print(‘Python, let\’s fun with functions’)
Fun1()

if(i*3%2==0):
i*=i
else:
i*=4
return i
print(a)
3. import math
def area(r):
return math.pi*r*r
a=int(area(10))
print(a)

4.def fun1(x, y):
x = x + y
y = x – y
x = x – y
print(‘a=’,x)
print(‘b=’,y)
a = 5
b = 3
fun1(a,b)

4. def div5(n):
if n%5==0:
return n*5
else:
return n+5
def output(m=5):
for i in range(0,m):
print(div5(i),’@’,end=” “)
print(‘\n’)
output(7)
output()
output(3)

5.def sum(*n):
total=0
for i in n:
total+=i
print(‘Sum=’, total)
sum()
sum(5)
sum(10,20,30)

6.def func(b):
global x
print(‘Global x=’, x)
y = x + b
x = 7
z = x – b
print(‘Local x = ‘,x)
print(‘y = ‘,y)
print(‘z = ‘,z)
x=5
func(10)

7. def func(x,y=100):
temp = x + y
x += temp
if(y!=200):
print(temp,x,x)
a=20
b=10
func(b)
print(a,b)
func(a,b)
print(a,b)

8. def get(x,y,z):
x+=y
y-=1
z*=(x-y)
print(x,’#’,y,’#’,z)
def put(z,y,x):
x*=y
y+=1
z*=(x+y)
print(x,’\$’,y,’\$’,z)
a=10
b=20
c=5
put(a,c,b)
get(b,c,a)
put(a,b,c)
get(a,c,b)

Error based questions:

1. def in(x,y):
x=x + y
print(x.y)
x*=y
print(x**y)

2. void get(x=10,y):
x = x + y
print(x,n,y)

3. // Program to compute result
def res():
eng = 56
math = 40
sci = 60
if eng<=35 || math<=35 ||
sci=35
print(‘Not Qualified’)
else:
print(“Qualified”)

4. a=5, b=10
def swap(x,y):
x = a + b
y = x – y
x = x – y
swap(a)
swap(15,34)
swap(b)
swap(a,b)

5. def cal_dis(qty,rate=50,dis_rate): #discount rate = 5%
bil_amt = (qty*rate)*dis_rate
print(bil_amt)
caldis(10)
cal_dis(10,50,0.05)

## Theory-based questions for Working with functions Class 12.

1. What is a function?
2. Why programmers need functions in python programming?
3. How to create a function in python? Explain in detail.
4. What are the parts of functions? Explain with a suitable example.
5. How to call a function? Write steps.
7. Explain the physical line structure of a program. Illustrate with an example.
8. Illustrate the flow of execution in the function call statement.
9. Write and explain the types of functions supported by python.
10. Write the ways of import module in the python program.
11. Differentiate between parameters and arguments.
12. What are the arguments supported by python? Explain each of them with a suitable example.
13. What is the local variable and global variable? Explain with an example.

Below given programs for Working with functions Class 12 will help you to do practice for the learnt concepts.

## Practical List for Working with functions Class 12

1. Write a python program to perform the basic arithmetic operation in a menu-driven program with different functions. The output should be like this:
Select an operator to perform the task:
‘-‘  for Subtraction
‘*’  for Multiplication
‘/’ for Division

2. Write a python program to enter a temperature in Celsius into Fahrenheit by using the function.

3. Write a python program using the function to print the Fibonacci series up to n numbers.

4. Write a python program to return factorial series up to n numbers using the function.

5. Write a python program to accept username “Admin” as default argument and password to entered by the user to allow login into the system.

6. Write a menu-driven python program using different functions for the following menu:
1 Check no. is Palindrome or not
2 Check no. is Armstrong or not
3 Exit

7. Write a python program using the function to print prime numbers between 11 to 200.

8.  Write a python program to demonstrate the concept of variable length argument to calculate the sum and product of the first 10 numbers.

9.  Write a python program to find maximum and minimum numbers among given 4 numbers.

10. Write a python program to print the following patterns using functions:
1. Diamond Pattern with *
2. Butterfly Pattern with *
3. Triangle Pattern with *

Below you will get solutions for output and error questions of Working with functions Class 12.

### 6 thoughts on “Important QnA Working with functions Class 12”

1. 2. 3. Output questions and error questions solution provided now. Just check latest post

4. 5. 6. 