C Programming Quiz


Play this C quiz that will help you to excel in C certification exams, placements etc. This C programming quiz consist of 10 questions that you need to solve in 10 minutes. We’ve specially designed this quiz so that you can quickly acquaint to the pattern of questions you can be asked in placement drives, certification exams etc. This C programming test enables you to assess your knowledge of C programming.

Take the Free Practice Test



C MCQs

Practice C MCQ Questions, which will help you in understanding programming concepts and also helps you to prepare for placements, technical rounds, interviews, competitive exams etc.

C Quiz

Try Free C Quiz, to start a quiz you need to login first, after login you will get start quiz button and then by clicking on that you can start quiz. You will get 10 Minutes to answer all questions.

C Quiz

1. What is the output of this program?

		   
#include <stdio.h>
int demo()
{
  static int i = 0;  
  printf("%d ",i++);
}
int main()
{
  for(int j = 0 ; j < 5 ; j++ )
  {
      demo();
  }
}

0 0 0 0 0
1 1 1 1 1
1 2 3 4 5
0 1 2 3 4

2. What is the output of this program ?

#include <stdio.h>
static struct student
{
  int a;
  int b;
}
  struct_var{2,3};
int main()
{
  printf("%d %d",struct_var.a,struct_var.b);
  return 0;
}

Runtime Error
Improper representation of structure variable
Compilation error
2 3

3. What will be output when you will execute following c code?

#include <stdio.h>
int main()
{
 
    int a=2;
    switch(a,a+1)
    {
        case 2:
            printf("You are in b ");
            break;
        case 3:
            printf("You are in c ");
            break;
        default:
            printf("You are in default");
    }
    return 0;
}

You are in b
You are in c
You are in default
Compilation Error

4. What is the output of this program ?

#include <stdio.h>
int main()
{
  char *ptr = "Hello World";
  printf(ptr+2);
   return 0;
} 

pointer cannot be initialized
lo World
Runtime error
llo World

5. What is the output of this program 32 bit c compiler ?

int main()
{
     printf("%%%%");
    return 0;
}

%%%%%
%%
No output
Error

6. What is the output of this program?

int main()
{
   printf("%c", ~('C'*-1));
   return 0;
}

A
B
C
D

7. how many storage classes in c?

2
3
4
5

8. __________ statements are processed by the pre-processor.

#def
typedef
type
#define

9. We should not read after a write to a file without an intervening call to fflush(), fseek() or rewind()

TRUE
FALSE
May Be
Can't Say

10. Let x be an array.Which of the following operations is illegal?
i) ++x.
ii) x+1.
iii) x++.
iv) x*2.

I and II
I, III and IV
III and IV
II and III

Results