Match the following : Codes :List – I List – II a. associativity i. memory storage b. # define ii. if-then-else c. auto iii. operators with equal precedence d. conditional operator iv. define operator
a-iii, b-iv, c-i, d-ii
Each item is a distinct piece of C vocabulary: a-iii, b-iv, c-i, d-ii — option 2.
| Item | Match | What it is |
|---|---|---|
| a. Associativity | iii. Operators with equal precedence | Decides grouping when precedence ties |
| b. #define | iv. Define operator | Preprocessor directive |
| c. auto | i. Memory storage | A storage class specifier |
| d. Conditional operator | ii. if-then-else | The ternary ?: |
a — precedence against associativity. These are two different rules and the distinction is what the question tests. Precedence decides which of two different operators binds first: in a + b * c the multiplication wins. Associativity applies only when the operators have equal precedence, and decides the direction of grouping. Most binary operators associate left to right, so a - b - c means (a - b) - c — which matters, since the other grouping gives a different answer. Assignment associates right to left, which is exactly what makes a = b = c work.
b — the preprocessor. #define is handled before compilation proper begins: the preprocessor performs textual substitution wherever the name appears, whether for a constant (#define PI 3.14159) or a macro with arguments (#define SQ(x) ((x)*(x))). Because it is pure text replacement, the parentheses in that macro are not decoration — without them SQ(a+b) would expand to a+b*a+b.
c — storage class. C's four storage classes — auto, register, static, extern — specify where a variable lives, how long it lives and who can see it. auto means automatic storage on the stack, created on entry to a block and destroyed on exit. It is the default for local variables, so the keyword is almost never written; its presence in the language is largely historical.
d — the ternary operator. condition ? expr1 : expr2 is the only operator in C taking three operands, and it is an expression rather than a statement — the crucial difference from if-else. Because it yields a value it can be used where a statement cannot: max = (a > b) ? a : b; or inside a function argument.
Hence, the correct code is a-iii, b-iv, c-i, d-ii.
The function "isalnum( )" returns a non-zero value if the character is alphanumeric and zero otherwise. What is header file to be used in the main program ?
To read a integer variable, find the correct format given below :
Int m;
Find the correct list, which is the reverse (at all levels) of the given list :
[[4, 7, 8], 2, 9, [19, 6], 20, 3]
(i) 3, 20
(ii) 9, 2
(iii) [6, 19]
(iv) [8, 7, 4]
Which of the following is not an infinite loop ?
(A) int i = 1;
while (1)
{
i++ ;
}
(B) for ( ; ; ) ;
(C) int t = 0, f ;
while (t)
{
f = 1;
}
(D) int y, x = 0 ;
do
{
y = x;
}
while (x == 0);
The three types of loops available in C language are
i. for
ii. while
iii. do-while
Which loops do not operate without testing the condition even once ?
Assertion (A) : 'C' uses many data types such as integers (short and long) and float etc.
Reason (R) : Conversion specifier used for short unsigned integer is % lu.
Which bitwise operator is suitable for turning off a particular bit in a number ?
Which storage class is used for the variables that are often required in a program ?
Which is not a proper way of array declaration ?
Exponentiation operation in C is carried out as
Which of the following is NOT a state function or state variable in a thermodynamic system?