Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

C Programming

Day 1 Test

Duration

1. What will be the output of the following program?


int main()
{
printf("%f",123.);
return(0);
}
A. 123
B. Compile-Time Error
C. 123.00
D. 123.000000
2. C language was developed by?
A. Dennis Ritchie
B. Martin Richards
C. Bill Gates
D. Ken Thompson
3. What will be the output of the following program :
int main()
{
printf("%d",sizeof(integer));
return(0);
}
A. 2
B. Compile-Time Error
C.4
D. None of these
4. What will be the output of the following program :
int main()
{
printf("%d",!(100==100)+1);
return(0);
}
A. 100
B. 0
C. 1
D.2
5. What will be the output of the following program :
int main()
{
printf("%d %d %d",5,!5,25-!25);
return(0);
}
A. 5 10 22
B. 5 5 25
C.5 0 25
D.5 1 24
6. A character variable can store x characters at a time:
A.1 character
B.8 character
C.256 character
D.None of the above
7. What is the output of the following program?
int main(){
int c=08;
printf("%d",c);
return 0;
}
A.8
B.0
C. Compile Time Error
D.None of the Above

: 20 Min

C Programming
Day 1 Test

Duration

8. The format identifier %i is also used for _____ data type?


A. char
B. int
C. float
D. double
9. What is the size of an int data type?
A. 4 Bytes
B.8 Bytes
C. Depends on the system/compiler
D. Cannot be determined
10. What is the output of this C code?
main()
{
Char c;
c=128;
printf(%d\n,c);
}
A.128
B. -128
C. Depends on the compiler
D. None of the mentioned
11. What is the output of this C code?
main()
{
j = 10;
printf("%d\n", j++);
}
A.10
B.11
C. Compile time error
D.0
12. Which of the following declaration is not supported by C?
A. String str;
B. char *str;
C.float str = 3e2;
D. Both (a) and (c)
13. The following code for(;;) represents an infinite loop. It can be terminated by.
A. break
B. exit(0)
C. abort()
D. All of the mentioned
14. Which keyword is used to prevent any changes in the variable within a C program?
A. immutable
B. mutable
C. const
D. volatile
15. What is the output of this C code?
int main()
{
int x = 1;
if (x > 0)
printf("inside if\n");
else if (x > 0)
printf("inside elseif\n");
}
A. inside if
B. inside elseif
C. inside if inside elseif
D. Compile time error

: 20 Min

You might also like