WorksheetsOBCFC 18-7-25
Total questions: 10
Worksheet time: 5mins
Which of the following is the correct syntax to declare a function in C?
function int sum(int, int);
int sum(int, int);
sum int(int, int);
int sum;
Which of the following best describes void return type in a function?
Function returns an integer
Function does not return any value
Function returns nothing or null
Function always exits the program
What happens if the number of arguments in the function call does not match with the number of parameters in the function definition?
Compiler automatically adjusts
Runtime error
Compile-time error
No error
What is a function prototype?
A function with no return type
A function that calls another function
A declaration of a function that tells the compiler about function name, return type, and parameters
A function defined inside another function
Which keyword is used to return a value from a function?
send
exit
return
output
A college uses a program with a function int isPresent(char studentID[]) that returns 1 for present and 0 for absent. Which control structure is most suitable to be used with this function?
switch-case
if-else
goto
while loop
You are building a simple calculator in C with separate functions like add(), subtract(), multiply(), and divide(). Which of the following best describes the reason for using multiple functions?
It increases memory usage
It helps in modular design and reusability
It reduces the need for input
It avoids use of loops
A C program is designed to monitor room temperature using a function float getTemperature(). Which of the following best explains why this function should return a value?
To reuse the temperature data later in the program
To avoid using global variables
To print the temperature immediately
To store sensor ID
What will be the output of the following code snippet?
1 2 3 None
2
2 3 None
None
Uses of function
Helps to avoid repeating a set of statements many times
Enhances the logical clarity of the program,Makes the debugging task easier
Helps to avoid repeated programming across programs
All of the above
