12th Standard Syllabus & Materials
12th Standard
TN 12th Computer Applications மின்னணு தரவு பரிமாற்றம் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications மின் - வணிக பாதுகாப்பு அமைப்புகள் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications மின்னணு செலுத்தல் முறைகள் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications மின் - வணிகம் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications திறந்த மூல கருத்துருக்கள் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications வலையமைப்பு வடமிடல் Sample Question Papers Study Material - QB365 Set A

Published on: 05/09/2022
QB365 provides a detailed and simple solution for every Possible Creative Questions in Class 12 Computer Science Subject - Python Functions , English Medium. It will help Students to get more practice questions, Students can Practice these question papers in addition to score best marks.
Download Tamil Nadu 12th Standard Computer Science question papers, model tests, one-mark questions, important questions, and public exam papers in PDF format. Free study materials and answer keys for TN State Board students.
Questions + Answers key
Take MCQ Computer Science Test

1.
How will you call a function? Explain with an example.
2.
Define functions and its types.
3.
Write a note on (i) floor (), (ii) ceil (), (iii) Sprt ().
4.
Write a note on (i) min (), (ii) max (), (iii) sum ().
5.
Write a note on format () with an example.
6.
Explain how will you use global and local variable with same name.
7.
Explain with an example how will you use global and local variables in the same code.
8.
What is the use of global keyword? Explain with an example?
9.
Write a note of return statement.
10.
When the variable - length arguments are used? Explain with an example.
11.
How python takes a default value in the function call? Explain with an example.
12.
How will you invoke the function after, the parameters are recognized by their parameter names? Explain with an example.
13.
Write a note on "Required arguments".
14.
Write the advantages of user-defined functions.
15.
When do you call the function to perform a specify task?
1.
We can call the "hello( )" function within the print ( ) functions in the following example.
def hello ( ):
print ("hello - Python'')
return
print (hello ( ))
If the return has no argument, "None" will be displayed as the last statement of the output.
hello - Python
None
2.
Functions are nothing but a group of related statements that perform a specific task.
| Functions | Description |
| 1. User-defined functions | 1. Functions defined by the users themselves. |
| 2. Built-in functions | 2. Functions that are inbuilt within Python |
| 3. Lambda functions | 3. Functions that are anonymous unnamed function. |
| 4. Recursion functions | 4. Functions that call themselves is known as recursive. |
3.
| Function | Description | Syntax | Example |
| floor () | Returns the largest integer less than or equal to x |
math.floor (x) | x=26.7 print (math.floor (x)) Output: 26 |
| ceil () | Returns the smallest integer greater than or equal to x |
math.ceil (x) | x= 26.7 print (math.ceil (x)) Output: 37 |
| sqrt () | Returns the square root of x Note: must be greater than 0 (zero) |
sqrt (x) |
b=49 Output: |
4.
| S.No | Function | Description | Syntax | Example |
| (i) | min () | Returns the minimum value in a list. | min (list) | MyList = [21,76,98,23] print ('Minimum of MyList :', min (MyList)) Output: Minimum of MyList : 21 |
| (ii) | max () | Returns the maximum value in a list. | max (list) | MyList = [21,76,98,23] print ('Maximum of MyList :', max(MyList)) Output: Maximum of Mylist :98 |
| (iii) | sum () | Returns the sum of values in a list. | sum (list) | MyList = [21,76,98,23] print ('Sum of MyList :', sum (MyList)) Output: Sum of MyList: 218 |
5.
| format () | Returns the output based on the given format. 1. Binary format. Outputs the number in base 2. 2. Octal format. Outputs the number in base 8. 3. Fixed-point notation. Displays the number as a fixed-point number. The default precision is 6. |
format (value [, format_spec]) | x=14 y=25 print ('x value in binary :',format(x,'b')) print ('y value in octal :',format(y,'o')) print('y value in Fixed-point no ',format(y,'f')) Output: x value in binary: 1110 y value in octal: 31 y value in Fixed-point no: 25.000000 |
6.
x=5
def loc():
x=10
print ("local x:", x)
loc()
print ("global x:", x)
Output:
local x: 10
global x:5
7.
Using Global and Local variable in same code:
x=8 # x is a global variable
def loc():
global x
y = "local"
x=x * 2
print(x)
print(y)
loc()
Output:
16
local
8.
The global keyword are used modify the global variable inside the function.
Changing Global Variable From Inside a Function using global keyword.
x = 0 # global variable
def add():
global x
x=x+5 # increment by 2
print ("Inside add() function x value is :",x)
add()
print ("In main x value is :", x)
Output:
Inside add() function x value is : 5
In main x value is : 5
9.
The return statement:
(i) The return statement causes your function to exit and returns a value to its caller. The it point of functions in general is to take inputs and return something.
(ii) The return statement is used when a function is ready to return a value to its caller. So, only one return statement is executed at run time even though the function contains multiple return statements.
(iii) Any number of 'return' statements are allowed in a function definition but only one of them is executed at run time.
10.
(i) Syntax - Variable-Length Arguments:
def function_name(*args):
function_body
return_statement
(ii) Example:
def printnos (*nos):
for n in nos:
print(n)
return
# now invoking theprintnos() function
print ('Printing two values')
printnos (1,2)
print ('Printing three values')
printnos (10,20,30)
Output:
Printing two values
1
2
Printing three values
10
20
30
11.
(i) In Python the default argument is an argument that takes a default value if no value is provided in the function call.
(ii) The following example uses default arguments, that prints default salary when no argument is passed.
(iii) Example:
def printinfo( name, salary = 3500):
print ("Name: ", name)
print ("Salary: ", salary)
return
printinfo("Mani")
When the above code is executed, it produces the following output
Output:
Name: Mani
Salary: 3500
When the above code is changed as print info("Ram", 2000) it produces the following output:
Output:
Name: Ram
Salary: 2000
12.
(i) Keyword arguments will invoke the function after the parameters are recognized by their parameter names.
(ii) The value of the keyword argument is matched with the parameter name and so, one can also put arguments in improper order.
(iii) Example:
def printdata (name):
print ("Example-1 Keyword arguments")
print ("Name :",name)
return
# Now you can call printdatat() function
printdata(name = "Gshan")
When the above code is executed, it produces the following output:
Output:
Example-1 Keyword arguments
Name: Gshan
13.
(i) "Required Arguments" are the arguments passed to a function in correct positional order. Here, the number of arguments in the function call should match exactly with the function definition.
(ii) Atleast one parameter to prevent syntax errors to get the required output.
(iii) Example:
def printstring(str):
print ("Example - Required arguments")
print (str)
return
# Now you can call printstring() function
printstring ("Welcome")
Output:
Example - Required arguments
Welcome
14.
Advantages of User-defined Functions
(i) Functions help us to divide a program into modules. This makes the code easier to manage.
(ii) It implements code reuse. Every time you need to execute a sequence of statements, all you need to do is to call the function.
(iii) Functions, allows us to change functionality easily, and different programmers can work on different functions.
15.
(i) When you want to perform a particular task that you have defined in a function, you call the name of the function responsible for it.
(ii) If you need to perform that task multiple times throughout your program, you don't need to type all the code for the same task again and again.
(iii) You just call the function dedicated to handling that task, and the call tells Python to run the code inside the function.
12th Standard Syllabus & Materials
12th Standard
TN 12th Computer Applications களப்பெயர் முறைமை (DNS) Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications வலையமைப்பு எடுத்துக்காட்டுகள் மற்றும் நெறிமுறைகள் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications கணினி வலையமைப்பு ஓர் அறிமுகம் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications PHP-உடன் MySQL-ஐ இணைத்தல் Sample Question Papers Study Material - QB365 Set A
Tamilnadu Stateboard 12th Standard Subjects

Maths

Chemistry

Physics

Biology

Computer Science

Business Maths and Statistics

Economics

Commerce

Accountancy

History

Computer Applications

Biology

Computer Technology

Computer Applications

Computer Science

Business Maths and Statistics

Commerce

Economics

Maths

Chemistry

Physics

Computer Technology

History

Accountancy

Tamil

English

French
Tamilnadu Stateboard Standards