MCQ@1
MCQ@1
MCQ@1
A. int
B. char
C. float
D. double
#include <stdio.h>
int main()
{
float x = 21.0;
x %= 3.0;
printf("%f",x);
return 0;
}
A. 7
B. 7.00
C. 7.000000
D. Error
#include <stdio.h>
void main()
{
int x = 10;
int y = ++x + 20;
printf("%d,%d",x,y);
return 0;
}
A. 11,30
B. 11,31
C. 10,30
D. 10,31
A. Ampersand
B. And
C. Address of
D. None of the above
5. Which of the following are valid decision-making statements in C?
A. if
B. switch
C. nested if
D. All of these
7. Which statement is required to execute a block of code when the condition is false?
A. for
B. if
C. else
D. All of these
A. 1
B. 2
C. Infinite
D. None of these
A. switch
B. for
C. Array
D. All
12. When the condition of the do-while loop is false, how many times will it execute the code?
A. 0
B. 1
C. Infinite
D. Error
A. Pre-processor
B. Compiler
C. Linker
D. Editor
A. DOS
B. Windows
C. Unix
D. All of these
A. !
B. #
C. ~
D. ;
A. Keywords
B. Variables
C. Constants
D. All of the above
17. What is the valid range of numbers for int type of data?
A. 0 to 256
B. -32768 to +32767
C. -65536 to +65536
D. No specific range
#include <stdio.h>
int main(){
char grade = 'D';
switch (grade)
{
case 'A':
printf("Excellent!\n");
case 'B':
case 'C':
printf("Well done\n");
case 'D':
printf("You passed\n");
case 'F':
printf("Better try again\n");
break;
default:
printf("Invalid grade\n");
}
}
A. Error
B. You passed
C. Better try again
D. Exit the program
A. :=
B. Equal
C. =
D. ==
A. Compiler commands
B. Library functions
C. Header information of C programs
D. Operators for files