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>
#include  <stdlib.h>
int main()
{
   int *numbers = (int*)calloc(4, sizeof(int));
   numbers[0] = 2;
   free(numbers);
   printf("Stored integers are ");
   printf("numbers[%d] = %d ", 0, numbers[0]);
   return 0;
}

Garbage value
2
0
Compilation error

2. Which statment is true about the given code ?

#include <stdio.h>
enum colors {lets,find,course};
int main()
{
  printf("%d %d %d",course,lets,find);
  return 0;
}

3 1 2
0 1 2
2 0 1
1 0 2

3. Which type of conversion is NOT accepted?

From char to int
From float to char pointer
From negative int to char
From double to char

4. which of the following is not a storage class specifier?

auto
register
extern
volatile

5. What is the output of this program ?

int main()
{
    char *p;
    p="%d";
    p++;
    p++;
    printf(p-2, 13);
    return 0;
}

11
13
Error
No output

6. What is the output of this program?

#include <stdio.h>
#include  <stdlib.h>
int main()
{
  int i;
  char *ptr;
  char *fun();
  ptr = fun();
  printf(" %s", ptr);
  return 0;
}

char *fun()
{
  char disk[30];
  strcpy(disk, "letsfindcourse");
  printf("%s ",disk);
  return disk;
}

letsfindcourse
Compilation error
letsfindcourse letsfindcourse
garbage value

7. The number of distinct nodes the following struct declaration can point to is

struct node
{
   struct node *left;
   struct node *centre;
   struct node *right;
};

1
2
3
All of the above

8. Comment on this const int *ptr;

You cannot change the value pointed by ptr
You cannot change the pointer ptr itself
Both (a) and (b)
You can change the pointer as well as the value pointed by it

9. Which of the following are correctly formed #define statements?

#define INCH PER FEET 12
#define SQR(X) (X *X);
#define SQR(X) X*X
#define SQR(X) (X*X)

10. Which of the following statement is correct prototype of the malloc() function in c ?

int* malloc(int);
Char* malloc(char);
unsigned int* malloc(unsigned int);
void* malloc(size_t);

Results