01

Among the following statements, the correct one is ( )
A) C language programs always start executing from the first function
B) In a C language program, a function to be called must be defined within the main() function
C) C language programs always start executing from the main() function
D) The main() function in a C language program must be placed at the beginning of the program

Answer: C
For option A: C programs always start executing from the main() function
For option B: The called function can be defined outside the main() function
For option D: The position of the main() function does not have to be at the beginning of the program; it can be determined by the user based on actual circumstances. The main() function is the entry point of the program
02

Among the following options, the one that is not a C statement is ( ).
A) {int i; i++; printf(“%d\n”,i);}
B) ;
C) a=5,c=10
D) { ; }

Answer: C
For option A: A compound statement
For option B: This statement consists only of a single semicolon, which is a valid C statement, typically used as a placeholder or when the loop body is empty.
For option C: C statements must end with a semicolon, which is missing here.
For option D: A compound statement, with the outer layer being {}, and the inner layer consisting of a single semicolon, which is an empty statement.
03

Among the following options, the one that cannot be a valid constant in C language is
( )
A) ‘cd’
B) 0.1e+6
C) “\a”
D) ‘\011’

Answer: A
For option A: Characters enclosed in single quotes ” are character constants, so ‘cd’ is incorrect
For option B: A real number (numeric constant), represented in scientific notation
For option C: A string constant
For option D: Escape character constant, representing the ASCII character corresponding to the octal number 011. In C, the end of a string is marked by ‘\0’
Note: In C language, the end of a string is marked by ‘\0’
04

If x, a, and b are all int type variables, then the result of executing the expression x=(a=1,b=2) is ( ).
A) 1
B) 2
C) 3
D) Uncertain

Answer: B
The precedence of the assignment operator is higher than that of the comma operator, so x=(a=1,b=2) is equivalent to x=((a=1),(b=2)), and the final result of x is 2
In C language, the characteristics of the comma operator are: 1. Evaluates from left to right
2. The return value is the value of the rightmost expression, meaning the value of the entire comma expression is the value of the last expression
05

The following can correctly define integer variables a, b, and c and initialize them to 1 is ( ).
A) int a=b=c=1;
B) int a,b,c=1;
C) a=b=c=1;
D) int a=1,b=1,c=1;

Answer:
For option A: When defining variables, you cannot directly use undefined variables (like b, c here) to initialize other variables (like a here)
For option B: Three integer variables a, b, and c are defined, but only c is initialized to 1, while a and b are uninitialized, so their values are unknown.
For option C: The type of the defined variables is not specified; this lacks the int declaration. The format for defining variables is: type name; It is best to initialize variables when defining them to develop good programming habits.
For option D: Correct
C language allows declaring and initializing multiple variables in one statement, but each variable must be explicitly assigned an initial value. Chained initialization is not allowed in C language; you cannot initialize undefined variables through chained assignment (like a = b = c = 1).
However, if you declare the variables first and then assign them in a chain, it is legal.
Example 1:
int a = 1, b = 1, c = 1;
// Correctly defined and all initialized to 1
Example 2:
int a = b = c = 1;
// Compilation error! b and c are undefined
Example 3:
int a, b, c;
a = b = c = 1;
// Legal: defined first, then assigned