
Functions and Recursion in C Quiz
Authored by Dr. Tanya Gera
Computers
University

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is the correct syntax for a function declaration in C?
`int myFunction[] { }`
`int myFunction(int a, int b);`
`function myFunction(int a, int b);`
`declare int myFunction(int a, int b);`
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of a function prototype (declaration) in C?
To allocate memory for the function
To define the body of the function
To inform the compiler about the function's name, return type, and parameters before its actual definition
To call the function from the main program
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is a valid function definition in C?
`int add(int a, int b) { return a + b; }`
`int add(int a, int b);`
`add(int a, int b) -> int { return a + b; }`
`function int add(a, b) { return a + b; }`
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the return type of a function that does not return any value in C?
`null`
`int`
`void`
`empty`
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following C code? ```c int square(int x) { return x * x; } int main() { printf("%d", square(5)); return 0; } ```
10
25
55
Compilation Error
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
In C, what happens if a function is called before its declaration or definition?
The program runs normally without any issues
The compiler may generate a warning or error due to implicit declaration
The function is automatically declared by the linker
The program skips the function call
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following correctly describes recursion in C?
A function that calls another function repeatedly
A function that calls itself directly or indirectly to solve a problem
A loop that repeats a block of code multiple times
A function that returns multiple values
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Microsoft
or continue with
%20(1).png)
Apple
Others
Already have an account?