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

Quiz Instructions

Select an option to see the correct answer instantly.

1. What does the function header contain?
2. What is the purpose of a user-defined function?
3. How do you call a function named 'calculate ..... sum' in Python?
4. What is the output of the following code? "'pythondef sum ..... and ..... diff(a, b):return a + b, a-bresult = sum ..... and ..... diff(7, 3)print(result) "'
5. What is the output of the following code:'print((lambda x:x / 2)(8))'?
6. What does the return statement do in a function?
7. By default, if you return multiple values separated by commas, then it is returned as
8. Which of the following condition is true?
9. How do you call a lambda function in Python?
10. Aman wants to write a function in Python but doesn't know how to start it. Select the keyword used to start a function out of the following.
11. What does the random function return?
12. Identify the function that returns the number of items in a list.
13. Pick one from the following statements to correctly complete the function body to get the output 5 in the given code snippet:def f(number):#missing function bodyprint(f(5))
14. A ..... is a variable that is created inside a function.
15. What does the index() method return?
16. If you want to find the maximum value in a list, which method would you use?
17. Which of the following is the correct way to catch any exception in Python?
18. What will be printed by the following code? "'pythondef test():y = 5 print(y)test()print(y) "'
19. How can you convert a string to uppercase in Python?
20. Predefined functions that are already available in Python are known as
21. Which of the following is used to return a result from a function?
22. Which of the following keyword is used to begin the function block?
23. Suppose list1 is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after list1.pop(1)?
24. What is the purpose of using subroutines in programming?
25. What is the output of the following code? def print ..... is ..... positive(n):if n > 0:print('Positive'); else:print('Negative'); print ..... is ..... positive(-5)
26. A Function that does not have any return value is known as .....
27. What is a parameter in the context of functions?
28. What is the output of the following code:'print((lambda x:x**2)(5))'?
29. What is the output of the function shown below (random module has already been imported)?random.choice('sun')
30. What does the function sqrt(x) return?
31. Function may or may not return a value
32. The ..... of a variable is the area of a program where it may be referenced
33. Which of the following is TRUE about global variables?
34. What is the format for writing a value-returning function?
35. What does the following function return? "'pythondef test():passprint(test()) "'
36. What happens if the function is not called?
37. The code block of function always comes after a .....
38. Assertion (A):Built in function are predefined in the language that are used directlyReason (R):print( ) and input( ) are built in functions
39. The first line of a function definition is known as the .....
40. Recall what will a function return if there is no return statement.
41. Def fun1(a, b):return a+b, a=b, a*b, a/ba=fun1(10, 2)Here a will be created as
42. How can you check the type of a variable in Python?
43. Which Python function returns the length of a string or a list?
44. Assertion. A parameter having a default in function header becomes optional in function call.Reason. A function call may or may not have values for default arguments.
45. Predict the output, if the value passed for the given function is 2.def game(x):return 4**x
46. What type of argument is passed during function definition?
47. What is the purpose of the 'break' statement in Python?
48. Read the following statements and then select the answer:Statement A:Default arguments can be used to add new parameters to the existing functionsStatement B:Default arguments can be used to combine similar functions into one
49. What is the output of the following Python code?print(round(51.6))
50. What will be the output of the following code? "'pythondef max ..... value(a, b):if a > b:return a else:return bresult = max ..... value(5, 10)print(result) "'
51. What is the output of the following code? def main():print('This is python'); main()
52. What is the order of resolving scope of a name in a python program?
53. Which of the following is a valid use of a lambda function?
54. Which of the following is a characteristic of a parameterized function?
55. A function can be with or without returning any values.
56. What is the correct way to define a function that returns nothing?
57. Which method reverses the order of elements in a list?
58. What happens if the base condition isn't defined in recursive programs?
59. What is the output of the following code:'print((lambda x:x-2)(10))'?
60. What is the term for a function that calls itself in Python?