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 will be output for the following code?

#include <stdio.h>
int main(int argc, char *argv[])
{
    while (*argv  !=  NULL)
        printf(""%s
"", *(argv++));
    return 0;
}

./a.out
Segmentation fault/code crash
Depends on the platform
Depends on the compiler

2. What will be output for the folowing code?

2 1
0 0
3 2
Compilation error

3. What will be output for the following code?

#include<stdio.h> 
int main() 
{ 
    int x = 10;    
    char y = 'a'; 
    x = x + y; 
     
    float z = x + 1.0; 
  
    printf(""x = %d, z = %f"", x, z); 
    return 0; 
} 

x = 107, z = 108.00
x = 107, z = 108.0000
x = 107, z = 108.000000
x = 108, z = 108.000000

4. Switch statement accepts.

int
char
long
All of the above

5. Iteration requires more system memory than recursion.

TRUE
FALSE
Can be true or false
Can not Say

6. Which statment is true about the given code ?

#include <stdio.h>
#include  <stdlib.h>
int main()
{
    int *a[5];
    a = (int*) malloc(sizeof(int)*5);
    free(a);
    return 0;
}

Error: unable to allocate memory
Error: We cannot store address of allocated memory in a
Error: unable to free memory
No error

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

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

12
8
10
9

8. What is the output of this program?

void main()
{
   printf("%x",-1<<4);
}

fff0
fff1
fff2
fff3

9. Which of the following true about FILE *fp

FILE is a keyword in C for representing files and fp is a variable of FILE type.
FILE is a stream
FILE is a buffered stream
FILE is a structure and fp is a pointer to the structure of FILE type

10. What is the output of this program ?

#include <stdio.h>
int main()
{
  char *ptr = "Hello World";
  printf(ptr+2);
   return 0;
} 

pointer cannot be initialized
lo World
Runtime error
llo World

Results