This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 5 Functions In Python – Quiz 2 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 5 Functions In Python Quiz 2 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. What method would you use to replace a substring in a string? A) Use the 'concat' method. B) Use the 'split' method. C) Use the 'replace' method. D) Use the 'substring' method. Show Answer Correct Answer: C) Use the 'replace' method. 2. In ..... arguments we can skip the default argument, but all the arguments should match the parameters in the function definitions. A) Keyword. B) Required. C) Default. D) None of the above. Show Answer Correct Answer: A) Keyword. 3. Which statement about function parameters is TRUE? A) All parameters must have default values. B) Parameters can be given default values. C) Parameters cannot be named. D) Parameters must always be integers. Show Answer Correct Answer: B) Parameters can be given default values. 4. What will be the output of the following code? "'pythondef subtract(a, b):return a-bresult = subtract(10, 4)print(result) "' A) '6'. B) '14'. C) '-6'. D) 'None'. Show Answer Correct Answer: A) '6'. 5. Select which of the following is NOT TRUE for Python function: A) A function only executes when it is called and we can reuse it in a program. B) In a Python function a keyword argument can not be followed by a positional argument. C) A Python function can return multiple values. D) Python function doesn't return anything unless and until you add a return statement. Show Answer Correct Answer: D) Python function doesn't return anything unless and until you add a return statement. 6. What is the correct syntax to call a function named 'calculate ..... Area'? A) Calculate Area(). B) Calculate Area;. C) Calculate Area[]. D) Calculate Area\{\}. Show Answer Correct Answer: A) Calculate Area(). 7. Do you call or define a function first? A) Call. B) Define. C) All the above. D) None of the above. Show Answer Correct Answer: B) Define. 8. In Python, if no value is provided in the function call, the argument takes (a) value. A) A. default. B) Provided. C) Temporary. D) Expounded. Show Answer Correct Answer: A) A. default. 9. How can you check if a substring exists within a string? A) Use the 'find()' method in Python. B) Check the length of the string. C) Use the 'in' operator in Python or 'includes()' method in JavaScript. D) Use the 'indexOf()' method in JavaScript. Show Answer Correct Answer: C) Use the 'in' operator in Python or 'includes()' method in JavaScript. 10. What are positional arguments in function calls? A) Positional arguments are arguments passed to a function in the order of its parameters. B) Arguments that can be passed in any order. C) Arguments that are optional and not required. D) Arguments that are defined by their names. Show Answer Correct Answer: A) Positional arguments are arguments passed to a function in the order of its parameters. 11. Which of these is NOT a built-in function? A) Print(). B) Len(). C) Greet(). D) Type(). Show Answer Correct Answer: C) Greet(). 12. Which of the following functions is a built-in function in python? A) Array(). B) Sqrt(). C) Factorial(). D) Print(). Show Answer Correct Answer: B) Sqrt(). 13. What is the output of the following code:'print((lambda x, y:x * y)(3, 4))'? A) 7. B) 12. C) 34. D) 1. Show Answer Correct Answer: B) 12. 14. Which function returns the largest of its arguments? A) Min(). B) Max(). C) Len(). D) Range(). Show Answer Correct Answer: B) Max(). 15. Which of the following symbols always comes after a function code block? A) ;. B) ]. C) :. D) #. Show Answer Correct Answer: C) :. 16. Def info(object, spacing=10, collapse=1):# function headerconsider the following function call and find out whether it is validinfo(ob1) A) Valid. B) Invalid. C) All the above. D) None of the above. Show Answer Correct Answer: A) Valid. 17. Can a lambda function have multiple expressions in Python? A) Yes. B) Only if it is nested. C) No. D) Sometimes. Show Answer Correct Answer: A) Yes. 18. What does the map function in Python do? A) It filters elements from an iterable based on a condition. B) It applies a given function to each item of an iterable and returns a list of the results. C) It sorts the elements of an iterable in ascending order. D) It reduces an iterable to a single cumulative value. Show Answer Correct Answer: B) It applies a given function to each item of an iterable and returns a list of the results. 19. What is the output of the following code? "'pythondef divide(a, b):try:return a / b except ZeroDivisionError:return "Cannot divide by zero"print(divide(10, 0)) "' A) '0'. B) 'Cannot divide by zero'. C) 'ZeroDivisionError'. D) 'None'. Show Answer Correct Answer: B) 'Cannot divide by zero'. 20. Def info(object, spacing=10, collapse=1):# function headerconsider the following function call and find out whether it is validinfo(spacing=15, object=obj4) A) Valid. B) Invalid. C) All the above. D) None of the above. Show Answer Correct Answer: A) Valid. 21. What is the output of the following code? "'pythonx = 10def show():print(x)show() "' A) '10'. B) 'x'. C) 'Error'. D) 'None'. Show Answer Correct Answer: A) '10'. 22. What is a void function? A) A function that has no parameters. B) A function that performs an action but doesn't return a value. C) A function that cannot be called. D) A function that returns a value. Show Answer Correct Answer: B) A function that performs an action but doesn't return a value. 23. When you use multiple type argument in function then default argument take place A) At beginning. B) At end. C) Anywhere. D) None of the above. Show Answer Correct Answer: B) At end. 24. How to call this function?def sayHello( ):print ( "Hello World!" ) A) SayHello( ). B) SayHello( ):. C) Sayhello( ):. D) Sayhello( ). Show Answer Correct Answer: A) SayHello( ). 25. Which of the following is the correct syntax for a lambda function? A) 'lambda x:x + 2'. B) 'def lambda(x):x + 2'. C) 'lambda(x) \{ return x + 2 \}'. D) 'function lambda(x) \{ x + 2 \}'. Show Answer Correct Answer: A) 'lambda x:x + 2'. ← PreviousNext →Related QuizzesClass 11 Computer Science Chapter 5 Functions In Python Quiz 1Class 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 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