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. Which of the following is true?

"ptr = calloc(m, n)" is equivalent to following
r = malloc(m * n);
"ptr = calloc(m, n)" is equivalent to following
r = malloc(m * n); memset(ptr, 0, m * n);

2. Which of the following gives the memory address of the first element in array foo, an array with 10 elements?

foo
&foo
foo[0]
&foo[0]

3. 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

4. What is the output of this program?

#include <stdio.h>
int main(){
    struct leader
	{
	char *lead;
	int born;
	};
	struct leader l1 = {"AbdulKalam", 1931};
	struct leader l2 = l1;
	printf("%s %d", l2.lead, l1.born);
}

Compilation error
Garbage value 1931
AbdulKalam 1931
None of the above

5. Which loop is guaranteed to execute at least one time.

for
while
do while
None of the above

6. A compiler is

a machine-independent and OS-independent
machine-dependent and OS-dependent
machine-dependent and OS-independent
machine-independent and OS-dependent

7. What type of array is generally generated in Command-line argument?

Single dimension array
2-Dimensional Square Array
Jagged Array
2-Dimensional Rectangular Array

8. What is the output of this program?

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

Syntax error in declaration of a
No errors, program will show the output 5
Redeclaration of a in same scope throws error
a is out of scope when printf is called

9. What is the output of this program?

#include <stdio.h>
int main()
{
    int x = 1, y = 2;
    printf("%*d", x, y);
    return 0;
}

1
2
Compilation Error
Garbage Value

10. A function fun is called __________ if it calls the same function fun.

indirect recursive
direct recursive
Both A and B
None of the above

Results