C Miscellaneous MCQs

70 questionsC-ProgramPage 5 of 8

Practice free C Miscellaneous multiple-choice questions with instant answer feedback and step-by-step solutions. Click an option to check yourself, reveal the full explanation, and work through all 70 questions — no login required.

Question 37hard
Determine Output:
void main()
{
      int i=i++, j=j++, k=k++;
      printf("%d %d %d", i, j, k);
}
Question 38medium
Determine Output:
void main()
{
      static int i=i++, j=j++,  k=k++;
      printf("%d %d %d", i, j, k);
}
Question 39easy
Determine Output:
#define prod(a,b)  a*b
void main()
{
      int x=3, y=4;
      printf("%d", prod(x+2, y-1));
}
Advertisement
Question 40hard
Determine Output:
void main()
{
      char p[]="%dn";
      p[1] = 'c';
      printf(p, 65);
}
Question 41hard
Determine Output:
void main()
{
      char *p;
      p="%d\n";
      p++;
      p++;
      printf(p-2, 300);
}
Question 42hard
Determine Output:
void main()
{
      int c[] = {2.8,3.4,4,6.7,5};
      int j, *p=c, *q=c;
      for(j=0;j<5;j++){
            printf(" %d ", *c);
            ++q;
      }
      for(j=0;j<5;j++){
            printf(" %d ", *p);
            ++p;
      }
}
Advertisement
Question 43hard
Determine Output:
void main()
{
      int a[] = {10,20,30,40,50}, j, *p;
      for(j=0; j<5; j++){
            printf("%d" ,*a);
            a++;
      }
      p = a;
      for(j=0; j<5; j++){
            printf("%d" ,*p); 
            p++;
      }
}
Question 44hard
Determine Output:
#include<stdio.h>
void main()
{
      char s[]={'a','b','c','n','c','\0'}; 
      char *p, *str, *str1; 
      p=&s[3]; 
      str=p;
      str1=s;
      printf("%c", ++*p + ++*str1-32);
}
Question 45hard
Determine Output:
void main()
{
      static char *s[] = {"black", "white", "yellow", "violet"};
      char **ptr[] = {s+3, s+2, s+1, s}, ***p;
      p = ptr;
      ++p; 
      printf("%s",*--*++p + 3); 
}