Class 11 Computer Science Chapter 5 Functions In Python Quiz 1 (60 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")) "'
26. What method would you use to replace a substring in a string?
27. In ..... arguments we can skip the default argument, but all the arguments should match the parameters in the function definitions.
28. Which statement about function parameters is TRUE?
29. What will be the output of the following code? "'pythondef subtract(a, b):return a-bresult = subtract(10, 4)print(result) "'
30. Select which of the following is NOT TRUE for Python function:
31. What is the correct syntax to call a function named 'calculate ..... Area'?
32. Do you call or define a function first?
33. In Python, if no value is provided in the function call, the argument takes (a) value.
34. How can you check if a substring exists within a string?
35. What are positional arguments in function calls?
36. Which of the following functions is a built-in function in python?
37. What is the output of the following code:'print((lambda x, y:x * y)(3, 4))'?
38. Which function returns the largest of its arguments?
39. Which of the following symbols always comes after a function code block?
40. Def info(object, spacing=10, collapse=1):# function headerconsider the following function call and find out whether it is validinfo(ob1)
41. Can a lambda function have multiple expressions in Python?
42. What does the map function in Python do?
43. What is the output of the following code? "'pythondef divide(a, b):try:return a / b except ZeroDivisionError:return "Cannot divide by zero"print(divide(10, 0)) "'
44. Def info(object, spacing=10, collapse=1):# function headerconsider the following function call and find out whether it is validinfo(spacing=15, object=obj4)
45. What is the output of the following code? "'pythonx = 10def show():print(x)show() "'
46. What is a void function?
47. When you use multiple type argument in function then default argument take place
48. How to call this function?def sayHello( ):print ( "Hello World!" )
49. Which of the following is the correct syntax for a lambda function?
50. Which of the following is a valid function name?
51. The values being passed through a function-call statement are called .....
52. What is returned by math.ceil(3.4)?
53. Select the advantages of functions
54. What will be the output of the following code? "'pythondef is ..... even(number):return number % 2 == 0result = is ..... even(4)print(result) "'
55. What type of variable is declared inside a function?
56. What is the output of the programx=50def func(x):x=2func(x)print("x value", x)
57. Which of the following statements is false about recursion
58. What does the 'strip()' method do to a string?
59. What is the output of the following Python code?num = 3print( float(num) )
60. What is the output of the following code:'list(map(lambda x:x**2, [1, 2, 3, 4]))'?