Class 11 Computer Science Chapter 5 Functions In Python Quiz 3 (60 MCQs)

Quiz Instructions

Select an option to see the correct answer instantly.

1. Read the following statement and choose the correct statement(s)1.In python, you don't have to mention the specific data types while defining function2.Python keywords can be used as function names
2. Assertion. A variable declared inside a function cannot be used outside it.Reason. A variable created inside a function has a function scope.
3. What is the correct syntax to define a function with variable-length arguments in Python?
4. What is the scope of a variable defined inside a function?
5. Which of these is TRUE about a function that uses return?
6. What will the following code output? def multiply(x, y):return x * y; print(multiply(4, 5))
7. Which of the following is NOT a valid function parameter in Python?
8. Which of the following is a valid way to define a function with variable-length arguments?
9. ..... is a blank space in the beginning of a statement within a block.
10. Consider the line of code:Label('Go Team', 200, 100)What is the Label?
11. Which of the following is correct regarding an Argument?
12. You ..... a function to execute it.
13. What is the purpose of the main function?
14. Which type of function allows returning multiple values in Python?
15. What is the output of the following code? def sub(x, y):return x-y; print(sub(10, 5))
16. What is the correct way to call a function named 'calculate' with arguments '5' and '10'?
17. In which arguments the correct positional order is passed to a function?
18. Pick the correct one to execute the given statement successfully.if:print(x, "is a leap year")
19. Which of the following is the use of id() function in python?
20. Which of the following is not true about functions?
21. Recursion is similar to which of the following?
22. Which of the following is a correct way to define a function with two parameters?
23. What is the output of 'len('Hello')'?
24. Which of these in not a built in function?
25. Which of the following pertains to a piece of code that can take inputs to perform a specific task?
26. Which of the following is the correct way to define a function in Python that takes no parameters?
27. Which of the following is a correct way to use a lambda function to add 10 to each element in a list?
28. What is the output of the following code:'print((lambda x, y, z:x * y * z)(2, 3, 4))'?
29. What is the output of the following code? "'pythondef change():x = 5 return xx = 10print(change())print(x) "'
30. What is the difference between '==' and 'is' when comparing strings?
31. What is the correct syntax to define a function in Python?
32. Which of the following is NOT a valid lambda function?
33. What will be the output of the following code? "'pythondef concat(str1, str2):return str1 + str2result = concat("Hello, ", "World!")print(result) "'
34. What is the correct way to import a module in Python?
35. Explain the use of lambda functions in Python.
36. What will be printed by the following code? "'pythondef foo():a = 7 return aa = 3print(foo())print(a) "'
37. What will be the output of the following code? "'pythondef increment(x):x += 1 return xvalue = 5result = increment(value)print(result) "'
38. Assertion (A):There are various built in functions/methods to manipulate the dictionaries. Reason (R):Built in functions does not work on dictionaries.
39. The ..... of a variable is the area of the program where it may be referred.
40. What term is used to describe data passed into a function?
41. Values can be passed to the function using variables.
42. What is the general format for defining a function?
43. What will be the output of the following code? "'pythondef double(x):return x * 2result = double(7)print(result) "'
44. What are the reasons for using functions in programs,
45. A variable created or defined within a function body is
46. In Python, how do you call a subroutine named calculate ..... average from the main program?
47. What is the output of the following code? def main():i=4; a=add(4); print(a); main()
48. What is the correct way to define a function with a default parameter value?
49. What is the output of the function call print(add ..... five(square(4)))?
50. What does the range() function return in Python 3?
51. Which of the following is not a part of the python function?
52. Which of the following is true about the scope of variables in Python?
53. What does a negative step size in Python indicate?
54. Functions make code re-usable
55. What is the difference between an argument and a parameter?
56. What are keyword arguments in function calls?
57. What will be the output of the following code? def func(s):return len(s); print(func('Hello'))
58. What will be the output of the following code? "'pythondef power(base, exponent):return base ** exponentresult = power(2, 3)print(result) "'
59. How can you pass a list as an argument to a function in Python?
60. What is the default return value of a function that does not have a 'return' statement?