This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 5 Functions In Python – Quiz 8 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 5 Functions In Python Quiz 8 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. What does the range() function return in Python 3? A) A list of numbers. B) An iterable object. C) A string of numbers. D) A tuple of numbers. Show Answer Correct Answer: B) An iterable object. 2. Which of the following is not a part of the python function? A) Function header. B) Return statement. C) Parameter list. D) Function keyword. Show Answer Correct Answer: D) Function keyword. 3. Which of the following is true about the scope of variables in Python? A) Variables defined inside a function are accessible outside the function. B) Variables defined outside a function are accessible inside the function. C) Variables defined inside a function have global scope. D) Variables defined outside a function have local scope. Show Answer Correct Answer: B) Variables defined outside a function are accessible inside the function. 4. What does a negative step size in Python indicate? A) Incrementing. B) Decrementing. C) Multiplying. D) Dividing. Show Answer Correct Answer: B) Decrementing. 5. Functions make code re-usable A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: A) True. 6. What is the difference between an argument and a parameter? A) Arguments are used in function definition, parameters in function call. B) None of the above. C) Parameters are used in function definition, arguments in function call. D) They are the same. Show Answer Correct Answer: C) Parameters are used in function definition, arguments in function call. 7. What are keyword arguments in function calls? A) Arguments that are passed in a specific order. B) Arguments that are always required. C) Arguments that cannot be named explicitly. D) Keyword arguments are arguments passed to a function by explicitly naming the parameters. Show Answer Correct Answer: D) Keyword arguments are arguments passed to a function by explicitly naming the parameters. 8. What will be the output of the following code? def func(s):return len(s); print(func('Hello')) A) None. B) Error. C) Hello. D) 5. Show Answer Correct Answer: D) 5. 9. What will be the output of the following code? "'pythondef power(base, exponent):return base ** exponentresult = power(2, 3)print(result) "' A) '8'. B) '6'. C) '9'. D) 'None'. Show Answer Correct Answer: A) '8'. 10. How can you pass a list as an argument to a function in Python? A) 'myFunction([1, 2, 3])'. B) 'myFunction\{1, 2, 3\}'. C) 'myFunction<1, 2, 3>'. D) 'myFunction(1, 2, 3)'. Show Answer Correct Answer: A) 'myFunction([1, 2, 3])'. 11. What is the default return value of a function that does not have a 'return' statement? A) '0'. B) 'None'. C) 'False'. D) 'True'. Show Answer Correct Answer: B) 'None'. 12. What does the function header contain? A) The function name. B) The function name and parameter list. C) The parameter list. D) The return value. Show Answer Correct Answer: B) The function name and parameter list. 13. What is the purpose of a user-defined function? A) To create variables. B) To perform a specific task defined by the user. C) To handle errors. D) To execute built-in functions. Show Answer Correct Answer: B) To perform a specific task defined by the user. 14. How do you call a function named 'calculate ..... sum' in Python? A) 'call calculate sum'. B) 'calculate sum()'. C) 'def calculate sum()'. D) 'execute calculate sum()'. Show Answer Correct Answer: B) 'calculate sum()'. 15. 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) "' A) '(10, 4)'. B) '10 4'. C) '7, 3'. D) 'Error'. Show Answer Correct Answer: A) '(10, 4)'. 16. What is the output of the following code:'print((lambda x:x / 2)(8))'? A) 4. B) 16. C) 2. D) 0. Show Answer Correct Answer: A) 4. 17. What does the return statement do in a function? A) Calls another function. B) Prints the output. C) Returns a value to the caller. D) Ends the program. Show Answer Correct Answer: C) Returns a value to the caller. 18. By default, if you return multiple values separated by commas, then it is returned as A) List. B) Tuples. C) String. D) None of the above. Show Answer Correct Answer: B) Tuples. 19. Which of the following condition is true? A) Recursion is always better than iteration. B) Recursion uses more memory as compared to iteration. C) Recursion uses less memory as compared to iteration. D) Iteration is always better and simpler than recursion. Show Answer Correct Answer: B) Recursion uses more memory as compared to iteration. 20. How do you call a lambda function in Python? A) By using the name of the lambda function followed by parentheses. B) By using the 'execute' function on the lambda function. C) By using the 'call' method on the lambda function. D) By using the 'lambda' keyword followed by parentheses. Show Answer Correct Answer: A) By using the name of the lambda function followed by parentheses. 21. 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. A) Function. B) Start. C) Def. D) Fun. Show Answer Correct Answer: C) Def. 22. What does the random function return? A) A random integer. B) A random float in the range of 0.0 and 1.0. C) A random float with a specified range. D) None of the above. Show Answer Correct Answer: B) A random float in the range of 0.0 and 1.0. 23. Def info(object, spacing=10, collapse=1):# function headerconsider the following function call and find out whether it is validinfo(obj11, object=obj12) A) Valid. B) Invalid. C) All the above. D) None of the above. Show Answer Correct Answer: B) Invalid. 24. Identify the function that returns the number of items in a list. A) Count(). B) Items(). C) Len(). D) Count(). Show Answer Correct Answer: C) Len(). 25. 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)) A) Return "number". B) Print(number). C) Print("number"). D) Return number. Show Answer Correct Answer: D) Return number. ← PreviousNext →Related QuizzesClass 11 Computer Science Chapter 5 Functions In Python Quiz 1Class 11 Computer Science Chapter 5 Functions In Python Quiz 2Class 11 Computer Science Chapter 5 Functions In Python Quiz 3Class 11 Computer Science Chapter 5 Functions In Python Quiz 4Class 11 Computer Science Chapter 5 Functions In Python Quiz 5Class 11 Computer Science Chapter 5 Functions In Python Quiz 6Class 11 Computer Science Chapter 5 Functions In Python Quiz 7Class 11 Computer Science Chapter 5 Functions In Python Quiz 9Class 11 Computer Science Chapter 5 Functions In Python Quiz 10Class 11 Computer Science Chapter 5 Functions In Python Quiz 11 🏠 Back to Homepage 📘 Download PDF Books 📕 Premium PDF Books