C language test questions
Let me answer:

1. 1

2.9

Explanation: t =(a>;; b)? A:b is equivalent to t = ((a > b)? A: B) You should know by now.

3.96` (and the ~ key are the same key)

Explanation: a = 9696 is the decimal representation of the ACSII code value of this character, and the hexadecimal representation of its ASCII code value is 60. You can divide 96 by 16 to get 60, and then look at the table of ASCII code 16 and you will find that it corresponds to this character, so it is him. Just don't confuse it with single quotation marks. Single quotation marks are expressed in ASCII hexadecimal.

a[0] a[ 1] a[2]

5. 1600

6. Text file binary file [this is not very accurate]

7.fopen fclose fseek

As shown below:

1.C

Explanation: a+=a-=a*=a, first of all, you should know that+=,-=, * = have the same priority, but their combination is from right to left, so it is equivalent to a+=a-=(a=a*a). You should also know that this is to modify the value of the same variable many times in the same sentence. Here are some general situations. Try not to modify the value of the same variable multiple times in the same statement. Sometimes it's related to the compiler. A+=a-=(a=a*a) is equivalent to a+=(a=a-(a=a*a)), in a=(a+(a=a-(a=a*a)).

2.B

3.D

Description: define a macro #define ADD(x) (x)+(x) with parameters.

You know, macro replacement is mechanical replacement, which is not very intelligent, that is to say.

Here, when replacing, replace it with d = (a+b)+(a+b) * c; So it ended up being 80.

4.A

Description: understand it this way, char a [5]; char * p = a; This is to assign the first address of the array to the pointer p to initialize the pointer, and then you add a sentence: p = "abcd is not the assignment of the pointer, so that the pointer points to the first address of the string instead of the first address of the array. I believe char * p = "abcd is very common, hehe. ...

5.C

Note: Because k=2, and then the relational expression k==0 is executed, the result is obviously false, so the loop body is not executed.

6.C

7.A

Pointers cannot be added together.

8.D

Explanation: This question should be explained well. This question is ok.

struct ST { int n; struct st * next};

Static structure st a[3]={5, ampa[ 1], 7, & ampa[2], 9,' \0'}, * p;; p = & ampa[0];

A p++->n B p->n++ C (*p). n++ d++ p-& gt; n

Analysis: First of all, you should know that this is a structure array, and this static structure STA [3] = {5,&; A[ 1], 7, & ampa [2], 9,' \ 0'} readability is static structure sta [3] = {{5,&; A[ 1]}, {7, & ampA[2]}, {9,' \0'}}, is it much clearer?

Before doing this topic, you need to understand that the arrow operator takes precedence over the++operator, and then analyze the options.

Option A.p++ is suffix addition, so execute (p++)->; N (that is, p++->; N) is equivalent to executing p->; N, that is, the value obtained is 5.

Option B. p->N++ is equivalent to (p->; N)++, because it is suffix addition, the value obtained is also 5.

Option c(* p). N++ is equivalent to ((*p). N)++, which is more equivalent to (p->; N)++, so as above, it is also 5. Why is it equivalent to it? This requires you to look at the origin of arrow operators. The origin of the arrow operator is to combine the dereference operator * with the dot operator to simplify writing and increase readability.

Option D.++p->n is equivalent to++(p->; N), because it is prefix addition, the value is 6.

9.c, selecting w will format it.

10.b, the array name is actually equivalent to a pointer. Operate the pointer here, add 1 and move the pointer down.

Write down the running results:

1.

10623-9003

2.

6 7 8

Fill in the blanks:

1.

# include & ltstdio.h & gt

# include & ltmath.h & gt

2.2

3. break;

4.k+ 1

Programming problems:

1. The code is as follows:

# include & ltstdio.h & gt

int main()

{

int i,n;

Length s =1;

scanf("%d ",& ampn);

for(I = 1; I < = n; i++)

s * = I;

printf("%ld ",s);

Returns 0;

}

2. The code is as follows

# include & ltstdio.h & gt

int main()

{

int i,s = 0;

for(I = 1; I<= 100; i++)

s+= I;

printf("%d ",s);

Returns 0;

}

It should be right. You can send me a message if you have any questions.