C Training Test
C Training Test
C Language Questions
1. 2
2. 15
3. 16 *
4. 18
1. While loop.
2. For loop.
3. do-while loop.
4. None of the above.
#include <stdio.h>
int main()
{
int x = 20;
x %= 3;
printf("%d",x);
return 0;
}
1. 2*
2. 2.5
3. Error
4. Warning
int main()
{
float x = 23.456;
printf("%.2f",x);
return 0;
}
1. 23.45600
2. 23.456
3. 23.45
4. 23.46 *
void main()
{
int x = 10;
int y = x++ + 20;
printf("%d,%d",x,y);
return 0;
}
1. 11,30 *
2. 11,31
3. 10,30
4. 10,31
#include <stdio.h>
int main()
{
unsigned char c=290;
printf("%d",c);
return 0;
}
1. 290
2. 256
3. 34 *
4. Garbage
#include <stdio.h>
int main()
{
int a=0;
a=5||2|1;
printf("%d",a);
return 0;
}
1. 1
2. 7
3. 0
4. 8
#include <stdio.h>
int main()
{
printf((43 > 43) ? "value 1 is greater!" : "value 1 is not greater!");
return 0;
}
#include <stdio.h>
int main()
{
int marks = 43;
1. Grade : A
2. Grade : B
3. Grade : C
4. Grade : D *
#include <stdio.h>
int main(){
char grade = 'B';
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");
}
}
1. Well done
2. You passed
3. Better try again
4. All of these *
int main(){
int a = 11;
return 0;
}
1. 11 13 15 17 19 *
2. 11 12 13 14 15 16 17 18 19 20
3. 11 13 15 17 19 21
4. None of these
1. 1962
2. 1978
3. 1979
4. 1972
19. C is a ___.
A. .c
B. .cpp
C. .c99
D. .h