Variables
- Which of the following is not a valid variable name declaration?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
#define PI 3.14 is a macro preprocessor, it is a textual substitution.
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
int p = 200;
int p = 17;
printf("Hello Interview Mania! %d\n", p);
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Since p is already defined, redefining it results in an error.
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
printf("Hello Interview Mania! %d \n", num);
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
It results in an error since num is used without declaring the variable num.
- Which is valid C expression?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
Space, comma and $ cannot be used in a variable name.
- Which of the following is true for variable names in C?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
According to the syntax for C variable name, it cannot start with a digit.