01

(Multiple Choice) The basic data types in C language include
A) Integer
B) Floating-point
C) Logical
D) Character

Answer: ABD
Analysis:
For option C: Logical type is not a basic data type in C language. In standard C (C89/C90), there is no native boolean type, which is usually replaced by int (0 represents false, non-0 represents true).
02

(Multiple Choice) The following definition of a one-dimensional integer array y isincorrect:
A) int y(10);
B) int k=10,y[k];
C) int y;
D) #define SIZE 8
int y[SIZE];

Answer: ABC
Analysis:
For option A: Incorrect, in C language, array definitions should use square brackets [] instead of parentheses (). This is a syntax error.
For option B: Incorrect, in standard C (C89/C90), the array length must be a constant expression, not a variable. Although C99 supports variable-length arrays (VLA), the question does not specify the version, so it defaults to traditional C language judgment.
For option C: Incorrect, this only defines an integer variable y, not an array.
For option D: Correct, using the macro definition constant SIZE as the array length conforms to C language syntax, and this method is generally adopted.
03 (Common Mistake)

(Multiple Choice) If defined: int a[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, *p = a, i; where 0 ≤ i ≤ 9, the correct references to the elements of array a are
A) a[p-a]
B) *(&a[i])
C) p[i]
D) a[10]

Answer: ABC
Analysis:
For option C: Correct, p is a pointer to a, p[i] is equivalent to a[i] (pointer array access method);

For option D: Incorrect, the valid index of array a is 0 to 9, a[10] is an out-of-bounds access, and the behavior is undefined;
04

(Multiple Choice) If a, b, c, and d are all int type variables initialized to 0, the following assignment statements arecorrect:
A) a = b = c = 100;
B) 10 = d;
C) c += b;
D) d = (c = 22) – (b++);

Answer: ACD
Analysis:
For option B: In C language, the left side of the assignment operator = must be a modifiable lvalue (variable or memory address), while 10 is a constant and cannot be assigned.
05

(Multiple Choice) Given the definition: char p[] = {‘1’, ‘2’, ‘3’}, *q = p; the followingcancalculate the number of bytes occupied by a char type data:
A) sizeof(p)
B) sizeof(char)
C) sizeof(*q)
D) sizeof(p[0])

Answer: BCD
Analysis:
For option A: It calculates the byte size of the entire array p (p contains 3 char elements, resulting in 3), not the size of a single char.
06

(Multiple Choice) Among the following options, the valid C languagekeywords are
A) VAR
B) char
C) integer
D) default

Answer: BD
Analysis: N/A
[Variant Question] Among the following options, the valid C languageidentifiers are
A) VAR
B) char
C) integer
D) default
Answer: AC
07

(Multiple Choice) If variables x and y are correctly defined and assigned, the followingincorrect expressions are
A) ++x, y = x–;
B) x + 1 = y;
C) x = x + 10 = x + y;
D) double(x) / 10;

Answer: BCD
Analysis:
For option B: Incorrect, the left side of the assignment statement must be a variable (lvalue), x + 1 is an expression and cannot be assigned.
For option C: Incorrect, in consecutive assignments, x + 10 is an expression, not a variable, and cannot receive the value of x + y.
For option D: C language does not support functional type conversion (like double(x)), the correct C language type conversion should use explicit type conversion: (double)x / 10.
In C language, explicit type conversion uses the form (type)value:
08

(Multiple Choice) Among the following definition statements, theincorrect one is
A) int a = b = 0;
B) char A = 65 + 1, b = ‘b’;
C) float a = 1, *b = &a, *c = &b;
D) double a = 0.0; b = 1.1;

Answer: ACD
Analysis:
For option A: Incorrect, variable b is used directly without being defined.
For option C: Incorrect, the syntax is confused, trying to assign a string address to a floating-point variable.
For option D: Incorrect, b is not declared with a type. If it is a global variable, it needs to be defined separately; if it is a local variable, it needs to specify a type.
09 (Common Mistake)

(Multiple Choice) Given ch as a character variable, the following assignment statements arecorrect:
A) ch = ‘\’;
B) ch = 62 + 3;
C) ch = NULL;
D) ch = ‘\xaa’;

Answer: BCD
Analysis:

10 (Common Mistake)

(Multiple Choice) Among the following options, thecorrect assignment expressions are
A) (a + b)++
B) n1 = (n2 = (n3 = 0))
C) k = i = j
D) a = b + c = 1

Answer: BC
Analysis:
For option A: Incorrect, the increment operation ++ can only be used on variables (lvalues), while a + b is a temporary expression result and cannot be incremented.
For option D: Incorrect, b + c is an expression and cannot be used as an assignment target (similar to a = 1 = 1, which is an invalid operation).