I. multiple choice questions
1. If there are the following instructions and statements, and 0 <= I <10, the error reference to the array element is (C ).
Int a [] = {1, 2, 4, 5, 6, 7, 8, 9, 0}, * p, I;
P =;
(A) * (a + I) (B) a [p-a] (C) p + I (D) * (& a [I])
2. If there are the following instructions and statements, and 0 <= I <10, it is not a correct representation of the array element address (B ).
Int a [] = {1, 2, 4, 5, 6, 7, 8, 9, 0}, * p, I;
P =;
(A) & (a + 1) (B) a ++ (C) & p (D) & p [I]
3. The following program contains errors (the number in front of each program indicates the row number) ().
1 # include <stdio. h>
2 int main ()
3 {
4 float a [3] ={ 0.0 };
5 int I;
6 for (I = 0; I <3; I ++) scanf ("% f", & a [I]);
7 for (I = 1; I <3; I ++) a [0] = a [0] + a [I];
8 printf ("% f", a [0]);
9}
(A) No (B) 4th rows (C) 7th rows (D) 8th rows
4. In the following description, the identifier prt (C ).
Int (* prt) [3];
(A) The description is invalid.
(B) is a pointer array name. Each element is a pointer to an integer variable.
(C) is a pointer pointing to a one-dimensional array with three elements
(D) is a pointer to an integer variable.
5. The following description is equivalent to the description in (C.
Int * p [4];
(A) int p [4] (B) int * p (C) int * (p [4]) (D) int (* p) [4]
6. If there is a description: int a [4] [10]; then the array element a [I] [j] (0 ≤ I <4, 0 ≤ j <10) the error reference is (B ).
(A) * (& a [0] [0] + 10 * I + j) (B) * (a + I) [j] (c) * (a + I) + j) (D) * (a [I] + j)
7. The incorrect string assignment or initial value assignment method is (C ).
(A) char * str; str = "string"; (B) char str [7] = {s, t, r, I, n, g };
(C) char strl [10]; strl = "string"; (D) char strl [] = "string", str2 [] = "12345678 ";
Strcpy (str2, strl );
8. If the following descriptions are provided, which of the following statements is not correct for strcpy library functions? (BCD) (multiple choice ).
Char * strl = "copy", str2 [10], * str3 = "hijklmn", * str4, * str5 = "abcd ";
(A) strcpy (str2, strl); (B) strcpy (str3, strl );
(C) strcpy (str4, strl); (D) strcpy (str5, strl );
9. If the following descriptions are provided, the characters in the string are correctly referenced (ABC ). (Multiple options)
0 ≤ I <6.
Char * strp = "string ";
(A) * strp (B) * (strp + I) (C) strp [I] (D) strp
10. If there are statements int * point, a = 4; and point = & a; the following are a set of options for the address: (D ).
(A) a, point, * & a (B) & * a, & a, * point
(C) * & point, * point, & a (D) & a, & * point, point
Ii. Read the running results of the program analysis program
11. The output result of the following program is (D ).
Int main ()
{
Int a [] = {1, 2, 4, 5, 6}, * p;
P = a; * (p + 3) + = 2;
Printf ("% d, % d", * p, * (p + 3 ));
}
(A) (B) l, 5 (C) (D)
12. The output result of the following program is (D ).
Int main ()
{
Int a [12] = {1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12}, * p [4], I;
For (I = 0; I <4; I ++) p [I] = & a [I * 3];
Printf ("% d", p [3] [2]);
}
(A) the output item is invalid because the output result is not (B) 6 (C) 8 (D) 12
13. The output result of the following program is ().
Char * alpha [6] = {"ABCD", "EFGH", "IJKL", "MNOP", "QRST", "UVWX "};
Char ** p;
Int main ()
{
Int I;
P = alpha;
For (I = 0; I <4; I ++) printf ("% c", * (p [I]);
Printf ("");
}
(A) AEIM (B) BFJN (C) ABCD (D) DHLP
3. Fill in the blanks for the read Program
14. The following program can find the maximum value in the array and the subscript of this element. The value of the array element is input by the keyboard. Select the correct option from the corresponding set of options.
Int main ()
{
Int a [10], * p, * s, I;
Printf ("Enter a [0] a [1]… A [9l :");
For (I = 0; I <10; I ++)
Scanf ("% d", C );
For (p = a, s = a; A <10; p ++)
If (* p> * s) s =;
Printf ("max = % d, index = % d", C, C );
}
(1) (A) * (a + I) (B) p + I (C) a + I (D) a [I]
(2) (A) p-a (B) s-a (C) a-p (D) a-s
(3) (A) p (B) a [p] (C) a [s] (D) a-p
(4) (A) a [p-a] (B) a [p] (C) * s (D) a [s]
(5) (A) p-a (B) p (C) s-a (D) a-s
15. The following program can output the big one in two integers. The two integers are input by the keyboard. Select the correct option from the corresponding set of options.
Int main ()
{
Int a, B, * pl, * p2;
Pl = D malloc (sizeof (int); p2 = D malloc (sizeof (int ));
Printf ("Enter pl p2 :");
Scanf ("% d", B );
If (* p2> * pl) * pl = * p2;
Free (p2 );
Printf ("max = % d", );
}
(L) (A) int (B) int * (C) (int) (D) (int *)
(2) (A) * p1, * p2 (B) pl, p2 (C) & p1, & p2 (D) & a, & B
(3) (A) * p1 (B) * p2 (C) p1 (D) p2
4. Read the program to answer questions
16. The output of the following program is (6 ).
Int main ()
{
Int a [] = {2, 4, 6}, * ptr = & a [0], x = 8, y, z;
For (y = 0; y <3; y ++)
Z = (* (ptr + y) <x )? * (Ptr + y): x;
Printf ("% d", z );
}
17. The output result of the following program is (eybdooG ).
Int main ()
{
Static char B [] = "Goodbye ";