TN State Board 12th Computer Science Important Questions Chapter 7 Python Functions

Question 1.
What is function arguments? and its types.
Answer:
Function arguments are used to call a function.
There are four types of function arguments, they are Required arguments, keyword arguments, Default arguments and variable- length arguments.

Question 2.
What is Required arguments?
Answer:
Required arguments are the arguments passed to a function in correct positional order.

Samacheer Kalvi TN State Board 12th Computer Science Important Questions Chapter 7 Python Functions

Question 3.
What is default Arguments?
Answer:
In python the default argument is an argument that takes a default value if no value is provided in the function call.

Question 4.
What is anonymous function?
Answer:

  • In python, anonymous function is a function that is without a name.
  • In python anonymous function are defined using the lambda keyword.

Question 5.
What is the use of lambda or anonymous function?
Answer:

  • Lambda function is mostly used fòr creating small and one-time anonymous function.
  • Lambda function are mainly used in combination like filter ( ), map ( ) and reduce ( ).

Samacheer Kalvi TN State Board 12th Computer Science Important Questions Chapter 7 Python Functions

Question 6.
Write the syntax of return statement.
Answer:

  • The syntax of return statment is return [expression list].
  • This statement can contain expression which gets evaluated and the value is retuned.

Question 7.
Define Block in python.
Answer:
A block in one or more lines of code, grouped together, so that they are treated as one big sequence of statements while execution.

Question 8.
What is Nested Block?
Answer:

  • A block within a block is called nested block.
  • When the first block statement is indented by a single tab space, the second block of statement is indented by double tab spaces.

Samacheer Kalvi TN State Board 12th Computer Science Important Questions Chapter 7 Python Functions

Question 9.
What is purpose of Lambda function in python?
Answer:

  • Lambda function can take any number of arguments and must return one value in the form of an expression.
  • Lambda function can only access global variables and variables in its parameter list.

Question 10.
What is output?
Answer:
Sum = lambda arg1, arg2: arg1+arg2
print (” sum=” sum (-60,100))
The output is 40.

Samacheer Kalvi TN State Board 12th Computer Science Important Questions Chapter 7 Python Functions

Question 11.
What is output?
Answer:
C = 1
def add ( ):
print (c)
add ( )
Output is 1

Question 12.
Explain the using block in python?
Answer:
A block is one or more lines of code, grouped together so that they are treated as one big sequence of statements while execution.
In Python, statements in a block are written with indentation.
A block begins when a line is indented and all the statements of the block should be at same indent level.

Question 13.
What are the advantage of user-defined functions?
Answer:

  1. Functions help us to divide a program into modules. This makes the code easier to manage.
  2. It implements code reuse. Every time you need to execute a sequence of statements, all you need to do is to call the function.
  3. Functions, allows us to change functionality easily, and different programmers can work on different functions.

Samacheer Kalvi TN State Board 12th Computer Science Important Questions Chapter 7 Python Functions

Question 14.
Explain passing parameters in function.
Answer:

  1. Parameters or arguments can be passed to functions. The syntax is def function_ name (parameter (s) separated by comma):
  2. The parameters that you place in the parenthesis will be used by the function itself.
    Eg: def area (w, h):
    return w*h
    print (area (3,5))
  3. The above code assigns the width and height values to the parameters w and h.
  4. The value of 3 and 5 are passed to w and h respectively, the function will return 15 as output.

Question 15.
Explain variable-Length arguments.
Answer:

  1. We might need to pass more arguments than have already been specified.
  2. Variable-length arguments can be used instead of that.
  3. These are not specified in the function definition and an asterisk (*) is used to define such arguments.
    Eg: def sum (x, y, z):
    print (x+y+z)
    sum (10, 20, 30)

Samacheer Kalvi TN State Board 12th Computer Science Important Questions Chapter 7 Python Functions

