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. How will you free the memory allocated by the following program?

#include <stdio.h>
#include  <stdlib.h>
#define MAXROW 2
#define MAXCOL 3
int main()
{
    int **p, i, j;
    p = (int **) malloc(MAXROW * sizeof(int*));
    return 0;
}

memfree(int p);
dealloc(p);
malloc(p, 0);
free(p);

2. What is the output of this program?

#include <stdio.h>
#include  <stdlib.h>
int main()
{
  int *p;
  p = (int *)malloc(40);
  printf("%d", sizeof(p));
  free(p);
  return 0;
}

40
50
30
20

3. The information about an array used in program will be stored in

Symbol Table
Activation Record
Dope Vector
Both A and B

4. The following line in a program # represents

an invalid code
a null directive
a comment
a page number

5. What is the output of this program?

#include <stdio.h>
int test() 
{
  static int n = 10;
  return n--;
}
 
int main()
{
  for(test(); test(); test())
    printf("%d ", test());
  return 0;
}

7 4 1
8 5 2
Infinite loop
Compilation Error

6. What is the correct syntax to declare a function foo() which receives an array of structure in function?

void foo(struct *var);
void foo(struct *var[]);
void foo(struct var);
none of the mentioned

7. What will be the size of the following structure?

		   
struct demo{
  int a;
  char b;
  float c;
}

12
8
10
9

8. 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);

9. Which of the following is correct Associativity for == operator?

Left to right
Right to left
Left to left
Right to right

10. What is the output of this program?

#include <stdio.h>
#include  <stdlib.h>
int main()
{
  int i, numbers[1];
  numbers[0] = 15;
  free(numbers);
  printf("Stored integers are ");
  printf("numbers[%d] = %d ", 0, numbers[0]);
  return 0;
}

15
Compilation error
0
garbage value

Results