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

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

Answer : 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

Answer : a) 2512

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

Answer : c) scope

84. A variable can have one of the _____ scopes.

a) one

b) two

c) three

d) None of these

Answer : b) two

85. What is the possible scope of a variable?

a) Global

b) Local

c) Either Global or Local

d) None of these

Answer : c) Either Global or Local

86. A variable that has global scope is known as ________ variable.

a) Global

b) Local

c) Either Global or Local

d) None of these

Answer : a) Global

87. A variable that has local scope is known as ________ variable.

a) Global

b) Local

c) Either Global or Local

d) None of these

Answer : b) Local

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

Answer : b) outside

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

Answer : b) inside

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

Answer : a) local

91. A ______ variable can be accessed any where in the program.

a) local

b) global

c) Both (a) and (b)

d) None of these

Answer : b) global

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

Answer : b) num -> global, num -> local

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

Answer : a) 20 25

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

Answer : b) 25@20#

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

Answer : c) 20 20

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

Answer : a) global statement

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

Answer : b) LEGB

97. In LEGB, L stands for ______?

a) Local environment

b) Low level environment

c) Legal environment

d) None of these

Answer : a) Local environment

98. In LEGB, E stands for ______?

a) Entry environment

b) Enclosing environment

c) Exit environment

d) None of these

Answer : b) Enclosing environment

99. In LEGB, G stands for ______?

a) Good environment

b) Global environment

c) Green environment

d) None of these

Answer : b) Global environment

100. In LEGB, B stands for ______?

a) Built-in environment

b) Basic environment

c) Beginning environment

d) None of these

Answer : a) Built-in environment



More MCQ’s are by 19-12-2021 11:00 pm
Keep Visiting www.mycstutorial.in
Important for Term 1 Examination


Python Functions – Working with Functions (MCQ’s)



Python Revision Tour – Multiple Choice Questions (MCQ’s)



Python File Handling (MCQ’s)



Class 12 Computer Science NCERT Book Exercise Solutions


You cannot copy content of this page

Scroll to Top