Question 16.
What are the methods in variable length arguments can pass the arguments?
Answer:
There are two methods using variable length arguments. They are:
(a) Non keyword variable arguments.
(b) Keyword variable arguments.
(i) Non-keyword variable arguments are called tuples.
(ii) The python’s print ( ) function is itself an example of such a function which supports variable length arguments.

Question 17.
What is the functions of the return statement?
Answer:

  1. The return statement causes your function to exit and returns a value to its caller. The point of functions in general is to take inputs and return something.
  2. 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.
  3. Any number of ‘return’ statements are allowed in a function definition but only one of them is executed at run time.

Samacheer Kalvi TN State Board 12th Computer Science Important Questions Chapter 7 Python Functions

Question 18.
Write a python program using global and local variables in same code.
Answer:
x=8 # x is a global variable
def loc ():
global x
y = “local”
x = x *2
print(x)
print(y)
loc()
output:
16
local

Question 19.
Write a python program to calculate factorial using recursive function.
Answer:
def fact(n):
if n==0:
return 1
return 1
else:
return n*fact (n-1)
print (fact (0))
print (fact (5))
output:
1
120

Samacheer Kalvi TN State Board 12th Computer Science Important Questions Chapter 7 Python Functions

Question 20.
Write a python program using global and local variable with same name.
Answer:
x = 5
defloc():
x= 10
print (“local x:”,x)
loc()
print (“global x:”,x)
output:
local x: 10
global x: 5

Question 21.
Explain any three python mathematical functions.
Answer:
(i) Floor ( ) – It returns the largest integer less than or equal to x.
The syntax is math.floor(x)
Eg: x – 10.6
y = -10.6
. z = -10.2
print (math, floor(x))
print (math, floor (y))
print (math, floor(z))
The output will be printed as
10
– 11
– 11

(ii) Ceil ( ) – It returns the smallest integer greater than or equal to x.
The syntax is math. Ceil (x)
Eg:
x = 10.7
y = -10.7
Z = -10.2
print (math, ceil (x))
print (math, ceil (y))
print (math, ceil(z))
The output will be printed as
11
-10
-10

(iii) sqrt ( ) – It returns the square root of x.
Here x must be greater than zero.
The syntax is sqrt (x)
Eg:
a = 16
b = 49
c = 25.5
print (math, sqrt (a))
print (math, sqrt (b))
print (math, sqrt (c))
The output will be printed as
4.0
7.0
5.049752469181039

Samacheer Kalvi TN State Board 12th Computer Science Important Questions Chapter 7 Python Functions

Question 22.
What is function?
Answer:
(i) Functions are named blocks of code that are designed to do specific job.
(ii) When you want to perform a particular task, that you call the name of the function responsible for it.

Question 23.
Write the different types of function?
Answer:
There are four types of python functions. They are:
(i) User-defined functions
(ii) Built- in functions,
(iii) Lambda functions
(iv) Recursion functions.

Samacheer Kalvi TN State Board 12th Computer Science Important Questions Chapter 7 Python Functions

Question 24.
What are the main advantages of function?
Answer:
(i) It avoids repetition and makes high degree of code reusing.
(ii) It provides better modularity for your application.

Question 25.
What is meant by scope of variable? Mention its types.
Answer:
Scope of variable refers to the part of the program, where it is accessible. There are two types of scopes local scope and global scope.

Question 26.
Define global scope.
Answer:
A variable, with global scope can be used anywhere is the program. It can be created by defining a variable outside the scope of any function or block.

Samacheer Kalvi TN State Board 12th Computer Science Important Questions Chapter 7 Python Functions

Question 27.
What is base condition in recursive function?
Answer:
(i) The condition that is applied in any recursive function is known as base condition.
(ii) A base condition is must in every recursive function otherwise it will continue to execute like an infinite loop.

Question 28.
How to set the limit for recursive function? Give an example.
Answer:
Recursive function is like a loop but sometimes it makes more sense to use recursion than loop.
We can convert any loop to recursion.
Eg: det fact (n):
if n = = 0:
return 1 else:
return n* fact (n -1)

