This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 5 Functions In Python – Quiz 4 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 5 Functions In Python Quiz 4 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. Def info(object, spacing=10, collapse=1):# function headerconsider the following function call and find out whether it is validinfo(obj3, collapse=0) A) Valid. B) Invalid. C) All the above. D) None of the above. Show Answer Correct Answer: A) Valid. 2. What is the output of the following code:'print((lambda x, y:x + y)(10, 5))'? A) 15. B) 5. C) 105. D) 50. Show Answer Correct Answer: A) 15. 3. What will be the output of the following code? "'pythondef greet(name="Guest"):return "Hello, '' + nameprint(greet()) "' A) 'Hello, Guest'. B) 'Hello, '. C) 'Hello, None'. D) 'Error'. Show Answer Correct Answer: A) 'Hello, Guest'. 4. A ..... is a block of code that will execute only when it is called. A) Function. B) Sub Program. C) Block. D) All of the above. Show Answer Correct Answer: A) Function. 5. What will points.count(9) return if points = [1, 4, 2, 9, 7, 8, 9, 3, 1]? A) 0. B) 1. C) 2. D) 9. Show Answer Correct Answer: C) 2. 6. What is the output of the following code? def my ..... func():print('hello, Good Morning'); my ..... func() A) Hello, Good Morning. B) My func. C) None. D) Error. Show Answer Correct Answer: A) Hello, Good Morning. 7. Which of the following best describes a parameter in a function? A) A variable defined inside a function and used only there. B) A variable listed in the function definition and used to pass values. C) A variable that is always global. D) A variable that cannot be changed. Show Answer Correct Answer: B) A variable listed in the function definition and used to pass values. 8. What is the output of a function that returns a list? A) A string. B) An integer. C) A dictionary. D) A list. Show Answer Correct Answer: D) A list. 9. What are the advantages of using lambda functions in Python? A) Lambda functions in Python have several advantages, including being concise, anonymous, and useful for one-time functions and as arguments in higher-order functions. B) Lambda functions in Python are slower than regular functions. C) Lambda functions in Python can only be used for simple tasks. D) Lambda functions in Python are difficult to debug. Show Answer Correct Answer: A) Lambda functions in Python have several advantages, including being concise, anonymous, and useful for one-time functions and as arguments in higher-order functions. 10. Which of the following items are present in the function header? A) Function name only. B) Both function name and parameter list. C) Parameter list only. D) Return value. Show Answer Correct Answer: B) Both function name and parameter list. 11. Which of the following is an example of a non-parameterized function? A) Def add(x, y):. B) Def sum(a, b):. C) Def greet():. D) Def multiply(x, y):. Show Answer Correct Answer: C) Def greet():. 12. The program may run out of memory in a A) Non-recursive function call. B) Recursive function call. C) Condition when too many variables are declared. D) None of the above. Show Answer Correct Answer: B) Recursive function call. 13. What will this code print?def hello():print("Hi")hello() A) Nothing. B) Hello. C) Hi. D) Error. Show Answer Correct Answer: C) Hi. 14. How do you create a multi-line string in Python? A) Use triple quotes (" ' or """) to create a multi-line string. B) Use parentheses to create a multi-line string. C) Use single quotes to create a multi-line string. D) Concatenate multiple strings with a backslash. Show Answer Correct Answer: A) Use triple quotes (" ' or """) to create a multi-line string. 15. A variable defined outside all functions is known as A) Static. B) Global. C) Local. D) None of the above. Show Answer Correct Answer: B) Global. 16. What does the ..... name ..... variable indicate when a module is imported? A) The name of the module. B) The main program. C) The function being executed. D) None of the above. Show Answer Correct Answer: A) The name of the module. 17. What is the default return value of a function that does not return any value explicitly? A) Int. B) Float. C) Double. D) None. Show Answer Correct Answer: D) None. 18. What is the scope of a variable defined inside a function in Python? A) Global scope. B) Limited to the class. C) Accessible from any function. D) Limited to the function. Show Answer Correct Answer: D) Limited to the function. 19. Name the condition at which the recursive method will stop calling itself. A) Base case. B) Worst Case. C) Best Case. D) None of the above. Show Answer Correct Answer: A) Base case. 20. Choose the correct form of function. A) Def stat( ). B) Def static:. C) Func stat():. D) Def stat( ):. Show Answer Correct Answer: D) Def stat( ):. 21. What will be the output of the following code? "'pythondef add(a, b):return a + bresult = add(3, 4)print(result) "' A) '7'. B) '34'. C) 'None'. D) 'Error'. Show Answer Correct Answer: A) '7'. 22. Which of the following is true about the lifetime of a variable in Python? A) A variable's lifetime is until the program ends. B) A variable's lifetime is until the function ends. C) A variable's lifetime is until the variable is deleted. D) A variable's lifetime is until the module is reloaded. Show Answer Correct Answer: B) A variable's lifetime is until the function ends. 23. What does the keyword return do in a Python function or subroutine? A) A. Terminates the program. B) B. Sends a value back to the caller. C) C. Defines a loop. D) None of the above. Show Answer Correct Answer: B) B. Sends a value back to the caller. 24. A named blocks of code that are designed to do one specific job is called as A) Loop. B) Branching. C) Function. D) Block. Show Answer Correct Answer: C) Function. 25. If a function is defined but never called, what will happen? A) Python will still run it automatically. B) It will not run at all. C) It will give an error. D) It will print "Nothing". Show Answer Correct Answer: B) It will not run at all. ← 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 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