Python Functions – Working with Functions MCQ’s
Multiple Choice Questions [MCQs] Set – 5
81. _______ refers to using an expression as part of a larger expression or a statement as a part of larger statement.
a) Function
b) Calling of Function
c) Composition
d) None of these
82. Find the output:
def compute(x, y):
return str(x) + str(len(y))
m = compute(25, 'mycstutorial')
print(m)
a) 2512
b) 25mycstutorial
c) 12mycstutorial
d) mycstutorial25
83. The part of the program where a variable is accessible can be defined as the _____ of that variable.
a) life
b) function
c) scope
d) None of these
84. A variable can have one of the _____ scopes.
a) one
b) two
c) three
d) None of these
85. What is the possible scope of a variable?
a) Global
b) Local
c) Either Global or Local
d) None of these
86. A variable that has global scope is known as ________ variable.
a) Global
b) Local
c) Either Global or Local
d) None of these
87. A variable that has local scope is known as ________ variable.
a) Global
b) Local
c) Either Global or Local
d) None of these
88. In Python, a variable that is defined ______ any function or any block is knows as a Global variable.
a) inside
b) outside
c) Either inside or outside
d) None of these
89. In Python, a variable that is defined ______ any function or any block is knows as a Local variable.
a) inside
b) outside
c) Either inside or outside
d) None of these
90. A ______ variable can be accessed only in the function or a block where it is defined.
a) local
b) global
c) Both (a) and (b)
d) None of these
91. A ______ variable can be accessed any where in the program.
a) local
b) global
c) Both (a) and (b)
d) None of these
92. Identify which variable is local and which one is global variable in the given code?
num = 25
def compute():
price = 50.36
compute()
a) num -> local, price -> global
b) num -> global, price -> local
c) num and price both global
d) None of these
93. Find the output:
num = 25
def compute():
num = 20
print(num, end=' ')
compute()
print(num)
a) 20 25
b) 25 20
c) 20 20
d) None of these
94. Find the output:
num = 25
def compute():
num = 20
print(num, end='#')
print(num, end = '@')
compute()
a) 20@25#
b) 25@20#
c) 25@
20#
d) None of these
95. Find the output:
num = 25
def compute():
global num
num = 20
print(num, end=' ')
compute()
print(num)
a) 20 25
b) 25 20
c) 20 20
d) None of these
96. _______ is used inside the function to prevent from creating a variable same name of global variable?
a) global statement
b) initialization statement
c) function calling statement
d) None of these
96. In Python, when you access any variable within a program or function, it follows _________ rule.
a) VAGB
b) LEGB
c) ELGB
d) None of these
97. In LEGB, L stands for ______?
a) Local environment
b) Low level environment
c) Legal environment
d) None of these
98. In LEGB, E stands for ______?
a) Entry environment
b) Enclosing environment
c) Exit environment
d) None of these
99. In LEGB, G stands for ______?
a) Good environment
b) Global environment
c) Green environment
d) None of these
100. In LEGB, B stands for ______?
a) Built-in environment
b) Basic environment
c) Beginning environment
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