Question 29.
Write the rules of local variable?
Answer:
(i) A variable with local scope can be accessed only within the function/block that it is created in.
(ii) When a variable is created inside the function/block, the variable becomes local to it.
(iii) A local variable only exists while the function is executing.
(iv) The formate arguments are also local to function.

Samacheer Kalvi TN State Board 12th Computer Science Important Questions Chapter 7 Python Functions

Question 30.
Write the basic rules for global keyword in python?
Answer:
The basic rules for global keyword in Python are:
(i) When we define a variable outside a function, it’s global by default. You don’t have to use global keyword.
(ii) We use global keyword to read and write a global variable inside a function.
(iii) Use of global keyword outside a function has no effect.

Question 31.
What happens when we modify global variable inside the function?
Answer:
(i) We need to modify the global variable from inside function, unbound local error will be displayed.
(ii) We can only access the global variable but cannot modify it from inside the function.
(iii) The solution for this is to use the global keyword.
Eg: c =1
def add():
c =c+5
print (c)
add ()
Local variable c referenced before assignment, so it is display for unbound local error.

Samacheer Kalvi TN State Board 12th Computer Science Important Questions Chapter 7 Python Functions

Question 32.
Differentiate ceil ( ) and floor ( ) function.
Answer:

Ceil ( )  floor( )
Ceil is a mathematical function.  floor () is also mathematical function.
Ceil function returns the least value of the integer that is greater than or equal to the specific number.  Return the largest integer less than or equal to the specific number.
Ceil (x), Returns the ceiling of x as a float, the smallest integer value greater than or equal to x.  floor (x), Return the floor of x as a float, the largest integer value less than or equal to x.

Question 33.
Write a python code to check whether a given year is leap year or not.
Answer:
# Python code to check whether a given year is leap or not
year = int (input (“Type a year:”))
if (Year% 4==0 and year % 100!=0 or year % 400==0):
print (“The year is a leap year”)
else
print (“The year is not a leap year”)

Samacheer Kalvi TN State Board 12th Computer Science Important Questions Chapter 7 Python Functions

