This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 5 Functions In Python – Quiz 15 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 5 Functions In Python Quiz 15 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. How do you reverse a string in Python? A) String[::-1]. B) String.flip(). C) Reverse(string). D) String.reverse(). Show Answer Correct Answer: A) String[::-1]. 2. What is the 'return' statement used for in a function? A) To print a value to the console. B) To define a new variable. C) To exit a function and return a value to the caller. D) To loop through a list of elements. Show Answer Correct Answer: C) To exit a function and return a value to the caller. 3. A recursive function is A) A function that calls other functions in a recursive way. B) Any function that calls itself is called recursive. C) A function that has a base case or termination condition. D) None of the above. Show Answer Correct Answer: B) Any function that calls itself is called recursive. 4. What will be the output of the following code? "'pythondef multiply(x, y):product = x * y return productprint(multiply(2, 5)) "' A) '10'. B) '25'. C) '7'. D) 'None'. Show Answer Correct Answer: A) '10'. 5. Which of the following is a common use case for lambda functions? A) Defining a new class. B) Writing complex algorithms. C) Passing a simple function as an argument. D) Creating a new module. Show Answer Correct Answer: C) Passing a simple function as an argument. 6. What will be the output of this program?def addOne(number):number += 1 return numberone = addOne(0)two = addOne(one)print(two) A) 0. B) 1. C) 2. D) 3. E) 4. Show Answer Correct Answer: C) 2. 7. What will be the output of the following Python code?def cube(x):return x * x * xx = cube(3)print (x) A) 9. B) 3. C) 27. D) 30. Show Answer Correct Answer: C) 27. 8. What is the purpose of the 'return' statement in a Python function? A) To print the result. B) To exit the function and return a value. C) To define a new function. D) To repeat the function. Show Answer Correct Answer: B) To exit the function and return a value. 9. What is the output of the following code? def first ..... five ..... even ..... numbers():for num in range(2, 11):if num % 2 == 0:print(num); first ..... five ..... even ..... numbers() A) 2, 4, 6, 8, 10. B) None. C) 1, 2, 3, 4, 5. D) Error. Show Answer Correct Answer: A) 2, 4, 6, 8, 10. 10. The ..... keyword is ignored by the Python interpreter and can be used as a placeholder for code that will be written later. A) Execute. B) Skip. C) Pass. D) Pause. Show Answer Correct Answer: C) Pass. 11. What is the purpose of the Turtle module in Python? A) To handle data. B) To manage files. C) To create graphics. D) To perform calculations. Show Answer Correct Answer: C) To create graphics. 12. Assertion (A):Keyword arguments are related to the function calls. Reason (R):When you use keyword arguments in a function call, the caller identifies the arguments by the parameter name. 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: A) Both A and R are true and R is the correct explanation for A. 13. A group of statements that exist within a program for the purpose of performing a specific task is a(n) ..... A) Function. B) Variable. C) Loop. D) Block. Show Answer Correct Answer: A) Function. 14. Which of the following is the correct way to call a function named 'hello' with one argument, '"World"'? A) 'hello "World"'. B) 'hello("World")'. C) 'hello.World()'. D) 'call hello("World")'. Show Answer Correct Answer: B) 'hello("World")'. 15. What are the advantages of using functions in Python? A) Limited code re-usability. B) Increased complexity and slower development. C) Improved program readability and code sharing. D) Decreased code re-usability and avoid repetition. Show Answer Correct Answer: C) Improved program readability and code sharing. 16. How can you use a lambda function to filter a list of numbers to only include even numbers? A) 'filter(lambda x:x % 2 == 0, list of numbers)'. B) 'filter(lambda x:x % 2 != 0, list of numbers)'. C) 'filter(lambda x:x > 0, list of numbers)'. D) 'filter(lambda x:x < 0, list of numbers)'. Show Answer Correct Answer: A) 'filter(lambda x:x % 2 == 0, list of numbers)'. 17. Def fun():print('Hello User')is an example of A) Function having no parameter and no return value. B) Function having no parameter and but return value. C) Function having parameter and result. D) Function having parameter and return value. Show Answer Correct Answer: A) Function having no parameter and no return value. 18. Which type of data type requires the 'global' keyword to modify a global variable inside a function? A) String type. B) Mutable type. C) Immutable type. D) Integer type. Show Answer Correct Answer: C) Immutable type. 19. What Is The Output Of The Following Code Snippet? def func(message, num = 1):print(message * num) func('Welcome')func('Viewers', 3) A) Welcome Viewers. B) WelcomeViewersViewersViewers. C) WelcomeViewers, Viewers, Viewers. D) Welcome. Show Answer Correct Answer: B) WelcomeViewersViewersViewers. 20. What is a situation where you would want to use a function to simplify(make easier to read) your code? A) Calculating the average of a list of numbers. B) Simple arithmetic calculation. C) Insert a variable inside a string. D) Sequential operations. Example:Add one to a number. Show Answer Correct Answer: A) Calculating the average of a list of numbers. 21. Which statement about local variables is TRUE? A) Local variables are accessible only within the function where they are defined. B) Local variables can be accessed from anywhere in the programme. C) Local variables are always global. D) Local variables must be integers. Show Answer Correct Answer: A) Local variables are accessible only within the function where they are defined. 22. Which of the following statements is true about lambda functions? A) They can contain multiple expressions. B) They can have a name. C) They are defined using the 'def' keyword. D) They are useful for short, simple functions. Show Answer Correct Answer: D) They are useful for short, simple functions. 23. The values received in a function definition/header statement are called ..... A) Arguments. B) Parameter. C) Values. D) None. Show Answer Correct Answer: B) Parameter. 24. Functions help us to break the program into smaller chunks A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: A) True. 25. What is the purpose of the pass keyword? A) To create empty functions. B) To terminate a function. C) To define a function. D) To call a function. Show Answer Correct Answer: A) To create empty functions. ← 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