Class 12 Computer Science Python Functions – Working with Functions MCQs Set – 4

Python Functions – Working with Functions MCQ’s

Multiple Choice Questions [MCQs] Set – 4

61. Identify the valid rules for combining all three types of arguments.

a) an argument list must first contain positional argument followed by any keyword argument.

b) Keyword arguments should be taken from the required arguments.

c) Value for one argument can not specify more than once.

d) All of these

Answer : d) All of these

62. Identify the invalid function call statement for the given function definition.

``````def interest(prin, time = 2, rate = 0.05):
return prin * time * rate
``````

a) interest( prin = 4000)

b) interest( rate = 0.10, time = 5)

c) interest( time = 2, prin = 1000)

d) interest(3000, rate = 0.20, time = 4)

Answer : b) interest (rate = 0.10, time = 5)

Reason : A required argument prin is missing.

63. The functions that return some computed result in terms of a value, known as __________ function.

a) void

b) non-void

c) null

d) All of these

64. The functions that do not return any computed result in terms of a value, known as __________ function.

a) void

b) non-void

c) null

d) All of these

65. Functions returning a value are also known as _______ functions.

a) fruitful

b) useful

c) voidful

d) None of these

66. The value being returned by a function can be _______ .

a) a litereal

b) a variable

c) an expression

d) All of these

Answer : d) all of these

67. How this statement (Line 1) is substitute internally:

``````def sum(x, y):
return x + y
result = sum(10 + 5) #Line1``````

a) result = sum(10 + 5)

b) result = 10 + 5

c) result = 15

d) All of these

Answer : c) result = 15

68. Identify which of the following function is a void function?

a)

``````def sum(x , y):
return x + y``````

b)

``````def power (x , y):
return x ** y``````

c)

``````def cube(x):
print( x ** 3)``````

d) None of these

``````def cube(x):
print( x ** 3)``````

69. Identify which of the following function is a void function?

a)

``````def mean(x , y):
print ( (x + y)/2)
return``````

b)

``````def power (x , y):
print( x ** y)
return ``````

c)

``````def greet(name):
print( "Hello, dear ",name)``````

d) All of these

Answer : d) All of these

70. Identify which of the following function is a fruitful function?

a)

``````def sum(x , y):
return x + y``````

b)

``````def power (x , y):
return x ** y
print( x ** y)``````

c)

``````def cube(x):
print( x ** 3)
return x**3``````

d) All of these

Answer : d) All of these

71. Every void function returns _______ value to its caller. .

a) No Value

b) Null

c) None

d) All of these

72. Find the output :

``````def welcome(name):
print("Hello", name)
t = welcome("anjeev")
print(t)``````

a) Hello anjeev
None

b) None Hello anjeev

c) Hello anjeev None

d) None of these

None

73. Find the output:

``````def pattern():
print("@@@")
print(pattern)``````

a) @@@

b) @@@ None

c) @@@

None

d) All of these

None

74. Find the output:

``````def pattern():
return "@@@"
print(pattern)``````

a) @@@

b) @@@ None

c) @@@

None

d) All of these

75. Does a function return multiple values in Python?

a) No

b) Yes

76. Find the output:

``````def compute(x, y):
return x**y, y**x
t = compute(4, 2)
print(t)``````

a) (16, 16)

b) (8, 8)

c) (8, 16)

d) (16, 8)

77. Find the output:

``````def compute(x, y):
return x**y, y**x
t = compute(4, 2)
print(type(t))``````

a) <class ‘int’>

b) <class ‘float’>

c) <class ‘list’>

d) <class ‘tuple’>

78. Find the output:

``````def compute(x, y):
return x**y, y**x
m, n = compute(5, 2)
print(m)``````

a) 25 32

b) 25

c) 32

d) (25, 32)

79. Find the output:

``````def compute(x, y):
return x**y, y**x
m, n = compute(5, 2)
print(n, m, sep='#')``````

a) 32 25

b) 25 32

c) 25#32

d) 32#25

80. Find the output:

``````def compute(x, y):
return x**y, y**x
m, n = compute(5, 2)
print(n, m, sep='#', end = "=>")``````

a) 32 #=>25

b) 25#32

c) 25#

=>32

d) 32#25