Question 34.
What is composition in functions?
Answer:
The value returned by a function may be used as an argument for another function in a nested manner. This is called composition.
The input string from the user using the function input () and apply eval() function to evaluate its value.
Eg: >>>x = eval(input(“Type the value”)
Type the value 15 + 5.0*3
>>>x
30.0

Question 35.
How recursive function works?
Answer:
(i) Recursive function is called by some external code.
(ii) If the base condition is met then the program gives meaningful output and exits.
(iii) Otherwise, function does some required processing and then calls itself to continue recursion.

Question 36.
What are the points to be noted while defining a function?
Answer:
(i) Function blocks begin with the keyword def followed by function name and parenthesis ().
(ii) Any input parameters or arguments should be placed within these parentheses when you define a function.
(iii) The code block always comes after a colon (:) and is indented.
(iv) The statement return [expression] exits a function, optionally passing back an expression to the caller.

Samacheer Kalvi TN State Board 12th Computer Science Important Questions Chapter 7 Python Functions

Question 37.
Explain the different types of function with an example.
Answer:
There are four types of functions used in python language. There are
(i) User-defined function,
(ii) Built-in function
(iii) Lambda function,
(iv) Recursion function.

(i) User-defined functions defined by the users themselves. Function blocks begin with the keyword def followed by function name and parenthesis. The statement return [expression] exits a function.
Eg: defhello():
print (“116110”)
return

(ii) Built-in functions that are inbuilt with in python language. Python has a set of built-in functions, some examples are
(i) bin( ) – returns the binary version of a number.
(ii) chr ( ) – returns a character from the specified Unicode code.
(iii) Lambda function that are anonymous un-named function. Lambda function
can take any number of arguments.
Eg: x = lambda a: a+10
print (x(5))
The output will be printed as 15.

(iv) Recursion functions that calls itself that is Recursion is a way of programming or coding a problem, in which a function calls itself one or more times in its body.
Eg: def factorial (n):
if n = =1:
return 1
else
return n* factorial (n -1)

Samacheer Kalvi TN State Board 12th Computer Science Important Questions Chapter 7 Python Functions

Question 38.
Explain the scope of variables with on example.
Answer:
(i) Scope of variable refers to the part of the program, where it i§ accessible. There are two types of scopes, local scope and global scope.
(ii) Local scope: A variable declared inside the function’s body or in the local scope is known as local variable.

A variable with local scope can be accessed only within the function or block that it is created in. The format arguments are also local to function.
Eg: Creating a local variable
def lva ():
y=0 # local scope
print (y)
lva ()
The output as 0.

(iii)Global scope: A variable, with global scope can be used anywhere in the program, ft can be created by defining a variable outside the scope of any function or block.

When we define a variable outside a function. It’s global by default. We use global variable inside a function, but use of outside a function has no effect.
Eg: a=1 # global variable.
def x ():
print (a)
x()
The output as 1

Samacheer Kalvi TN State Board 12th Computer Science Important Questions Chapter 7 Python Functions

Question 39.
Explain the following built-in functions
(a) id( )
(b) chr ( )
(c) round ( )
(d) type ( )
(e) pow ( )
Answer:
(a)id () :
It return the identity of an object, that is the address of the object in memory.
The syntax is id (object)
Eg: x = 10
print id (x)
The output is 13480785 (This is memory address)

(b)chr () :
It returns the Unicode character
for the given ASCII value. The syntax is
chr (i)
Eg:
x = 65
print (chr(x))
The output will printed as A

(c) round ( ):
It returns the nearest integer to its input. The syntax is round (number, [n digits])
number – specify the value to be rounded
n digits – specify the number of decimal digits desired after rounding.
Eg:
x= 18.9
y =11.29
print (round (x))
print (round (nl, 1))
The output are 19 11.3

(d)ype ( ) :
It returns the type of object for the given single object. The syntax is type (object)
Eg:
x= 15.2 y = ‘a’
print (type (x)) print (type (y))
The output are <class ‘float’>
<class ‘str’>

(e) pow ():
It returns the computation of ab. i.e., (a**b) a raised to the power of b. The syntax is pow (a,b)
Eg:
a = 3
b = 2
print (pow (a,b))
print (pow (a+b, b))
The output are
9
25

Samacheer Kalvi TN State Board 12th Computer Science Important Questions Chapter 7 Python Functions

Question 40.
Write a python code to find the L.C.M of two numbers.
Answer:
# python code to find LCM
num1 = int (input (“Type the first number”))
num2 = int (input (“Type the second number”))
print (“The LCM of’, numl, “and”, num2, “is”, 1cm (numl, num2))
def lcm (x,y):
if x>y: # choose the greater number.
greater = x
else
greater = y
while (True):
if (greater % x=0) and (greater % y==0):
1cm = greater
break
greater +=1
return 1cm

Question 41.
Explain recursive function with an example.
Answer:
(i) Functions that calls itself is known as recursive function.
(ii) Recursion works like loop but something it makes more sense to use recursion than loop, you can convert any loop to recursion.
(iii) A recursive function, condition that is applied in any recursive function is known as base condition.
(iv) A base condition is must in every recursive function otherwise it will continue to execute like an infinite loop.
(v) If the base condition is met then the program gives meaningful output and exits.
(vi) Otherwise, function does some required processing and then calls itself to continue recursion.
Eg: def factorial (x):
if x=0:
return 1
else:
return x * factorial (n-1)

Samacheer Kalvi TN State Board 12th Computer Science Important Questions Chapter 7 Python Functions

Question 42.
def printnos (*nos):
for n in nos:
print(n)
return
# now invoking the printnos() function
print (‘Printing two values’)
printnos (1,2)
print (‘Printing three values’)
printnos (10,20,30)
In the above program change the function name printnos as printnames in all places wherever it is used and give the appropriate data Ex. printnos (10, 20, 30) as printnames . (‘mala’, ‘kala’, ‘bala’) and see output.
Answer:
Output:
Printing two names
Mala
Kala
Printing three names
Mala
Kala
Bala

Samacheer Kalvi TN State Board 12th Computer Science Important Questions Chapter 7 Python Functions

Question 43.
Try the following code in the program:
Answer:

TN State Board 12th Computer Science Important Questions Chapter 7 Python Functions 1

Question 44.
Evaluate the following furfctions and write the output:
Answer:

TN State Board 12th Computer Science Important Questions Chapter 7 Python Functions 2

Samacheer Kalvi TN State Board 12th Computer Science Important Questions Chapter 7 Python Functions

Question 45.
Evaluate the following functions and write the output:
Answer:

TN State Board 12th Computer Science Important Questions Chapter 7 Python Functions 3

Samacheer Kalvi TN State Board 12th Computer Science Important Questions Chapter 7 Python Functions

Choose the best answer:

Question 1.
In python, statements in a block are written with:
(a) indentation
(b) keyword
(c) return
(d) colon
Answer:
(a) indentation

Question 2.
Which will be displayed as the last statement of the output, if the return has no argument?
(a) True
(b) False
(c) None
(d) No
Answer:
(c) None

Question 3.
How many types of functions that arguments are used to call a function?
(a) 2
(b) 3
(c) 4
(d) 5
Answer:
(c) 4

Samacheer Kalvi TN State Board 12th Computer Science Important Questions Chapter 7 Python Functions

Question 4.
There are not specified in the function’s definition which character is used to define such arguments?
(a) #
(b) *
(c) !
(d) /
Answer:
(b) *

Question 5.
Which is called Non-keyword variable arguments?
(a) tuples
(b) lambda
(c) return
(d) Recursion
Answer:
(a) tuples

Question 6.
Which function is return the ASCII value for the given character?
(a) chr ( )
(b) ord ( )
(c) type ( )
(d) format ( )
Answer:
(b) ord ( )

Samacheer Kalvi TN State Board 12th Computer Science Important Questions Chapter 7 Python Functions

Question 7.
Match the following:

(i) User – defined unctions  (A) in – built
(ii) built – in functions  (B) itself
(iii) umbda functions  (C) themselves
(iv) Recursion functions  (D) anonymous

(a) (i) – C, (ii) – D, (iii) – B, (iv) – A
(b) (i) – C, (ii) – A, (iii) – D, (iv) – B
(c) (i) – B, (ii) – D, (iii) – C, (iv) – A
(A) (i) – B, (ii) – C, (iii) – A, (iv) – D
Answer:
(b) (i) – C, (ii) – A, (iii) – D, (iv) – B

Question 8.
Match the following:

(i) Required arguments  (A) invoke the unction
(ii) keyword arguments  (B) correct aositional
(iii) default arguments  (C) pass more arguments
(iv) variable length argument  (D) default value

(a) (i) – B, (ii) – A, (iii) – D, (iv) – C
(b) (i) – B, (ii) – C, (iii) – D, (iv) – A
(c) (i) – C, (ii) – A, (iii) – B, (iv) – D
(d) (i) – C, (ii) – B, (iii) – D, (iv) – A
Answer:
(a) (i) – B, (ii) – A, (iii) – D, (iv) – C

Question 9.
Match the following:

(i) abs( )  (A) retums the unary code
(ii) ard( )  (B) retums absolute /alue
(iii) chr ( )  (C) retums ascii /alue
(iv) in( )  (D) retums Unicode

(a) (i) – B, (ii) – D, (iii) – A, (iv) – C
(b) (i) – B, (ii) – C, (iii) – D, (iv) – A
(c) (i) – D, (ii) – C, (iii) – B, (iv) – A
(d) (i) – D, (ii) – B, (iii) – A, (iv) – C
Answer:
(b) (i) – B, (ii) – C, (iii) – D, (iv) – A

Samacheer Kalvi TN State Board 12th Computer Science Important Questions Chapter 7 Python Functions

Question 10.

(i) ceil ( ) (A) returns the truncated integer
(ii) floor ( ) (B) returns the accurate floating values
(iii) trunk ( ) (C) Returns smallest integer
(iv) fsum ( ) (D) returns the largest integer

(a) (i) – C, (ii) – D, (iii) – A, (iv) – B
(b) (i) – C, (ii) – A, (iii) – B, (iv) – D
(c) (i)- B, (ii) – D, (iii) – A, (iv) – C
(d) (i) – B, (ii) – C, (iii) – A, (iv) – D
Answer:
(a) (i) – C, (ii) – D, (iii) – A, (iv) – B

Question 11.
Choose the incorrect pair:
(a) Scope – part of program
(b) local – Inside function
(c) global – anywhere in the program
(d) lambda – python structure
Answer:
(d) lambda – python structure

Question 12.
Choose the correct pair:
(a) type ( ) – return the minimum value
(b) id ( ) – return the maximum value
(c) round ( ) – return the nearest integer
(d) format ( ) – return the hexa decimal value
Answer:
(c) round ( ) – return the nearest integer

Samacheer Kalvi TN State Board 12th Computer Science Important Questions Chapter 7 Python Functions

Question 13.
Choose the incorrect statement:
(a) When a function calls itself is known as recursion.
(b) Recursion works like loop.
(c) Recursive function is called by some external code.
(d) A base condition is not must in every recursive function.
Answer:
(d) A base condition is not must in every recursive function.

Question 14.
Choose the correct statement:
(a) Function blocks begin with the keyword fun.
(b) return statement is must in python.
(c) Python statements in a block should begin with indentation.
(d) A block within a block is called a loop.
Answer:
(c) Python statements in a block should begin with indentation.

Question 15.
Assertion (A):
Python keywords should not be used as function name.
Reason (R):
Function blocks begin with def followed by function name and parenthesis ().
(a) Both A and R are true and R is the correct explanation for A.
(b) Both A and R are true, but R is not the correct explanation for A
(c) A is true but R is false.
(d) A is false but R is true.
Answer:
(a) Both A and R are true and R is the correct explanation for A.

Samacheer Kalvi TN State Board 12th Computer Science Important Questions Chapter 7 Python Functions

Question 16.
Assertion (A):
Functions help us to divide a program into modules.
Reason (R):
This makes the code very difficult to manage.
(a) Both A and R are true and R is the correct explanation for A.
(b) Both A and R are true, but R is not the correct explanation for A
(c) A is true but R is false.
(d) A is false but R is true.
Answer:
(c) A is true but R is false

Question 17.
Pick the odd one out:
(a) min ()
(b) max ()
(c) floor ()
(d) sum ()
Answer:
(c) floor ()

Question 18.
Which of the following provides better modularity for python program?
(a) Function
(b) Statement
(c) Recursive
(d) Scope
Answer:
(a) Function

Samacheer Kalvi TN State Board 12th Computer Science Important Questions Chapter 7 Python Functions

Question 19.
Which of the following statement exit function?
(a) exit
(b) return
(c) pass
(d) continue
Answer:
(b) return

Question 20.
In python, statement in a block are written with:
(a) Function
(b) Statement
(c) Identification
(d) Parameters
Answer:
(c) Identification

Question 21.
What will be the output if the return has no argument?
(a) Exit
(b) Return
(c) Stop
(d) None
Answer:
(d) None

Samacheer Kalvi TN State Board 12th Computer Science Important Questions Chapter 7 Python Functions

Question 22.
Which of the following are the values pass to the function parameters?
(a) Identifier
(b) Variables
(c) Function
(d) Arguments
Answer:
(d) Arguments

Question 23.
Which keyword is used to define anonymous function?
(a) Def
(b) Alpha
(c) Gamma
(d) Lambda
Answer:
(d) Lambda

Question 24.
Print (ord (A)), the output is:
(a) 60
(b) 62
(c) 65
(d) 66
Answer:
(c) 65.

Samacheer Kalvi TN State Board 12th Computer Science Important Questions Chapter 7 Python Functions

Question 25.
Print (chr (43)), the output is:
(a) +
(b) –
(c) /
(d) *
Answer:
(a) +

Question 26.
print (round(14.9)), the output is:
(a) 14
(b) 15
(c) 14.9
(d) 9
Answer:
(b) 15

Question 27.
print (round (14.9657, 2)), the output will be as:
(a) 14.9657
(b) 14.2
(c) 14.96
(d) 14.57
Answer:
(c) 14.96

Samacheer Kalvi TN State Board 12th Computer Science Important Questions Chapter 7 Python Functions

Question 28.
What is output print(math.sqrt(100))?
(a) 10.0
(b) 100.0
(c) 10.10
(d) 10.22
Answer:
(a) 10.0

Question 29.
What is output print(math.ceil(~25.7))?
(a) -26
(b) -25
(c) -25.7
(d) 25
Answer:
(b) -25

Samacheer Kalvi TN State Board 12th Computer Science Important Questions Chapter 7 Python Functions

Question 30.
Non-keyword variables arguments are called:
(a) tuples
(b) list
(c) pairs
(d) list
Answer:
(a) tuples

Question 31.
A named blocks of code that are. designed to do one specific job is called as:
(a) Loop
(b) Branching
(c) Function
(d) Block
Answer:
(c) Function

Question 32.
A Function which calls itself is called as:
(a) Built-in
(b) Recursion
(c) Lambda
(d) return
Answer:
(b) Recursion

Samacheer Kalvi TN State Board 12th Computer Science Important Questions Chapter 7 Python Functions

Question 33.
Which function is called anonymous un-named function?
(a) Lambda
(b) Recursion
(c) Function
(d) define
Answer:
(a) Lambda

Question 34.
Which of the following keyword is used to begin the function block?
(a) define
(b) for
(c) finally
(d) def
Answer:
(d) def

Question 35.
Which of the following keyword is used to exit a function block?
(a) define
(b) return
(c) finally
(d) def
Answer:
(b) return

Samacheer Kalvi TN State Board 12th Computer Science Important Questions Chapter 7 Python Functions

Question 36.
While defining a function which of the following symbol is used:
(a) ; (semicolon)
(b). (dot)
(c) : (colon)
(d) $ (dollar)
Answer:
(c) : (colon)

Question 37.
In which arguments the correct positional order is passed to a function?
(a) Required
(b) Keyword
(c) Default
(d) Variable-length
Answer:
(a) Required

Samacheer Kalvi TN State Board 12th Computer Science Important Questions Chapter 7 Python Functions

Question 38.
Read the following statement and choose the correct statement(s).
(I) In Python, you don’t have to mention the specific data types while defining function.
(II) Python keywords can be used as function name.
(a) I is correct and II is wrong
(b) Both are correct
(c) I is wrong and II is correct
(d) Both are wrong
Answer:
(a) I is correct and II is wrong

Question 39.
Pick the correct one to execute the given statement successfully.
if : print(x, “ is a leap year”)
(a) x%2=0
(b) x%4==0
(c) x/4=0
(d) x%4=0
Answer:
(b) x%4==0

Samacheer Kalvi TN State Board 12th Computer Science Important Questions Chapter 7 Python Functions

Question 40.
Which of the following keyword is used to define the function test python(): ?
(a) define
(b) pass
(c) def
(d) while
Answer:
(c) def

 

TN Board 12th Computer Science Important Questions