google.com, pub-6167773875660516, DIRECT, f08c47fec0942fa0 class 11 computer science chapter 7 mcq questions | functions mcq class 11 - 2nd puc computer science

class 11 computer science chapter 7 mcq questions | functions mcq class 11

class 11 computer science chapter 7 mcq questions,functions mcq class 11,mcq on functions class 11,mcq on functions in python,mcq on functions,Mcq on functions class 11 pdf,Mcq on functions class 11 with answers pdf,Mcq on functions class 11 pdf download,Mcq on functions class 11 with answers,Functions multiple Choice questions PDF,Mcq on functions class 11 cbse,functions in python mcq,functions in python mcq questions,functions in python mcqs,built in functions in python mcq

1. What is the process of dividing a computer program into separate independent blocks of code known as?





ANSWER= B) Modular programming

2. What is the purpose of functions in programming?





ANSWER= C) To achieve modularity and reusability

3. Which of the following statements is true about functions?





ANSWER= C) Functions can be called repeatedly

4. What is the syntax to define a function in Python?





ANSWER= C) def function_name():

5. What does the 'return' statement do in a function?





ANSWER= A) Ends the function execution and optionally passes back an expression to the caller

6. What is the term for a value passed to a function during the function call?





ANSWER= B) Argument

7. What is a user-defined function?





ANSWER= B) A function defined by the programmer

8. In the function definition `def add(a, b):`, what are `a` and `b`?





ANSWER= C) Parameters

9. Which keyword is used to create a function in Python?





ANSWER= D) def

10. What is the output of the following code? Python Code: def greet(name): return "Hello, " + name print(greet("Alice"))





ANSWER= C) Hello, Alice

11. How do you call a function named `my_function` in Python?





ANSWER= B) my_function()

12. What will be the output of the following code? Python Code: def add(a, b): return a + b result = add(3, 5) print(result)





ANSWER= A) 8

13. What is an advantage of using functions in a program?





ANSWER= C) Increases reusability

14. What is the output of the following code? Python Code: def multiply(a, b): return a * b print(multiply(2, 4))





ANSWER= D) 8

15. Which of the following is not a characteristic of a function?





ANSWER= B) It must return a value

16. What is the main advantage of breaking a program into smaller functions?





ANSWER= C) To make the program more organized and manageable

17. What is the keyword used to return a value from a function in Python?





ANSWER= C) return

18. What is the output of the following code? Python Code: def subtract(a, b): return a - b print(subtract(10, 3))





ANSWER= A) 7

19. Which of the following best describes a function?





ANSWER= A) A block of code that performs a specific task

20. How do you define a function with no parameters?





ANSWER= B) def function_name():

21. What will be the output of the following code? Python Code: def divide(a, b): return a / b print(divide(10, 2))





ANSWER= A) 5.0

22. What is a function call?





ANSWER= B) Executing a function

23. Which of the following is an invalid function name in Python?





ANSWER= D) 1function

24. What is the output of the following code? Python Code: def say_hello(): print("Hello, World!") say_hello()





ANSWER= A) Hello, World!

25. What is the main purpose of the `def` keyword in Python?





ANSWER= B) To define a function

26. Which of the following functions is used to find the length of a list in Python?





ANSWER= B) len()

27. What will be the output of the following code? Python Code: def square(x): return x * x print(square(3))





ANSWER= C) 9

28. What is a parameter in the context of functions?





ANSWER= D) A variable used in the function definition

29. Which of the following is an example of a function with a return value?





ANSWER= B) def greet(): return "Hello!"

30. What will be the output of the following code? Python Code: def concat(str1, str2): return str1 + str2 print(concat("Hello, ", "World!"))





ANSWER= C) Hello, World!

31. How do you pass multiple arguments to a function in Python?





ANSWER= B) def function_name(arg1, arg2):

32. What will be the output of the following code? Python Code: def power(base, exp): return base**exp print(power(2, 3))





ANSWER= B) 8

33. What is the main purpose of using functions in programming?





ANSWER= C) To organize code and promote reusability

34. What will be the output of the following code? Python Code: def add_five(x): return x + 5 print(add_five(10))





ANSWER= B) 15

35. What is the keyword used to define a function in Python?





ANSWER= C) def

36. What will be the output of the following code? Python Code: def greet(): return "Hello!" print(greet())





ANSWER= C) Hello!

37. How do you specify default values for parameters in a function?





ANSWER= A) def function_name(param=value):

38. What is the output of the following code? Python Code: def increment(n): n += 1 return n print(increment(7))





ANSWER= C) 8

39. Which statement is true regarding a function with multiple return statements?





ANSWER= A) Only the first return statement will be executed

40. What will be the output of the following code? Python Code: def double(x): return x * 2 result = double(4) print(result)





ANSWER= D) 8

41. Which of the following is a correct way to document a function in Python?





ANSWER= B) Using triple-quoted strings (""" """)

42. What will be the output of the following code? Python Code: def subtract(a, b): return a - b print(subtract(15, 5))





ANSWER= A) 10

43. What is the term used for a function defined inside another function?





ANSWER= A) Nested function

44. What will be the output of the following code? Python Code: def sum_numbers(a, b): return a + b result = sum_numbers(3, 4) print(result)





ANSWER= C) 7

45. What is the output of the following code? Python Code: def identity(x): return x print(identity("Python"))





ANSWER= A) Python

46. How do you ensure a function has a variable number of arguments in Python?





ANSWER= A) Using an asterisk (*) before the parameter name

47. What will be the output of the following code? Python Code: def repeat_string(s, n): return s * n print(repeat_string("Hi", 3))





ANSWER= B) HiHiHi

48. Which of the following is not a valid Python function?





ANSWER= B) def my-func():

49. What is the primary purpose of a lambda function in Python?





ANSWER= C) To create small anonymous functions

50. What will be the output of the following code? Python Code: def add(a, b=5): return a + b print(add(3))





ANSWER= C) 8

class 11 computer science chapter 7 mcq questions | functions mcq class 11 class 11 computer science chapter 7 mcq questions | functions mcq class 11 Reviewed by Vision Academy on September 21, 2024 Rating: 5

No comments:

CheckOut

Powered by Blogger.