Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 1

Worksheet – Functions

1. Name the keyword used to define functions


2. Which statement is used to send result produced in function back to the program?
3. Name some built in functions that can be used without importing modules.
4. Which built in function gives the data type of objects?
5. Which statement is the function header?
6. What is the name given to the top level statements of Python program
7. From which statement of the program does execution begin?
8. Identify the argument and parameter in the following code segment.
def add(a,b,c):
return (a+b+c)
print(add(10,12,13))
9. Which are the different types of parameter types used in Python?
10. Identify the type of parameter type used in the following.
def check(m,n,p)
11. Name the variable containing the name of the top level statements.
12. Which parameter method helps us to change the order of parameters in function
call?
13. How can we return multiple values from function?
14. Will statement 1 get executed in the following code segment?
def prn(a,b):
a=a+10
b=b-20
return (a*b)
print(a*b) # Statement 1
print(prn(20,50))
15. Which of the following are valid and invalid. Justify your answers
check_pali() , 20average(), Print(), id()
16. Name the built in function that is used to obtain the ordinal value of a character
passed.
17. Underline the errors in the following code segment.
Def sum_age(a)
a=a+20
print(a)
#Main Program
Print(sum_age(20))
18. Identify the token that terminates a function header - ; : / +
19. Consider the following function headers and identify the correct and incorrect ones
a. def fun(a=2,b=3,c)
b. def fun(a=2,b,c=3)
c. def fun(a,b=2,c=3)
d. def fun(a,b,c=3,d)
20. What is the variable defined outside a function called?

You might also like