This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 5 Functions In Python – Quiz 9 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 5 Functions In Python Quiz 9 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. A ..... is a variable that is created inside a function. A) Global variable. B) Local variable. C) Constant variable. D) Static variable. Show Answer Correct Answer: B) Local variable. 2. What does the index() method return? A) The last element of the list. B) The first occurrence of a specified value's position. C) The total number of elements in the list. D) A copy of the list. Show Answer Correct Answer: B) The first occurrence of a specified value's position. 3. If you want to find the maximum value in a list, which method would you use? A) Len(). B) Max(). C) Sum(). D) Min(). Show Answer Correct Answer: B) Max(). 4. Which of the following is the correct way to catch any exception in Python? A) 'except Exception:'. B) 'catch Exception:'. C) 'except:'. D) 'handle Exception:'. Show Answer Correct Answer: C) 'except:'. 5. What will be printed by the following code? "'pythondef test():y = 5 print(y)test()print(y) "' A) '5' followed by '5'. B) '5' followed by 'Error'. C) 'Error' only. D) 'None'. Show Answer Correct Answer: B) '5' followed by 'Error'. 6. How can you convert a string to uppercase in Python? A) String variable.upper(). B) String variable.uppercase(). C) String variable.capitalize(). D) String variable.toUpperCase(). Show Answer Correct Answer: A) String variable.upper(). 7. Predefined functions that are already available in Python are known as A) Modules. B) User defined functions. C) Scripts. D) Built-in functions. Show Answer Correct Answer: D) Built-in functions. 8. Which of the following is used to return a result from a function? A) Catch. B) Continue. C) Break. D) Return. Show Answer Correct Answer: D) Return. 9. Which of the following keyword is used to begin the function block? A) Define. B) For. C) Finally. D) Def. Show Answer Correct Answer: D) Def. 10. Suppose list1 is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after list1.pop(1)? A) [3, 4, 5, 20, 5, 25, 1, 3]. B) [1, 3, 3, 4, 5, 5, 20, 25]. C) [3, 5, 20, 5, 25, 1, 3]. D) [1, 3, 4, 5, 20, 5, 25]. Show Answer Correct Answer: C) [3, 5, 20, 5, 25, 1, 3]. 11. What is the purpose of using subroutines in programming? A) A. To confuse the programmer. B) B. To make the code longer. C) C. To organize code and make it more modular and reusable. D) None of the above. Show Answer Correct Answer: C) C. To organize code and make it more modular and reusable. 12. 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) A) Positive. B) Negative. C) None. D) Error. Show Answer Correct Answer: B) Negative. 13. A Function that does not have any return value is known as ..... A) Library function. B) Void function. C) Fruitful function. D) None of the above. Show Answer Correct Answer: B) Void function. 14. What is a parameter in the context of functions? A) A function that calls another function. B) A value returned by a function. C) A variable in a function definition. D) A built-in function. Show Answer Correct Answer: C) A variable in a function definition. 15. What is the output of the following code:'print((lambda x:x**2)(5))'? A) 10. B) 25. C) 5. D) 0. Show Answer Correct Answer: B) 25. 16. What is the output of the function shown below (random module has already been imported)?random.choice('sun') A) Sun. B) Either s, u or n. C) U. D) Error. Show Answer Correct Answer: B) Either s, u or n. 17. What does the function sqrt(x) return? A) The square of x. B) The square root of x. C) The cube of x. D) None of the above. Show Answer Correct Answer: B) The square root of x. 18. Function may or may not return a value A) True. B) False. C) None. D) None. Show Answer Correct Answer: A) True. 19. The ..... of a variable is the area of a program where it may be referenced A) External. B) Global. C) Scope. D) Local. Show Answer Correct Answer: C) Scope. 20. Which of the following is TRUE about global variables? A) They are accessible from any function unless shadowed by a local variable of the same name. B) They are only accessible inside the function where they are defined. C) They must be integers. D) They cannot be changed. Show Answer Correct Answer: A) They are accessible from any function unless shadowed by a local variable of the same name. 21. What is the format for writing a value-returning function? A) Return expression. B) Function name(). C) Def function name():. D) Return value. Show Answer Correct Answer: A) Return expression. 22. What does the following function return? "'pythondef test():passprint(test()) "' A) 'None'. B) 'pass'. C) 'test'. D) 'Error'. Show Answer Correct Answer: A) 'None'. 23. What happens if the function is not called? A) The function will respond as usual. B) The function will not work. C) It will throw an error. D) The function will get deleted. Show Answer Correct Answer: B) The function will not work. 24. The code block of function always comes after a ..... A) ;. B) :. C) '. D) #. Show Answer Correct Answer: B) :. 25. Assertion (A):Built in function are predefined in the language that are used directlyReason (R):print( ) and input( ) are built in functions A) Both A and R are true and R is the correct explanation for A. B) Both A and R are true and R is not the correct explanation for A. C) A is true but R is false. D) A is false but R is true. Show Answer Correct Answer: B) Both A and R are true and R is not the correct explanation for A. ← 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 8Class 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