Show List
Quiz - C - 3
Select the right answer for below questions:
What is the difference between the postfix increment operator (x++) and the prefix increment operator (++x)?
The postfix increment operator returns the value of x before incrementing it, while the prefix increment operator increments x first and then returns the value
The prefix increment operator returns the value of x before incrementing it, while the postfix increment operator increments x first and then returns the value
There is no difference between the postfix increment operator and the prefix increment operator
The prefix increment operator returns the value of x before incrementing it, while the postfix increment operator increments x first and then returns the value
What is the output of the following code?
#include
int main() {
int x = 10;
int y = 20;
x = x * y;
printf("x = %d\n", x);
return 0;
}
#include
int main() {
int x = 10;
int y = 20;
x = x * y;
printf("x = %d\n", x);
return 0;
}
x = 10
x = 20
x = 200
x = 200
What is the correct syntax for an if-else statement in C?
if (condition) statement1 else statement2;
if (condition) { statement1 } else { statement2 };
if condition statement1 else statement2;
if (condition) { statement1 } else { statement2 };
What is the value of the following expression in C?
4 + 5 * 2
4 + 5 * 2
14
9
18
18
What is the use of the "void" keyword in C programming?
To declare a variable without a value
To declare a function without a return type
To declare a variable with a null value
To declare a function without a return type
What is the difference between a while loop and a do-while loop in C programming?
A while loop checks the condition before executing the loop, while a do-while loop executes the loop first and then checks the condition
A do-while loop checks the condition before executing the loop, while a while loop executes the loop first and then checks the condition
There is no difference between a while loop and a do-while loop
A while loop checks the condition before executing the loop, while a do-while loop executes the loop first and then checks the condition
What is the syntax for declaring a pointer in C programming?
type pointer_name;
type * pointer_name;
type pointer_name;
type * pointer_name;
What is the purpose of the continue statement in a loop?
To break out of the loop and continue executing the code after the loop
To continue to the next iteration of the loop
To skip to the next iteration of the loop
To continue to the next iteration of the loop
What is the function of the #include preprocessor directive in C programming?
To include a library file in the program
To define a macro
To execute a function
To include a library file in the program
What is the difference between call by value and call by reference in C programming?
Call by value passes a copy of the argument to the function, while call by reference passes a reference to the argument
Call by reference passes a copy of the argument to the function, while call by value passes a reference to the argument
There is no difference between call by value and call by reference
Call by value passes a copy of the argument to the function, while call by reference passes a reference to the argument
Submit
Retry
{"qz1-506516":"The prefix increment operator returns the value of x before incrementing it, while the postfix increment operator increments x first and then returns the value","qz1-506517":"x = 200","qz1-506518":"if (condition) { statement1 } else { statement2 };","qz1-506519":"18","qz1-506520":"To declare a function without a return type","qz1-506521":"A while loop checks the condition before executing the loop, while a do-while loop executes the loop first and then checks the condition","qz1-506522":"type * pointer_name;","qz1-506523":"To continue to the next iteration of the loop","qz1-506524":"To include a library file in the program","qz1-506525":"Call by value passes a copy of the argument to the function, while call by reference passes a reference to the argument"}
Leave a Comment