Chapter 1 Function 1mrk
Chapter 1 Function 1mrk
1. The small sections of code that are used to perform a particular task is called ……………………….
(a) Subroutines (b) Files (c) Pseudo code (d) Modules
2. Which of the following is a unit of code that is often defined within a greater code structure?
(a) Subroutines (b) Function (c) Files (d) Modules
5. The values which are passed to a function definition are called ……………………….
(a) Arguments (b) Subroutines (c) Function (d) Definition
6. Which of the following are mandatory to write the type annotations in the function definition?
(a) Curly braces (b) Parentheses (c) Square brackets (d) Indentations
8. Which of the following carries out the instructions defined in the interface?
(a) Operating System (b) Compiler (c) Implementation (d) Interpreter
9. The functions which will give exact result when same arguments are passed are called
……………………….
(a) Impure functions (b) Partial Functions
10. The functions which cause side effects to the arguments passed are called ……………………….
(a) Impure functions (b) Partial Functions
a) It can be called only once b) It can have only one return statement
a) Argument is the value passed to a function, while parameter is the variable that receives the
argument
b) Argument is the variable that receives the value, while parameter is the value passed to a
function
c) It makes the program easier to read and maintain d) It makes the program slower
c) To declare the function name and parameters d) To return a value from the
function
c) It makes the program reusable and modular d) It makes the program slower
a) To declare the function name and parameters b) To define the function body
20. What is the difference between a function definition and a function call?
a) A function definition declares the function, while a function call executes the function
b) A function definition executes the function, while a function call declares the function
c) A function definition is used to declare variables, while a function call is used to pass arguments
d) A function definition is used to pass arguments, while a function call is used to declare variables
24. Which of the following is an example of a function with a single return statement?
25. 1. What is the difference between a function with a return type of int and a function with a
return type of void?
a) A function with a return type of int returns a value, while a function with a return type of void
does not return a value
b) A function with a return type of int takes no arguments, while a function with a return type of
void takes arguments
c) A function with a return type of int is used to declare variables, while a function with a return
type of void is used to pass arguments
d) A function with a return type of int is used to pass arguments, while a function with a return
type of void is used to declare variables
c) It makes the program reusable and modular d) It makes the program slower
a) int add(int x, int y); b) void display(); c) int sum(int x); d) double area();
33. What is the difference between a function definition and a function declaration?
a) A function definition declares the function, while a function declaration defines the function
b) A function definition defines the function, while a function declaration declares the function
c) A function definition is used to call the function, while a function declaration is used to define
the function
d) A function definition is used to declare variables, while a function declaration is used to pass
arguments
c) It makes the program more efficient d) It makes the program easier to understand
a) The first call to the function b) The last call to the function
c) The case that stops the recursion d) The case that starts the recursion
c) To declare variables
b) A recursive function uses a recursive call, while an iterative function uses a loop
c) It uses more memory and can cause stack overflow d) It is easier to understand and
implement
41.Which of the following is an example of a problem that can be solved using recursion?
a) The first call to the function b) The last call to the function
c) The case that stops the recursion d) The case that starts the recursion
a) It uses a loop to repeat the function call b) It uses a recursive call to repeat the function
call
c) It uses a stack to store the function calls d) It uses a queue to store the function calls
b) A recursive function uses a recursive call, while a loop uses a iterative call
47. What is the purpose of the recursive function call in a recursive algorithm?
48. What is the main advantage of using dynamic programming over recursive functions?
b) It is faster
d) It is easier to implement
c) They use a divide and conquer approach d) They use a greedy approach
50. Which of the following is an example of a problem that can be solved using dynamic
programming?