Basic C MCQ

Q1. Who is the father of C language?
  1. Steve Jobs
  2. James Gosling
  3. Dennis Ritchie
  4. Rasmus Lerdorf

Answer:- (c).
Explanations :Dennis Ritchie is the father of C Programming Language. C programming language was developed in 1972 at American Telephone & Telegraph Bell Laboratories of USA.
Q2. Which of the following is not a valid C variable name?
  1. int number;
  2. float rate;
  3. int variable_count;
  4. int $main;

Answer:- (d).
Explanations :Since only underscore and no other special character is allowed in a variable name, it results in an error.
Q3. All keywords in C are in ___________
  1. LowerCase letters
  2. UpperCase letters
  3. CamelCase letters
  4. None of the mentioned

Answer:- (A).
Explanations :None.
Q4. Which of the following is true for variable names in C?
  1. They can contain alphanumeric characters as well as special characters
  2. It is not an error to declare a variable to be one of the keywords(like goto, static)
  3. Variable names cannot start with a digit
  4. Variable can be of any length

Answer:- (C).
Explanations :According to the syntax for C variable name, it cannot start with a digit.
Q5. Which is valid C expression??
  1. int my_num = 100,000;
  2. int my_num = 100000;
  3. int my num = 1000;
  4. int $my_num = 10000;

Answer:- (B).
Explanations :Space, comma and $ cannot be used in a variable name.
Q6. A C structure of User defined datatype is also called_____ ?
  1. volatile
  2. true
  3. Aggregate datatype
  4. All of the above

Answer:- (A).
Explanations :volatile is C keyword.
Q7. What is short int in C programming?
  1. The basic data type of C
  2. Qualifier
  3. Short is the qualifier and int is the basic data type
  4. All of the mentioned

Answer:- (C).
Explanations :None
Q8. Which of the following declaration is not supported by C language?
  1. String str;.
  2. char *str;
  3. float str = 3e2;
  4. Both String str; & float str = 3e2;

Answer:- (A).
Explanations :It is legal in Java, but not in C language.
Q9. Which keyword is used to prevent any changes in the variable within a C program?
  1. immutable
  2. mutable
  3. const
  4. volatile

Answer:- (C).
Explanations :const is a keyword constant in C program.
Q10. What is the result of logical or relational expression in C?
  1. True or False
  2. 0 or 1
  3. 0 if an expression is false and any positive number if an expression is true
  4. None of the mentioned

Answer:- (B).
Explanations :None.