Class 11 Computer Science Chapter 5 Functions In Python Quiz 7 (44 MCQs)

Quiz Instructions

Select an option to see the correct answer instantly.

1. What is the output of fruits.clear() if fruits = ['apple', 'banana', 'cherry']?
2. What is a local variable?
3. What is the purpose of using functions in programming?
4. Which keyword is used to send a value back from a function in Python?
5. What is the purpose of modularization in programming?
6. User can change the functionality of a built in functions.
7. What is the output of the following code? "'pythoncount = 0def increment():global count count += 1increment()print(count) "'
8. How do you use the dir() function in Python?
9. Which keyword marks the beginning of the function block
10. What is the scope of variables declared at the top level of a module or directly in the interpreter?
11. Can a function call itself in Python? If yes, what is it called?
12. Which of the following statements is true about functions in Python?
13. Fill in the line of code for calculating the factorial of a number.def fact(num):if num == 0:return 1 else:return .....
14. When large programs are broken down into smaller units known as .....
15. How do you pass a lambda function as an argument to another function in Python?
16. Def fun1(x, y):x = x + y y = x-y x = x-y print('a =', x) print('b =', y) a = 5 b = 3 fun1(a, b)
17. Which type of loop in Python is used when a set of statements needs to be executed repeatedly based on a condition?
18. What is the syntax for a function with required arguments?
19. How do you access the first character of a string?
20. Python passes arguments to function by
21. What function can be used to split a string into a list?
22. What is the purpose of an IPO chart?
23. When defining a function, the definition must occur before it is called.
24. Divya wants to print the identity of the object used in the function. Which of the following functions is used to print the same?
25. Which of the following describes a user-defined function?
26. Which of the following is true about the 'not in' operator?
27. What is the name given to that area of memory, where the system stores the parameters and local variables of a function call?
28. What is the output of the following code? "'pythondef greet():return "Hello!"print(greet()) "'
29. What is the syntax for calling a function in Python?
30. What is a standard module in Python?
31. Which type of function is a separate file containing functions and variables?
32. For a function header as follows:def Calc(X, Y = 20):Which of the following function calls will give an error?
33. What does the 'return' statement in a function allow you to do?
34. What will the following code output? def greet(name):print('Hello', name); greet('Alice')
35. Which of the following is a valid way to pass parameters to a function in Python?
36. Function sqrt() is available under which module of python?
37. How can you create a copy of a list in Python?
38. What will be printed by the following code? "'pythondef print ..... message(msg):print(msg)result = print ..... message("Hello, Year 11!")print(result) "'
39. Which is the most appropriate definition for recursion?
40. A(n) ..... is the part of a program in which a variable may be accessed.
41. Which function is called anonymous unnamed function
42. Can a lambda function have multiple arguments in Python?
43. When a variable is inside of a function what do you call its scope?
44. If you want to remove and return the last element of a list, which method would you use?