0% found this document useful (0 votes)
41 views2 pages

Question Set3 - C

This document contains 27 multiple choice questions about C programming concepts such as operators, data types, control flow, functions and arrays. The questions cover a variety of basic and some intermediate topics to test one's knowledge of the C language.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views2 pages

Question Set3 - C

This document contains 27 multiple choice questions about C programming concepts such as operators, data types, control flow, functions and arrays. The questions cover a variety of basic and some intermediate topics to test one's knowledge of the C language.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Question Set:3

By Rabi shaw P.No:9007960872

Q1. What will be the output of the following arithmetic Q11. What will be the output of the following statements?
expression ? int i = 1,j; j=i--- -2; printf("%d",j);
5+3*2%10-8*6 a) error b) 2 c) 3 d) -3
a) -37 b) -42 c) -32 d) -28 Q12. What will be the output of following program ?
Q2. What will be the output of the following statement? #include
int a=10; printf("%d &i",a,10); main()
a) error b) 10 c) 10 10 d) none of these {
Q3. What will be the output of the following statement ? int x,y = 10;
x = y * NULL;
printf("%x%x%ci%x",11,10,'s',12); printf("%d",x);
a) error b) basc c) Bas94c d) none of these }
a) error b) 0 c) 10 d) garbage value
Q4. What will be the output of the following statements ? Q13. What will be the output of following statements ?
int a = 4, b = 7,c; c = a = = b; printf("%i",c); char x[ ] = "hello hi"; printf("%d%d",sizeof(*x),sizeof(x));
a) 0 b) error c) 1 d) garbage value
Q 5. What will be the output of the following statements ? a) 88 b) 18 c) 29 d) 19
int a = 5, b = 2, c = 10, i = a>b Q14. What will be the output of the following statements ?
void main() int a=5,b=6,c=9,d; d=(ac?1:2):(c>b?6:8)); printf("%d",d);
{ printf("hello"); main(); } a) 1 b) 2 c) 6 d) 8
Q15. What will be the output of the following statements ?
a) 1 b) 2 c) infinite number of times d) none of these int i = 3;
printf("%d%d",i,i++);
Q7. What will be the output of the following statements ?

a) 3 4 b) 4 3 c) 4 4 d) 3 3
int x[4] = {1,2,3}; printf("%d %d %D",x[3],x[2],x[1]); Q16. What will be the output of the following program ?
#include
a) 03%D b) 000 c) 032 d) 321 void main()
Q8. What will be the output of the following statement ? {
printf( 3 + "goodbye"); int a = 36, b = 9;
printf("%d",a>>a/b-2);
a) goodbye b) odbye c) bye d) dbye }
Q9. What will be the output of the following statements ? a) 9 b) 7 c) 5 d) none of these
long int a = scanf("%ld%ld",&a,&a); printf("%ld",a); Q17) int testarray[3][2][2] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
a) error b) garbage value c) 0 d) 2 What value does testarray[2][1][0] in the sample code above
Q10. What will be the output of the following program ? contain?
#include a) 11 b) 7 c) 5 d) 9
void main() Q18) void main()
{ int a = 2; {
switch(a) int a=10,b=20;
{ case 1: char x=1,y=0;
printf("goodbye"); break; if(a,b,x,y)
case 2: {
continue; printf("EXAM");
case 3: }
printf("bye"); }
} What is the output?
}
a) error b) goodbye c) bye d) byegoodbye 1) XAM is printed 2) exam is printed

1
3) Compiler Error 4) Nothing is printed Q24) #include
void func()
Q19)What is the output of the following code? {
#include int x = 0;
void main() static int y = 0;
{ x++; y++;
int s=0; printf( "%d -- %d\n", x, y );
while(s++<10)> }
# define a 10 int main()
main() {
{ func(); func();
printf("%d..",a); return 0;
foo(); }
printf("%d",a); What will the code above print when it is executed?
} 1) 1 - - 1 2) 1—1 3) 1---1 4) 1-----1
void foo() 1–1 2—1 2----2 1---- 2
{ Q25) long factorial (long x)
#undef a {
#define a 50 ????
} return x * factorial(x - 1);
1) 10..10 2) 10..50 3) Error 4) 0 }
Q21) main() With what do you replace the ???? to make the function
{ shown above return the correct answer?
struct 1) if (x == 0) return 0; 2) return 1;
{ 3) if (x >= 2) return 2; 4) if (x <= 1) return 1;
int i; Q 26) int y[4] = {6, 7, 8, 9};
}xyz; int *ptr = y + 2; printf("%d\n", ptr[ 1 ] );
(*xyz)->i=10; What is printed when the sample code above is executed?
printf("%d",xyz.i); 1) 6 2) 7 3) 8 4) 9 .
} Q27) int i = 4;
What is the output of this program? switch (i)
1) program will not compile 2) 10 {
3) god only knows 4) address of I default: ;
case 3:
Q22) What would be the output of the following program? i += 5;
#include if ( i == 8)
main() {
{ i++;
char str[]="S\065AB"; if (i == 9) break;
printf("\n%d", sizeof(str)); i *= 2;
} }
1) 7 2) 6 3) 5 4) error i -= 4;
Q23) What will be the value of `a` after the following code is break;
executed case 8:
#define square(x) x*x i += 5;
a = square(2+3) break;
1) 25 2) 13 3) 11 4) 10 }
printf("i = %d\n", i);
What will the output of the sample code above be?
1) i = 5 2) i = 8 3) i = 9 4) i = 10

You might also like