WorksheetsFunctions in Python
Total questions: 16
Worksheet time: 16mins
What term is used to describe data passed into a function?
Variable
Loop
Constant
Parameter
Leo wants to create a function that will roll a dice. Which is the correct function definition header?
def dice roll ():
def diceroll ()
def diceroll ():
def diceroll []:
__________ keyword is used for creating a function in Python.
define
fun
def
function
The default return value of any function in Python is _______________.
null
0
None
Garbage value
Select the advantages of functions
Modular programming
Code re-usability
Improving clarity of the code
All the above
What function is used to output a message in python?
print("")
input=name
name=input
What syntax would you use to create a name variable?
name=input()
input=name
name=input{}
name=INPUT
Why would you use a loop?
To repeat a piece of code
To create a loop
To input data
Which of the following items are present in the function header?
Function name only
Both function name and parameter list
parameter list only
Return value
What is the name given to that area of memory, where the system stores the parameters and local variables of a function call?
a heap
storage area
a stack
an array
What Is The Output Of The Following Code Snippet?
def func(message, num = 1):
print(message * num)
func('Welcome')
func('Viewers', 3)
Welcome
Viewers
Welcome
ViewersViewersViewers
Welcome
Viewers,Viewers,Viewers
Welcome
