NEW
Font size
WorksheetsFunctions in C - Worksheet
Total questions: 15
Worksheet time: 8mins
What is a function in C?
A variable that stores data
A block of code that performs a specific task
A loop that repeats code
A comment in the program
Which keyword is used to define a function in C?
define
function
void
No special keyword is needed
What is the purpose of the return statement in a function?
To print output
To exit the program
To send a value back to the caller
To define a variable
Which of the following is a correct function declaration in C?
function add(int a, int b)
int add(int a, int b)
add(int a, int b)
int add(a, b)
What is the default return type of a function in C if not specified?
void
float
int
char
Which of the following is used to pass arguments to a function in C?
return
main()
Function parameters
What does the void keyword indicate in a function declaration?
The function returns a value
The function has no name
The function does not return any value
The function has no parameters
Which of the following is true about the main() function in C?
It is optional
It must be the last function in the file
It is the entry point of a C program
It cannot call other functions
What is the correct way to call a function named sum that takes two integers?
sum a, b;
call sum(a, b);
sum(a, b);
int sum(a, b);
Which of the following is NOT a valid return type for a function in C?
int
float
array
char
Which of the following is a valid reason to use functions in C?
To make code longer
To avoid using variables
To improve code reusability and readability
To reduce memory usage
What is the scope of a variable declared inside a function?
Local
Global
Block-level
Module-level
Which of the following is true about recursive functions?
They cannot call themselves
They must have a base condition to avoid infinite calls
They are faster than loops in all cases
They always return void
What is the output type of a function declared as void?
Integer
Character
No output
Boolean
Which of the following allows a function to modify the original variable passed to it?
Passing by value
Passing by reference using pointers
Using global variables only
Declaring variables as const
