This is a recorded twitter quiz.
@ajlopez, won this quiz. More Details about this quiz
-
Question1:
In C statement,
int _new_var;
The variable name is not valid and it results in a compilation error.
a)True or b)False?Answer: b)False
In C language, variable names can start with _(underscore) or a letter but not a number. Library routines are usually named with _(underscore) as first letter, so it is generally not recommended to start a variable name with underscore. -
Question2:
In C, variable name hello is same as HELLO.
a)True or b)False?Answer: b)False
C language is case sensitive, so variable name ‘hello’ is not same as ‘Hello’ or ‘HELLO’. -
Question3: Mathematically,
sizeof(short) <= sizeof(int) <= sizeof(long)
a)True or b)False ?Answer: a)True
In C, there is a restriction to the compiler that shorts and ints are at least 16 bits, longs are at least 32 bits. And short is no longer than int, which is no longer than long. Read more -
Question4: C statement,
#define MAX 500
is evaluated in
a)compile time or b)run time ?Answer: a)compile time.
#define is called a pre-processor directive, which means that even before compilation, it gets evaluated and replacement text 500 is replaced with MAX. Read more -
Question5:
In C, ‘x’ is same as “x”.
a)True or b)False ?Answer: b)False
In C, ‘x’ is a character constant, whereas “x” is a string literal. “x” can be thought of as an array containing characters ‘x’ and ‘\0′ . -
Question6: In C, default value of a static variable is
a)0 or b)garbage value?Answer: a)0
In C, static variables and external variables are initialized to 0 by default. Read more -
Question7:
In C, modulus operator(%) can be applied to float variables.
a)True or b)False?Answer: b)False
In C, modulus operator can only be applied to char or int data types. It can’t be applied to float or double. -
Question8:
The C statement,
enum number{ ONE=1, UNO=1 };
fails compilation as the enum values are not distinct.
a)True or b)False ?Answer: b)False
In enum, values need not be distinct. But names in enum need to be distinct. Read more about enum -
Question9:
In C, * (multiplication operator) has higher precedence than + or – operators.
a)True or b)False?Answer: a)True
The operators + and – have the same precedence, which is lower than that of *, /, % Read more about precedence of operators in C -
Question10:
The default value of an automatic variable in C is
a)0 or b)garbage value?Answer: b)garbage value
Automatic variables are also called local variables. Their default value is always garbage value. Read more.
