Loading...

C Multiple Choice Questions

Our C questions and answers focuses on all areas of C programming language covering 100+ topics in C

C Variables and Datatypes-1 MCQs

C Variables and Datatypes-1


1. How many keywords are there in C Language ?

a) 30
b) 22
c) 32
d) 36



2. Which of the following cannot be a variable name in C?

a) volatile
b) area
c) mega
d) number



3. Identify wrong C keyword below

a) auto, double, int, struct
b) break, else, long, switch
c) case, enum, register, typedef
d) char, extern, intern, return



4. What is the output of this program?
#include <stdio.h>

int main() {
  int x = 10;
  float x = 10.0;
  printf("%d",x);
  return 0;
}

a) 10.1
b) Compilations Error
c) 10
d) 10



5. Find a correct C Keyword below.

a) breaker
b) default
c) shorter
d) go to



6. Find a correct C Keyword below.

a) work
b) permanent
c) constant
d) case



7. Comment on the output of this C code?

a) The compiler will flag an error
b) Program will compile and print the output 5
c) Program will compile and print the ASCII value of 5
d) Program will compile and print FAIL for 5 times



8. Which of the following is true for variable names in C?

a) Variable names cannot start with a digit
d) Variable can be of any length
b) They can contain alphanumeric characters as well as special characters
c) Reserved Word can be used as variable name



9. 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);
  return 0;
}

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



10. What is the output of this program?
#include <stdio.h>

int main() {
  int p, q, r, s;
  p = 1;
  q = 2;
  r = p, q;
  s = (p, q);
  printf("p = %d q = %d",p ,q);
  return 0;
}

a) p=1 q=1
b) p=1 q=2
c) p=2 q=2
d) Invalid Syntax



- Related Topics