Page 223 - Computer Science V2.0 Class 11
P. 223
4. Which of the following marks the function body?
a. # b. Indentation c. A set of parentheses d. A set of curly brackets
5. Which of the following statements is used to return a value to the calling function?
a. return b. RETURN c. Return d. functionReturn
6. Consider the following statements:
Statement 1: A statement in a function is executed when the function is called.
Statement 2: A function can be called multiple times.
a. Statement 1 is correct, but Statement 2 is incorrect
b. Statement 2 is correct, but Statement 1 is incorrect
c. Both Statement 1 and Statement 2 are correct
d. Both Statement 1 and Statement 2 are incorrect
7. Which of the following is not a built-in function in Python?
a. print() b. input() c. int() d. sqrt()
8. What will be the output on the execution of the following expression?
>>> eval('3 * 4')
a. 3 * 4 b. 12 c. 7 d. Error
9. Which of the following functions is used to convert an integer to a string?
a. str() b. string() c. int() d. integer()
10. What will be the output on the execution of the following instruction?
>>> divmod(28, 4)
a. 7 , 0 b. (7, 0) c. 7 d. 0
11. What will be the output on the execution of the following instruction?
>>> pow(2, 3, 3)
a. 512 b. 2 c. 729 d. 5
12. What will be the output produced on execution of the following instruction?
>>> round(-14.2990435981, 2)
a. -14.3 b. -14.299 c. -14.30 d. -14.4
13. Which of the following is returned to the function caller if there is no return statement in the function definition?
a. 0 b. -1 c. None d. Error
B. State whether the following statements are True or False:
1. It is compulsory to give parameters while defining a function. __________
2. The rules for naming a function are the same as rules for naming any identifier. __________
3. The return statement in a function definition is compulsory. __________
4. A function can be called before it is defined. __________
5. The parameters in the function header are separated using a colon. __________
6. Both parameters and arguments can have the same name. __________
7. A function is a sub-program. __________
8. A function defined in a program can be called only once in the program. __________
9. The statements in the body of a function are executed when Python encounters the definition of the function. __________
10. Formal parameters in the definition of a function and actual parameters in a call to a function can
have the same name. __________
11. Default parameters cannot be skipped in a function call. __________
12. The following is a valid example of function heading: __________
def test(num1=10, num2):
Introduction to Functions 209

