In C, what is the purpose of the 'inline' keyword when used with a function?
A. To indicate that the function should be inlined by the compiler
B. To specify that the function is only used in one file
C. To make the function public
D. To declare a recursive function
Select an option to see the answer and solution.
What is a function parameter in C?
A. A value passed to a function when it's called
B. A variable declared within a function
C. A reserved keyword
D. A global variable
Select an option to see the answer and solution.
What is the result of the expression ceil(3.2) in C, assuming proper inclusion of the math library?
Select an option to see the answer and solution.
In C, what is the purpose of the 'const' keyword when used with a function parameter?
A. It specifies that the parameter is constant and cannot be modified
B. It makes the parameter mandatory
C. It makes the parameter optional
D. It specifies that the parameter is a constant function
Select an option to see the answer and solution.
How can you declare a function in C that takes a variable number of arguments?
A. Using the 'variable' keyword
B. Using the 'args' keyword
C. Using the '...' notation
D. Using the 'varargs' keyword
Select an option to see the answer and solution.
In C, what is the purpose of the 'recursion' in a function?
A. To create an infinite loop
B. To make the function faster
C. To make the function return a constant value
D. To call the function itself
Select an option to see the answer and solution.
What is the result of the expression pow(2, 3) in C, assuming proper inclusion of the math library?
Select an option to see the answer and solution.
What is the purpose of the 'volatile' keyword when used with a function in C?
A. To make the function execute faster
B. To specify that the function is unpredictable
C. To optimize the function
D. To indicate that the function may change external variables
Select an option to see the answer and solution.
What is the result of the expression abs(-7.5) in C?
Select an option to see the answer and solution.
In C, what is a function parameter's scope?
A. Limited to the function where it is declared
B. Limited to the entire program
C. Limited to the block where it is declared
D. Limited to the main() function
Select an option to see the answer and solution.
What will happen after compiling and running following code?
main()
{
printf("%p", main);
}A. Error
B. Will make an infinite loop.
C. Some address will be printed.
D. None of these.
Select an option to see the answer and solution.
Use of functions
A. Helps to avoid repeating a set of statements many times.
B. Enhances the logical clarity of the program.
C. Helps to avoid repeated programming across programs.
D. Makes the debugging task easier.
E. All of the above
Select an option to see the answer and solution.
Any C program
A. Must contain at least one function.
B. Need not contain any function.
C. Needs input data.
D. None of the above
Select an option to see the answer and solution.
What is function?
A. Function is a block of statements that perform some specific task.
B. Function is the fundamental modular unit. A function is usually designed to perform a specific task.
C. Function is a block of code that performs a specific task. It has a name and it is reusable.
D. All of the above
Select an option to see the answer and solution.
Determine output:
main()
{
int i = abc(10);
printf("%d", --i);
}
int abc(int i)
{
return(i++);
}A. 10
B. 9
C. 11
D. None of these.
Select an option to see the answer and solution.
The default parameter passing mechanism is
A. call by value
B. call by reference
C. call by value result
D. None of these.
Select an option to see the answer and solution.
What is the result of compiling and running this code?
main()
{
char string[] = "Hello World";
display(string);
}
void display(char *string)
{
printf("%s", string);
}A. will print Hello World
B. Compilation Error
C. will print garbage value
D. None of these.
Select an option to see the answer and solution.
Determine output:
main()
{
int i = 5;
printf("%d%d%d%d%d", i++, i--, ++i, --i, i);
}A. 54544
B. 45445
C. 54554
D. 45545
Select an option to see the answer and solution.
Pick the correct statements.
I. The body of a function should have only one return statement.
II. The body of a function may have many return statements.
III. A function can return only one value to the calling environment.
IV. If return statement is omitted, then the function does its job but returns no value to the calling environment.
A. I and II
B. I and III
C. II and III
D. II and IV
E. III and IV
Select an option to see the answer and solution.
What will be the output of the following program code?
main()
{
static int var = 5;
printf("%d ", var--);
if(var)
main();
}A. 5 5 5 5 5
B. 5 4 3 2 1
C. Infinite Loop
D. Compilation Error
E. None of these
Select an option to see the answer and solution.