0% found this document useful (0 votes)
62 views6 pages

C Writen Test

The document contains a coding contest with 25 multiple choice C programming questions. The questions cover topics like operators, data types, functions, control flow, arrays, pointers, and more. The last 5 questions are marked as tie-breakers. Contestants have 30 minutes to answer as many questions as possible.

Uploaded by

Deepak Gr
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views6 pages

C Writen Test

The document contains a coding contest with 25 multiple choice C programming questions. The questions cover topics like operators, data types, functions, control flow, arrays, pointers, and more. The last 5 questions are marked as tie-breakers. Contestants have 30 minutes to answer as many questions as possible.

Uploaded by

Deepak Gr
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

GM Institute of Technology, Davangere.

Dept. of Electronics and Communication Forum Presents

WIZTEC - 11
“NIGHTOUT” - C coding contest (Elimination Round)

Note: 1. Assume appropriate preprocessors to all codes below.


2. Choose one appropriate answer from the given options.
3. Questions in ITALICS are Tie-Breakers.
4. No Negative marking
25 Question duration is 30 minutes

1. #define Square(n) n*n


Void main ( )
{ int j;
j=64/Square (4);
printf (“j=%d”, j);
}

Choice:
a) 4 b) 64 c) 16 d) none

2. int main( )
{ int i=2, j=2;
while (i+1? --i: j++)
printf (“%d”, i);
return 0;
}

Choice:
a) 2 b) 3 c) 1 d) compiler error.

3. int main( )
{ int a, b;
a = -3 - - 25;
b = -3 - - (-3);
printf (“%d, %d\n”, a, b);
return 0;
}

Choice:
a) 21,-7 b) -28,-6 c) 22,-6 d) compiler error.
4. main()
{ float x = 9.9999996;
float y = 9.9999994;
printf ("\n%f %f", x, y);
}
Choice:
a) 10.000000 10.000000 b) Error
c) 9.9999999 9.999999 d) 10.000000 9.999999

5. void main( )
{
char *a;
int *b;
float *c;
double *d;
printf (“ %d ”, sizeof(a)) ;
printf (“ %d ”, sizeof(b)) ;
printf (“ %d ”, sizeof(c)) ;
printf (“ %d ”, sizeof(d)) ;
}

Choice:
a) 2 2 8 10 b)2 2 2 8
c) 2 2 2 10 d)2 2 2 2

6. int main()
{

int x = 2;
int *p = &x;
scanf ("%d", p); /* say the input is 4 */
printf (“x = %d”, *p + x);
}

Choice:
a) x = garbage b) Error: & is not specified in scanf c) x = 8 d) x = 6

7. int main()
{
int x=15;
printf ("%d, %d, %d \n", x!=15,x=20,x<30);
return 0;
}

Choice :
a) 1,20,1 b)compiler error c)0,20,1 d)1,20,0
8. int main()
{
int i=4,j=-1,k=0,y,z;
y=i+5 && j+1||k+2;
z=i+5 ||j+1 && k+2;
printf("%d,%d \n ",y,z);
return 0;
}

Choice :
a)1,0 b)0,0 c)0,1 d)1,1

9. int main( )
{
int k,num=30:
k=(num>5?(num<=10?100:200):500);
printf("k=%d \n",num);
return 0;
}

Choice:
a) k=30 b) k=200 c) k=500 d) k=100

10. void main ()


{
printf ("%d %d %d", sizeof (2.7), sizeof (2.7f), sizeof (2.7L));
printf ("%d %d %d", sizeof (0), sizeof (0L), sizeof ('0'));
printf ("%d ", sizeof ("hello"));
}

Choice:
a) 8 4 10 2 4 2 6 b) 4 8 10 2 4 2 6 c) 8 4 10 2 4 2 5 d) 8 4 8 2 4 2 5

11. void main( )


{
int const * p=5;
printf("%d",++(*p));
}

Choice:
a) 5 b) compiler error c) Garbage value d) 6
12. main()
{
static int var = 5;
printf("%d ",var--);
if(var)
main();
}

Choice:
a)Compiler Error b)Runtime Error c) 5 4 3 2 1 d) None

13. main()
{
printf("\nab");
printf("\bsi");
printf("\rwa");
}

Choice:
a)absiwa b)wai c) asa d) aswa

14. main()
{ int i=5;
printf("%d%d%d%d%d%d",i++,i--,++i,--i,i);
}

Choice:
a) 45545 b)56655 c) 56544 d) none

15. enum colors {BLACK,BLUE,GREEN}


main()
{
printf("%d..%d..%d",BLACK,BLUE,GREEN);
return(1);
}

Choice:
a) 1..2..3 b)0..1..2 c) 0..4..8 d) 5..4..5

16. main()
{
int i=400,j=300;
printf("%d..%d");
}

Choice:
a) 400..300 b)garbage value c) 300..400 d) compiler error
17. void main()
{
int i=5;
printf("%d",i+++++i);
}

Choice:
a) 14 b)11 c) 12 d) compiler error

18. void show ( )


{
printf ( “In Show.. ” );
}
void main ( )
{
show (10, 20, 30 ) ;
show ( );
show (2, 5);
}

Choice:
a) In show..
b) Error : Too many parameters in 1st and 3rd call
c) Error: Too much space between open close braces
d) In show.. In show.. In show

19.    main()
{
  int a= 0;int b = 20;char x =1;char y =10;
  if(a,b,x,y)
        printf("wiztec");
  }
Choice:
a) wiztec b)nothing is printed c) a,b,x,y d) compiler error

20. int main( )


{
int i=10, j=20;
if(i=5) && if(j=10)
printf(“have a nice day \n”);
return 0;
}

Choice:
a) have a nice day c) no output
b) error ‘expression syntax’ d)error ‘undeclared identifier if’
(Questions from 21-25 tie breakers)

21. Time taken for addition of element in queue is


Choice:
a) O(1) b) O(n) c) O(log n) d) None of these
options

22.To delete a dynamically allocated array named `a`, the correct statement is
Choice:
a) delete a; b) delete a[0]; c) delete []a; d) delete [0]a;

23. which is the inbuilt function for comparing two strings?


Choice:
a) strcomp b) strncmp c) strnicmp d) strcmp

24. Bitwise operators cannot be applied on


Choice:
a)integers b)float c)char d) none

25. What is the difference between "printf(...)" and "sprintf(...)"?


Choice:
a) sprintf(..) writes data to the character array and printf(..) writes data to the standard
output device.
b) No difference.
c) sprintf(..) writes data in colored text.
d) None of above answers is correct.

You might also like