Python Functions – Working with Functions MCQ’s
Multiple Choice Questions [MCQs] Set – 3
41. When the function call statement must match the number and order of arguments as defined in the function definition, this is called the ___________ matching.
a) Positional Arguments
b) Default Arguments
c) Keyword Arguments
d) None of these
42. Which of the following statement is not true in respect to Postitional/Required arguments function call statement?
a) the arguments must be provided for all parameters.
b) the type of the argument must be matched.
c) the values of arguments are matched with parameters, position wise.
d) None of these
43. Positional arguments are also know as mandatory arguments.
a) True
b) False
44. Which of the following statements are true for Mandatory / Required / Positional arguments?
a) No values can be skipped from function call.
b) Order of arguments cannot be change in function call.
c) cannot assign value of first argument to third parameter.
d) All of these
ci = p * ( 1 + r/100)**t – p
45. Which of the following function call statement is Invalid?
def compoundInterest(p, r, t):
ci = p * ( 1 + r/100)**t - p
return ci
a) interest = compoundInterest(100, rate, 5)
b) interest = compoundInterest(prin, rate, time)
c) interest = compoundInterest(500, 10)
d) None of these
46. In Python, can you assign a default value to the parameter?
a) Yes
b) No
47. A ________ is a value that is pre-decided and assigned to the parameter when the function call does not have its corresponding argument.
a) no value
b) value
c) default value
d) All of these
48. The default value is specified in a manner syntactically similar to a ________.
a) required arguments
b) variable initialization
c) function definition
d) None of these
49. A parameter having default value in the function header is known as a ________.
a) formal parameter
b) actual parameter
c) default parameter
d) None of these
50. ________ arguments cannot follow default argument.
a) Non-default
b) Default
c) Actual argument
d) None of these
51. A parameter having a default value in function header becomes ________ in function call.
a) mandatory
b) required
c) optional
d) None of these
52. Default values are considered only when _________ .
a) no value is provided for that parameter in function call.
b) function is not called.
c) function is called with all parameters.
d) None of these
53. In the given code, which argument has default value.
def compoundInterest(principal, rate, time = 5):
ci = p * ( 1 + r/100)**t - p
return ci
a) principal
b) rate
c) time
d) None of these
54. On the basis of the given code, Identify which of the function call statement is invalid?
def compoundInterest(principal, rate, time = 5):
ci = p * ( 1 + r/100)**t - p
return ci
a) t = compoundInterest(5000, 10, 15)
b) t = compoundInterest(5000, 15)
c) t = compoundInterest(5000)
d) None of these
55. Why the given function definition is not valid?.
def compoundInterest(principal, rate = 10, time):
ci = p * ( 1 + r/100)**t - p
return ci
a) because non-default arguments follow the default argument.
b) because the value of variable rate is not valid.
c) because the use of return statement is invalid.
d) None of these
56. Identify the valid function header?
a) def sum( p=5, q, r = 15) :
b) def sum(p, q = 10, r) :
c) def sum(p = 5, q, r ) :
d) def sum(p = 5, q = 10, r = 15) :
57. Identify the valid function header?
a) def sum( p=5, q, r = 15) :
b) def sum(p, q = 10, r) :
c) def sum(p , q, r = 15 ) :
d) def sum(p = 5, q = 10, r ) :
58. Find the output of given code:
def func(x , y = 5, z = 10):
x = y + z
return x + z
print( func(10), func(10, 15), func(10, 15, 25))
a) 15 25 35
b) 25 35 65
c) 35 65 85
d) None of these
59. ________ type of function call provide you facility to write any argument in any order.
a) Default argument
b) Keyword argument
c) Required argument
d) None of these
60. Which of the following function header is the Keyword (named) arguments function?
a) def sum( x, y, z) :
b) def sum( x, y , z = 20) :
c) def sum( x = 20, y = 10, z = 5) :
d) None of these
Python Functions – Working with Functions (MCQ’s)
- Class 12 Computer Science Python Functions – Working with Functions MCQs Set – 1
- Class 12 Computer Science Python Functions – Working with Functions MCQs Set – 2
- Class 12 Computer Science Python Functions – Working with Functions MCQs Set – 3
- Class 12 Computer Science Python Functions – Working with Functions MCQs Set – 4
- Class 12 Computer Science Python Functions – Working with Functions MCQs Set – 5
- Class 12 Computer Science Python Functions – Working with Functions MCQs Set – 6
Python Revision Tour – Multiple Choice Questions (MCQ’s)
- Class 12 Computer Science MCQs Python Revision Tour Set – 1
- Class 12 Computer Science MCQs Python Revision Tour Set – 2
Python File Handling (MCQ’s)
- Class 12 Computer Science File Handling in Python MCQs Set 1
- Class 12 Computer Science File Handling in Python MCQs Set 2
- Class 12 Computer Science File Handling in Python MCQs Set 3
- Class 12 Computer Science File Handling in Python MCQs Set 4
- Class 12 Computer Science File Handling in Python MCQs Set 5
- Class 12 Computer Science File Handling in Python MCQs Set 6
- Class 12 Computer Science File Handling in Python MCQs Set 7
- Class 12 Computer Science File Handling in Python MCQs Set 8
- Class 12 Computer Science File Handling in Python MCQs Set 9
Class 12 Computer Science NCERT Book Exercise Solutions
- Interface Python with MySQL – Important Questions – Answer
- Class 12 Computer Science – Exception Handling in Python NCERT Exercise Solutions
- Class 12 Computer Science File Handling in Python NCERT Exercise solution
- Class 12 Computer Science Stacks NCERT Exercise Solution
- Class 12 Computer Science Queues NCERT Exercise Solution