C Miscellaneous MCQs

70 questionsC-ProgramPage 3 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 19hard
Determine Output:
void main()
{
      char *p;
      p="Hello";
      printf("%c", *&*p);
}
Question 20hard
Determine Output:
void main()
{
      int i=1;
      while(i<=5)
      {
            printf("%d", i);
            if(i>2)
                  goto here;
            i++;
      }
}
fun()
{
      here:  printf("PP");
}
Question 21hard
Determine Output:
void main()
{
      int i=1, j=2;
      switch(i)
      {
            case 1: printf("GOOD"); break;
            case j: printf("BAD"); break;
      }
}
Advertisement
Question 22hard
Determine Output:
void main()
{
      int i;
      printf("%d", scanf("%d", &i)); // value 10 is given as input here
}
Question 23hard
Determine Output:
void main()
{
      int i=0;
      for(;i++;printf("%d", i));
      printf("%d", i);
}
Question 24hard
Determine Output:
void main()
{
      struct xx
      {
            int x=3;
            char name[] = "hello";
      };
      struct xx *s = malloc(sizeof(struct xx));
      printf("%d", s->x);
      printf("%s", s->name); 
}
Advertisement
Question 25hard
Determine output:
void main()
{
      extern int i;
      i=20;
      printf("%d", sizeof(i));
}
Question 26hard
Determine Output:
void main()
{
      int i=0, j=0;
      if(i && j++)
            printf("%d..%d", i++, j);
      printf("%d..%d", i, j);
}
Question 27hard
Determine Output:
void main()
{
      static int i=5;
      if(--i){
            main();
            printf("%d ", i);
      }
}