This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 5 Functions In Python – Quiz 5 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 5 Functions In Python Quiz 5 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. While defining a function which of the following symbol is used? A) ; semicolon. B) .dot. C) :colon. D) $ dollar. Show Answer Correct Answer: C) :colon. 2. What will be the output of the following code snippet?print(type(5 / 2))print(type(5 // 2)) A) Float and int. B) Int and float. C) Float and float. D) Int and int. Show Answer Correct Answer: A) Float and int. 3. Which of the following is a valid way to call a function named 'calculate' in Python? A) 'call calculate()'. B) 'execute calculate()'. C) 'calculate()'. D) 'run calculate()'. Show Answer Correct Answer: C) 'calculate()'. 4. What will be printed by the following code? "'pythondef foo(x):if x < 0:return "Negative" else:return "Non-negative"print(foo(-5)) "' A) 'Negative'. B) 'Non-negative'. C) '-5'. D) 'Error'. Show Answer Correct Answer: A) 'Negative'. 5. This statement causes a function to end and sends a value back to the part of the program that called the function. A) End. B) Return. C) Terminate. D) Break. Show Answer Correct Answer: B) Return. 6. What is the output of the following code:'print((lambda x, y:x-y)(5, 3))'? A) 2. B) 8. C) 15. D) 1. Show Answer Correct Answer: A) 2. 7. What is the output of the function call sums() if sums() returns 30? A) 30. B) None. C) Error. D) Sums. Show Answer Correct Answer: A) 30. 8. Ananya is trying to understand the features of Python functions. She is not understanding the feature that distributes the work in small parts. Select the appropriate term out of the following. A) Modularity. B) Reusability. C) Simplicity. D) Abstraction. Show Answer Correct Answer: A) Modularity. 9. Why is the number 20 not part of the list generated by list(range(2, 20, 2))? A) Because 20 is included in the list. B) Because the upper limit is included while generating the iterable. C) Because the upper limit is excluded while generating the iterable. D) Because the step size is incorrect. Show Answer Correct Answer: C) Because the upper limit is excluded while generating the iterable. 10. What will the following code output? def even ..... odd():no = int(input('Enter a number:')); if no % 2 == 0:print('Even') else:print('Odd') A) Error. B) Even or Odd based on input. C) Even. D) None. Show Answer Correct Answer: B) Even or Odd based on input. 11. What is the purpose of the 'return' keyword in a function? A) To print a value. B) To define a function. C) To end the function. D) To return a value to the caller. Show Answer Correct Answer: D) To return a value to the caller. 12. Which method would you use to insert an element at a specific position in a list? A) Remove(). B) Append(). C) Insert(). D) Extend(). Show Answer Correct Answer: C) Insert(). 13. How can you return multiple values from a function in Python? A) Using a list. B) Using a tuple. C) Using a dictionary. D) All of the above. Show Answer Correct Answer: D) All of the above. 14. Which of the following function headers is correct?* A) Def fun(a = 2, b = 3, c). B) Def fun(a = 2, b, c = 3). C) Def fun(a, b = 2, c = 3). D) Def fun(a, b, c = 3, d). Show Answer Correct Answer: C) Def fun(a, b = 2, c = 3). 15. Which of the following is a valid function definition in Python? A) 'def myFunction:'. B) 'def myFunction():'. C) 'def myFunction[]:'. D) 'def myFunction\{\}'. Show Answer Correct Answer: B) 'def myFunction():'. 16. When possible, you should avoid using ..... variables in a program. A) Constant. B) Local. C) Parameter. D) Global. Show Answer Correct Answer: D) Global. 17. What does the function round(x, n) do in Python? A) Returns the largest integer less than or equal to x. B) Returns a float value by rounding off x to n digits. C) Returns the smallest integer greater than or equal to x. D) Returns the absolute value of x. Show Answer Correct Answer: B) Returns a float value by rounding off x to n digits. 18. Out of the following, find those identifiers, which cannot be used for naming functions in a Python program:While, 3rd Row, def, My ..... Sp A) While. B) 3rd Row. C) My Sp. D) Def. Show Answer Correct Answer: D) Def. 19. Select output given by the following code:a = \{i * i for i in range(6)\}print(a) A) Dictionary comprehension doesn't exist. B) \{0:0, 1:1, 2:4, 3:9, 4:16, 5:25, 6:36\}. C) \{0, 1, 4, 9, 16, 25\}. D) \{0:1, 1:2, 4:3, 9:4, 16:5, 25\}. Show Answer Correct Answer: C) \{0, 1, 4, 9, 16, 25\}. 20. What does the keyword 'def' signify in Python? A) Define a loop. B) Define a variable. C) Define a class. D) Define a function. Show Answer Correct Answer: D) Define a function. 21. In Python function can return only one value. A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: B) False. 22. What does the following function return? "'pythondef multiply(x, y=2):return x * yprint(multiply(4)) "' A) '8'. B) '6'. C) '2'. D) '4'. Show Answer Correct Answer: A) '8'. 23. Which of the following is a correct way to use the map function to double each element in a list? A) 'map(lambda x:x * 2, list of numbers)'. B) 'map(lambda x:x + 2, list of numbers)'. C) 'map(lambda x:x-2, list of numbers)'. D) 'map(lambda x:x / 2, list of numbers)'. Show Answer Correct Answer: A) 'map(lambda x:x * 2, list of numbers)'. 24. If we write def add(a, b):return a + b, what will add(2, 3) give? A) 23. B) 5. C) A+b. D) Error. Show Answer Correct Answer: B) 5. 25. 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 A) I is correct and II is wrong. B) I is wrong and II is correct. C) Both are correct. D) Both are wrong. Show Answer Correct Answer: A) I is correct and II is wrong. ← 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 6Class 11 Computer Science Chapter 5 Functions In Python Quiz 7Class 11 Computer Science Chapter 5 Functions In Python Quiz 8Class 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