MCQ PORTAL

Back to All Topics

Functions

Showing 20 of 20 questions in this topic

Start Practice Mode

Answer Green MarksON

Correct answers are highlighted in green

C060Functions • Recursion
Most ImportantEasy

Q1.A function that calls itself is known as a:

A
nested function
B
recursive function
Correct answer
C
inline function
D
library function
C061Functions • Call by value
Most ImportantMedium

Q2.In call by value, changes made to the parameters inside the function:

A
affect the original arguments
B
do not affect the original arguments
Correct answer
C
delete the arguments
D
cause an error
C062Functions • Call by reference
Most ImportantMedium

Q3.In call by reference, arguments are passed using:

A
values
B
addresses (pointers)
Correct answer
C
copies
D
constants
C064Functions • void
Most ImportantEasy

Q4.If a function does not return any value, its return type should be:

A
int
B
void
Correct answer
C
null
D
empty
C066Functions • Function call
Most ImportantEasy

Q5.Which is the correct way to call a function named sum with two arguments?

A
sum[3, 4];
B
sum(3, 4);
Correct answer
C
call sum(3, 4);
D
sum{3, 4};
C148Functions • Return value
Most ImportantMedium

Q6.Using a single return statement, a C function can return at most how many values?

A
one
Correct answer
B
two
C
four
D
unlimited
C155Functions • Call by reference
Most ImportantMedium

Q7.To let a function change the caller's original variables, you should use:

A
call by value
B
call by reference (pass addresses)
Correct answer
C
a return statement only
D
a global constant
C063Functions • Prototype
ImportantMedium

Q8.The line that specifies a function's return type, name, and parameters before it is used is called the:

A
function body
B
function call
C
function prototype (declaration)
Correct answer
D
function pointer
C065Functions • Recursion base case
ImportantMedium

Q9.What does a recursive function need in order to stop calling itself?

A
a return value
B
a base condition (terminating condition)
Correct answer
C
a loop
D
a global variable
C067Functions • Arguments
ImportantMedium

Q10.The values passed to a function during a call are known as:

A
formal parameters
B
actual arguments
Correct answer
C
return values
D
local variables
C068Functions • Recursion example
ImportantMedium

Q11.A recursive function computes 4! (4 factorial). What value does it return?

A
12
B
16
C
24
Correct answer
D
4
C149Functions • main
ImportantEasy

Q12.The conventional return type of the main() function is:

A
void
B
int
Correct answer
C
float
D
char
C150Functions • Parameters
ImportantMedium

Q13.The variables in a function definition that receive the passed values are called:

A
actual arguments
B
formal parameters
Correct answer
C
return values
D
global variables
C151Functions • Recursion internals
ImportantHard

Q14.Which data structure does the system use internally to handle recursion?

A
queue
B
stack
Correct answer
C
array
D
linked list
C152Functions • void function
ImportantMedium

Q15.A function that takes no arguments and returns nothing is written as:

A
int f();
B
void f(void);
Correct answer
C
f(void);
D
return f();
C157Functions • Recursion
ImportantMedium

Q16.A recursive function that has no base (stopping) condition will:

A
run once
B
call itself forever until a stack overflow
Correct answer
C
return 0
D
give a syntax error
C069Functions • Local variables
OtherEasy

Q17.A variable declared inside a function is called a:

A
global variable
B
local variable
Correct answer
C
static array
D
register constant
C153Functions • Nesting
OtherMedium

Q18.Calling one function from inside another function is called:

A
recursion
B
nesting of function calls
Correct answer
C
overloading
D
inlining
C154Functions • Scope
OtherMedium

Q19.A variable declared inside main() has scope that is:

A
global to the whole program
B
local to main() only
Correct answer
C
shared with all functions
D
permanent
C156Functions • Header
OtherMedium

Q20.The sqrt() function requires which header file?

A
<stdio.h>
B
<string.h>
C
<math.h>
Correct answer
D
<stdlib.h>