This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 5 Functions In Python – Quiz 12 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 5 Functions In Python Quiz 12 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. Calling a function and defining a function mean the same thing. A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: B) False. 2. What is the syntax of a lambda function in Python? A) Expression:lambda arguments. B) Lambda arguments:expression. C) Expression:arguments lambda. D) Arguments:lambda expression. Show Answer Correct Answer: B) Lambda arguments:expression. 3. What is the purpose of the 'join()' method in strings? A) To find the length of a string. B) To replace all occurrences of a substring in a string. C) To split a string into a list of characters. D) The purpose of the 'join()' method is to combine elements of an iterable into a string with a specified separator. Show Answer Correct Answer: D) The purpose of the 'join()' method is to combine elements of an iterable into a string with a specified separator. 4. How can you modify a global variable inside a function? A) By using the 'global' keyword. B) By using the 'local' keyword. C) By using the 'var' keyword. D) By using the 'static' keyword. Show Answer Correct Answer: A) By using the 'global' keyword. 5. What is a variable defined outside all the function referred to as? A) A static variable. B) A global variable. C) A local variable. D) An automatic variable. Show Answer Correct Answer: B) A global variable. 6. What will the following code output:for i in range(5, 10):print(i)? A) 10 9 8 7 6 5. B) 5 6 7 8 9. C) 5 6 7 8 9 10. D) 5 6 7 8. Show Answer Correct Answer: B) 5 6 7 8 9. 7. What does the special value None indicate when returned from a function? A) No value. B) An error has occurred. C) Both A and B. D) A successful operation. Show Answer Correct Answer: C) Both A and B. 8. Def mul ..... fun(a=10, b, c=1):return a+b+cis A) Correct. B) Incorrect. C) All the above. D) None of the above. Show Answer Correct Answer: B) Incorrect. 9. What is the purpose of the input function in the sums() function? A) To display output. B) To define a function. C) To take user input. D) To return a value. Show Answer Correct Answer: C) To take user input. 10. What is the output of the following piece of code?def test(i, j):if(i==0):return j else:return test(i-1, i+j) print(test(4, 7)) A) 13. B) 7. C) Infinite Loop. D) 17. Show Answer Correct Answer: D) 17. 11. What is a lambda function in Python? A) A function that is defined using the 'def' keyword. B) A small anonymous function that can have any number of arguments, but only one expression. C) A function that is used to create classes. D) A function that is used to handle exceptions. Show Answer Correct Answer: B) A small anonymous function that can have any number of arguments, but only one expression. 12. What is the default return value of a function that does not explicitly return a value? A) '0'. B) 'None'. C) 'False'. D) '""'. Show Answer Correct Answer: B) 'None'. 13. What is the purpose of the 'continue' statement in Python? A) To skip the rest of the code in the loop and continue with the next iteration. B) To terminate the loop and transfer control to the next statement. C) To execute a set of statements repeatedly based on a condition. D) To skip the current iteration and continue with the next iteration. Show Answer Correct Answer: D) To skip the current iteration and continue with the next iteration. 14. What is the correct way to define a function that takes no parameters? A) 'def myFunction:'. B) 'def myFunction():'. C) 'def myFunction[]:'. D) 'def myFunction\{\}'. Show Answer Correct Answer: B) 'def myFunction():'. 15. What is the default step size in Python if it is not provided? A) 0. B) 1. C) 2. D) 3. Show Answer Correct Answer: B) 1. 16. What will be the output of the following Python expression? round(4.576) A) 4.5. B) 5. C) 4. D) 4.6. Show Answer Correct Answer: D) 4.6. 17. The function randint( ) returns random integers between low and high numbers? A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: A) True. 18. How do you format a string using f-strings? A) Use f'string \{variable\}' to format a string with variables. B) Concatenate strings using '+' operator for variables. C) Format strings with 'string.format(variable)' method. D) Use 'string \{variable\}' without f-prefix. Show Answer Correct Answer: A) Use f'string \{variable\}' to format a string with variables. 19. The variable declared outside a function is called a global variable. A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: A) True. 20. What is the output of the following code? def draw ..... circle():circle(50); draw ..... circle() A) Draws a circle. B) Draws a square. C) Error. D) None. Show Answer Correct Answer: A) Draws a circle. 21. What is the difference between print() and return in a function? A) Print() gives output on the screen, return gives value back to the program. B) Both are the same. C) Print() is faster than return. D) Return only works with numbers. Show Answer Correct Answer: A) Print() gives output on the screen, return gives value back to the program. 22. In which part of memory does the system store the parameters and local variables of a function call? A) Heap. B) Stack. C) Both a and b. D) None of the above. Show Answer Correct Answer: B) Stack. 23. What are the benefits of using functions? A) Simpler code. B) Code reuse. C) Better testing and debugging. D) All of the above. Show Answer Correct Answer: D) All of the above. 24. What will happen if you call a function with fewer arguments than it requires and no default values are set? A) The function will run with missing values as zero. B) Python will raise a 'TypeError'. C) The function will ignore missing arguments. D) The function will return 'None'. Show Answer Correct Answer: B) Python will raise a 'TypeError'. 25. Which type of function definition allows specifying default values in the function header? A) Named arguments. B) Default arguments. C) Keyword arguments. D) Positional arguments. Show Answer Correct Answer: B) Default arguments. ← 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 9Class 11 Computer Science Chapter 5 Functions In Python Quiz 10 🏠 Back to Homepage 📘 Download PDF Books 📕 Premium PDF Books