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

Quiz Instructions

Select an option to see the correct answer instantly.

1. Which of these statements about a function is correct?
2. What is the default behavior of the sort() method?
3. Def Fun ..... love(a, 20):print(a+20)is
4. How can you use a lambda function to sort a list of tuples by the second element?
5. If the return statement is not used in the function then which type of value will be returned by the function?
6. Which operator is used to check if a value exists in a sequence?
7. Which of the following cannot be converted in a recursion function?
8. The default value for a parameter is defined in function ..... ?
9. Which statement is correct to import all modules from the package
10. How do you print 'Hello' five times using a for loop?
11. Assertion (A):Built in function are predefined in the language that are used directly. Reason (R):print() and input() are built in functions.
12. What does the append() method do in Python lists?
13. Parameters are the (a) used in the function definition.
14. What will be the output of the following code? "'pythondef square(x):return x * xresult = square(3)print(result) "'
15. Which of the following is TRUE about procedures in Python?
16. What will be the output of the following code? "'pythondef multiply(x, y=2):return x * yresult = multiply(5)print(result) "'
17. Which of the following statements about return statements is FALSE?
18. Which keyword is used to return a value from a function in Python?
19. What is the output of the following code? def add():x, y = 4, 7; print('Sum:', x + y); add()
20. How can you specify a default value for a function parameter in Python?
21. What is a function in programming?
22. Leo wants to create a function that will roll a dice. Which is the correct function definition header?
23. Which of the following statements is FALSE about local and global variables?
24. Which of the following is an example of a keyword argument?
25. A function is said to be ..... if it calls itself
26. Which of the following is a valid lambda function in Python?
27. What is the default starting value of the range() function?
28. What is a parameter in a function?
29. Which of the following is a valid way to return multiple values from a function in Python?
30. The values received in the function definition/header statement are called .....
31. Which of the following keyword is used to define the function testpython():
32. There are predefined functions that are available in a module. For using them we need to import the module.
33. What is the output of the following code? "'pythondef f(x):return x**2print(f(5)) "'
34. Study the following program and select the possible output:import randomX = random.random()Y = random.randint(0, 4)print(int(X), ":", Y + int(X))
35. If a function returns a value, it should generally be called from
36. What are the two main types of functions?
37. Value returning functions should be generally called from inside of an expression.
38. What is the output of the function call print(greet('Alice'))?
39. How do you reverse a string in Python?
40. What is the 'return' statement used for in a function?
41. A recursive function is
42. What will be the output of the following code? "'pythondef multiply(x, y):product = x * y return productprint(multiply(2, 5)) "'
43. Which of the following is a common use case for lambda functions?
44. What will be the output of this program?def addOne(number):number += 1 return numberone = addOne(0)two = addOne(one)print(two)
45. What will be the output of the following Python code?def cube(x):return x * x * xx = cube(3)print (x)
46. What is the purpose of the 'return' statement in a Python function?
47. What is the output of the following code? def first ..... five ..... even ..... numbers():for num in range(2, 11):if num % 2 == 0:print(num); first ..... five ..... even ..... numbers()
48. The ..... keyword is ignored by the Python interpreter and can be used as a placeholder for code that will be written later.
49. Assertion (A):Keyword arguments are related to the function calls. Reason (R):When you use keyword arguments in a function call, the caller identifies the arguments by the parameter name.
50. A group of statements that exist within a program for the purpose of performing a specific task is a(n) .....
51. Which of the following is the correct way to call a function named 'hello' with one argument, '"World"'?
52. Def fun():print('Hello User')is an example of
53. Which type of data type requires the 'global' keyword to modify a global variable inside a function?
54. What Is The Output Of The Following Code Snippet? def func(message, num = 1):print(message * num) func('Welcome')func('Viewers', 3)
55. What is a situation where you would want to use a function to simplify(make easier to read) your code?
56. Which statement about local variables is TRUE?
57. Which of the following statements is true about lambda functions?
58. Functions help us to break the program into smaller chunks
59. What is the purpose of the pass keyword?
60. Can a function in Python return multiple values?