What is the purpose of the main function in a C program?
Entry point of the program
How do you access the third element of an array named numbers in C?
numbers[2]
What is the result of the expression 5 / 2 in C?
2
Which statement is used for multiple conditional branches in C?
if
What is the difference between printf and scanf in C?
printf is for formatted output, and scanf is for formatted input
Which of the following is the correct way to declare an integer variable named count?
int count;
What is the purpose of the #include directive in C?
Include a library
How do you initialize an array of integers with values 1, 2, 3, and 4 in C?
int arr[] = {1, 2, 3, 4};
In a switch statement, what happens if there is no break statement after a case?
Control transfers to the next case
How do you comment a single line in C?
// Comment
What is the size of the float data type in bytes?
4
What is the difference between int and float data types in C?
int is for integers, and float is for floating-point numbers
How many times will the following for loop execute?
for (int i = 0; i < 5; i++) {
// Code here
}
4
What is the purpose of the void keyword in a function declaration?
It indicates that the function returns no value.
How do you find the length of an array in C?
With the sizeof function
Which statement is used to terminate the execution of a loop in C?
break
What is the correct way to declare and initialize a string in C?
char str[] = "Hello";
What is the result of the expression 5 & 3 in C?
a
What is the result of the expression 5 & 3 in binary?
001
What is the index of the first element in an array in C?
0
What is the purpose of the return statement in a function?
To return a value from the function
What does the sizeof operator in C return?
Size of a variable in bytes
Which of the following is a valid way to declare a constant in C?
const int x = 10;
What will be the output of the following code snippet?
int i = 5;
printf("%d", ++i + i++);
12
Which of the following is true regarding the fgets function in C?
It reads a line of text from a file or the standard input