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. The first and second arguments of fopen() are

A character string containing the name of the file & the second argument is the mode
A character string containing the name of the user & the second argument is the mode
A character string containing file pointer & the second argument is the mode
None of the mentioned

2. Which Committee standardize C Programming Language ?

IEEE
ISO
IEC
ANSI

3. What is the correct syntax of enum?

enum flag{constant1, constant2, constant3, ....... };
enum flag(constant1, constant2, constant3, ....... );
enum flag[constant1, constant2, constant3, ....... ];
enumflag{constant1, constant2, constant3, ....... };

4. Which statment is true about the given code ?

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

Goes in infinite loop
Gives Address of function main.
Gives garbage value
Compilation Error

5. What is the output of this program?

#include <stdio.h>
#include  <stdlib.h>
int main()
{
  struct test
  {
    int i;
    float f;
    char c;
  };
  struct test *ptr;
  ptr = (struct test *)malloc(sizeof(struct test));
  ptr ->f = 2.5f;
  printf("%f", ptr->f);
  return 0;
}

Compilation error
2.5
Garbage value
0

6. What is the output of this program?

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

-5 to -1
-5 to 0
-5 to infinity
Compilation Error

7. Which of the following is an incorrect syntax to pass by reference a member of a structure in a function?

(Assume: struct temp{int a;}s;)

func(&s.a);
func(&(s).a);
func(&(s.a));
None of the above

8. _______________ is a synchronization primitive used to prevent multiple threads from accessing a shared resource simultaneously.

mutex
semaphore
deadlock
race

9. What is the output of this program?

#include <stdio.h>
int main()
{
    int a[1]={100};
    printf("%d", 0[a]);
    return 0;
}

100
0
Garbage Value
Compilation Error

10. What is the Error of this program?

#include <stdio.h>
#include  <stdlib.h>
int main()

{
     char *ptr;
     *ptr = (char)malloc(30);
     strcpy(ptr, "RAM");
     printf("%s", ptr);
     free(ptr);
     return 0;
}

Error: in strcpy() statement.
Error: in *ptr = (char)malloc(30);
Error: in free(ptr);
No error

Results