In this article, you will get important QnA Working with functions Class 12.
Output Questions Working with functions Class 12
1. def Fun1():
print(‘Python, let\’s fun with functions’)
2. def add(i):
3. import math
4.def fun1(x, y):
x = x + y
y = x – y
x = x – y
a = 5
b = 3
4. def div5(n):
for i in range(0,m):
for i in n:
print(‘Global x=’, x)
y = x + b
x = 7
z = x – b
print(‘Local x = ‘,x)
print(‘y = ‘,y)
print(‘z = ‘,z)
7. def func(x,y=100):
temp = x + y
x += temp
8. def get(x,y,z):
Error based questions:
1. def in(x,y):
x=x + y
2. void get(x=10,y):
x = x + y
3. // Program to compute result
eng = 56
math = 40
sci = 60
if eng<=35 || math<=35 ||
4. a=5, b=10
x = a + b
y = x – y
x = x – y
5. def cal_dis(qty,rate=50,dis_rate): #discount rate = 5%
bil_amt = (qty*rate)*dis_rate
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.
6. What are the comments? What are the role comments in the program? How to write single-line comments and multi-line comments?
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 the 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 Addition
‘-‘ 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
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.