This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 5 Functions In Python – Quiz 7 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 5 Functions In Python Quiz 7 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. Which of the following is a correct way to use a lambda function to add 10 to each element in a list? A) 'map(lambda x:x + 10, list of numbers)'. B) 'map(lambda x:x-10, list of numbers)'. C) 'map(lambda x:x * 10, list of numbers)'. D) 'map(lambda x:x / 10, list of numbers)'. Show Answer Correct Answer: A) 'map(lambda x:x + 10, list of numbers)'. 2. What is the output of the following code:'print((lambda x, y, z:x * y * z)(2, 3, 4))'? A) 9. B) 24. C) 12. D) 8. Show Answer Correct Answer: B) 24. 3. What is the output of the following code? "'pythondef change():x = 5 return xx = 10print(change())print(x) "' A) '5' followed by '10'. B) '10' followed by '5'. C) '5' followed by '5'. D) '10' followed by '10'. Show Answer Correct Answer: A) '5' followed by '10'. 4. What is the difference between '==' and 'is' when comparing strings? A) The '==' operator compares object identity, while 'is' compares values. B) The '==' operator compares values, while 'is' compares object identity. C) Both '==' and 'is' compare values but return different results. D) The '==' operator checks for type, while 'is' checks for value. Show Answer Correct Answer: B) The '==' operator compares values, while 'is' compares object identity. 5. What is the correct syntax to define a function in Python? A) 'function myFunction():'. B) 'def myFunction():'. C) 'define myFunction():'. D) 'func myFunction():'. Show Answer Correct Answer: B) 'def myFunction():'. 6. ..... is the blank space in the beginning of a statement within a block. A) Indentation. B) Space. C) Body. D) None of the above. Show Answer Correct Answer: A) Indentation. 7. Which of the following is NOT a valid lambda function? A) 'lambda x, y:x + y'. B) 'lambda x:x * 2'. C) 'lambda:x + 2'. D) 'lambda x, y, z:x + y + z'. Show Answer Correct Answer: C) 'lambda:x + 2'. 8. What will be the output of the following code? "'pythondef concat(str1, str2):return str1 + str2result = concat("Hello, ", "World!")print(result) "' A) 'Hello, World!'. B) 'Hello World!'. C) 'Hello, '. D) 'World!'. Show Answer Correct Answer: A) 'Hello, World!'. 9. What is the correct way to import a module in Python? A) Import module name. B) Include module name. C) Require module name. D) Load module name. Show Answer Correct Answer: A) Import module name. 10. Explain the use of lambda functions in Python. A) Lambda functions provide a concise way to create small, unnamed functions for quick use without formally defining them using 'def'. B) Lambda functions are primarily used for creating global variables in Python. C) Lambda functions can only take one argument in Python. D) Lambda functions are only used for defining classes in Python. Show Answer Correct Answer: A) Lambda functions provide a concise way to create small, unnamed functions for quick use without formally defining them using 'def'. 11. What will be printed by the following code? "'pythondef foo():a = 7 return aa = 3print(foo())print(a) "' A) '7' followed by '3'. B) '3' followed by '7'. C) '7' followed by '7'. D) '3' followed by '3'. Show Answer Correct Answer: A) '7' followed by '3'. 12. What will be the output of the following code? "'pythondef increment(x):x += 1 return xvalue = 5result = increment(value)print(result) "' A) '6'. B) '5'. C) '7'. D) 'None'. Show Answer Correct Answer: A) '6'. 13. Which of the following is NOT a characteristic of a lambda function? A) It can have multiple expressions. B) It is anonymous. C) It can take multiple arguments. D) It is defined using the 'lambda' keyword. Show Answer Correct Answer: A) It can have multiple expressions. 14. Assertion (A):There are various built in functions/methods to manipulate the dictionaries. Reason (R):Built in functions does not work on dictionaries. 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 correct explanation for A. C) A is true but R is false. D) A is false but R is true. Show Answer Correct Answer: C) A is true but R is false. 15. The ..... of a variable is the area of the program where it may be referred. A) External. B) Global. C) Scope. D) Local. Show Answer Correct Answer: C) Scope. 16. What term is used to describe data passed into a function? A) Variable. B) Loop. C) Constant. D) Parameter. Show Answer Correct Answer: D) Parameter. 17. Values can be passed to the function using variables. A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: A) True. 18. What is the general format for defining a function? A) Def function name():. B) Function function name() \{\}. C) Function name() = def. D) Define function name(). Show Answer Correct Answer: A) Def function name():. 19. What will be the output of the following code? "'pythondef double(x):return x * 2result = double(7)print(result) "' A) '14'. B) '7'. C) '0'. D) 'None'. Show Answer Correct Answer: A) '14'. 20. What are the reasons for using functions in programs, A) To build code that will be reused. B) To simplify code. C) Help us to organize longer programs. D) All of the above. Show Answer Correct Answer: D) All of the above. 21. A variable created or defined within a function body is A) Local. B) Global. C) Built in. D) Instance. Show Answer Correct Answer: A) Local. 22. In Python, how do you call a subroutine named calculate ..... average from the main program? A) A. calculate average(). B) B. call calculate average(). C) C. run calculate average(). D) None of the above. Show Answer Correct Answer: A) A. calculate average(). 23. What is the output of the following code? def main():i=4; a=add(4); print(a); main() A) Error. B) 16. C) 4. D) 8. Show Answer Correct Answer: B) 16. 24. What is the correct way to define a function with a default parameter value? A) 'def myFunction(x=10):'. B) 'def myFunction(x:10):'. C) 'def myFunction(x, 10):'. D) 'def myFunction(x=10)'. Show Answer Correct Answer: A) 'def myFunction(x=10):'. 25. What is the output of the function call print(add ..... five(square(4)))? A) 16. B) 21. C) 25. D) 20. Show Answer Correct Answer: B) 21. ← 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 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