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 main()
{
    int x = 1, y = 2;
    printf("%*d", x, y);
    return 0;
}

1
2
Compilation Error
Garbage Value

2. What is the output of this program?

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

Compilation error
Some Garbage value
0
Nothing prints

3. While calling the fprintf() function in the format string conversion specifier %s can be used to write a character string in capital letters.

TRUE
FALSE
May Be
Can't Say

4. Number of bytes in memory taken by the below structure is

#include <stdio.h>
struct test
{
  int k;
  char c;
};

Multiple of integer size
Integer size+character size
Depends on the platform
Multiple of word size

5. Macros with arguments are not allowed.

TRUE
May Be
FALSE
Can't Say

6. After preprocessing when the program is sent for compilation the macros are removed from the expanded source code.

TRUE
FALSE
Can be true or false
Can't Say

7. What will be the output of the following C code?

#include <stdio.h>
typedef struct student
    {
        char *a;
    }stu;
    void main()
    {
        struct student s;
        s.a = ""hey"";
        printf(""%s"", s.a);
    }

Compile time error
varies
he
hey

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

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

9. Which of the following is true about pow?

rounds down the given number
rounds up the given number
returns the power of given number
returns the absolute value of given number

10. What is the output of this program?

#include <stdio.h>
int main()
{
    int main = 3;
    printf("%d", main);
    return 0;
}

3
Compile time error
Run time error
give garbage value

Results