C Programming Multiple Choice Question - Variables And Datatypes
This section focuses on the "Variables And Datatypes" of the C programming. These Multiple Choice Questions (mcq) should be practiced to improve the C programming skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.
1. How many keywords are there in c ?
Explanation: There are total 32 keywords in C.
Keywords are those words whose meaning is already defined by Compiler.C Keywords are also called as Reserved words.
2. Which of the following is true for variable names in C?
Explanation: Variable names cannot start with a digit in C Programming language.
3. Which of the following cannot be a variable name in C?
Expanation: volatile is C keyword.Volatile in C programming language signify that the compiler that the software in hand (the thread for the routine it’s compiling) doesn’t have exclusive control over the variable described as “volatile”.
4. What is the output of this program?
int x = 10;
float x = 10;
Explanation: Since the variable x is defined both as integer and as float, it results in an error.
5. What is the output of this program?
for (i = 0;i < 5; i++)
int a = i;
Explanation: the output of this program is the Syntax error in declaration of variable a.
6. What is the output of this program?
int var = 20;
int var = var;
printf("%d ", var);
Explanation: First var is declared, then value is assigned to it. As soon as var is declared as a local variable, it hides the global variable var.
Also check :