Class 11 Computer Science Chapter 5 Functions In Python Quiz 1 (25 MCQs)

Quiz Instructions

Select an option to see the correct answer instantly.

1. Why are functions useful in programming?
2. Functions provide ..... to problem solving
3. What is the output of the following code? def update ..... list(L):for i in range(len(L)):if L[i] % 2 == 0:L[i] += 2; update ..... list([2, 4, 6])
4. Assertion. A function is a subprogram.Reason. A function exists within a program and works within it when called.
5. What is a variable defined inside all the function referred to as?
6. Assertion (A):It is not possible to delete/remove the elements from a list. Reason (R):The pop(), remove(), del() functions are used to remove/delete the elements from the list.
7. What is the purpose of the randrange function?
8. What is the output of the following code:'print((lambda x:x + 1)(0))'?
9. What is the default start value in Python if it is not provided?
10. What will the following code output? def average(n):total = 0; for i in range(1, n + 1):total += i; return total / n; print(average(10))
11. Which of the following keyword is used to exit a function block?
12. How can you use a lambda function to map a list of numbers to their squares?
13. You can call a function only once after defining it.
14. How can you pass a list to a function in Python?
15. A Python module is a file with the ..... file extension that contains valid Python code.
16. What is the difference between mutable and immutable data types?
17. Which of the following is not a built-in function?
18. What does the following code print? def greet():print('Hello!') greet()
19. What is a subroutine in Python?
20. A Function which calls itself is called as
21. What will be the output of the following code? def add(j):if(j>=4):j=j*j else:j=j*2 return j; print(add(3))
22. A variable that's declared inside a function is ..... to that function
23. What will be the output of this program?def hello():print( "I am a beginner" )hello()hello()
24. What is the default return value for a function that does not return a value explicitly?
25. What will be the output of the following code? "'pythondef greet(name):return "Hello, '' + nameprint(greet("Alice")) "'