问题 填空题

以下程序运行后的输出结果是______。
struct NODE
int k;
struct NODE*link;

main()
struct NODEm[5],*p=m,*q=m+4;
int i=0:
while(p!=q)
p->k=++i;p++;q->k=1++;q--;

q->k=i:
for(i=0;i<5;i++)printf("%d",m[i].k);
printf("\n");

答案

参考答案:13431

解析:本题考查的是结构体类型的数组的应用。程序定义了一个具有5个元素的结构体类型的数组m,并同时将结构体类型的指针变量P指向了数组的第一个元素,q指向了数组的最后一个元素,所以,当第一次循环即i=0的时候,p->k相当于m[0].k,q->k相当于m[4].k。

完形填空
完形填空。
An Idea of Punishing Naughty Students
     In some schools, headmasters and teachers punish (惩罚) students _1_ several ways. The teacher
often writes to or telephones the _2_ parents. Sometimes students have to stay after school for one hour.
If a students behaves(表现)very _3_ in school, the headmaster can stop him or her _4_ classes. The
student can't come to school for one, two or three days.
     Mr. Serious, the headmaster of a middle school in a small town in the United States, did not like to do
this. When the teacher didn't let the student _5_ to school, they were glad. "An unexpected _6_!" they
always thought.
     One day, a boy was in Mr. Serious' office. Of course the student didn't behave well in class. Mr.
Serious called the boy's parents at once. "If you don't come to school with your son, I _7_ him having
classes," said he. The boy's father hurried to school and went to every classroom with his son. _8_
students looked at the father and the son. The boy was embarrassed (不好意思). And after that, he
behaves better. And, of course, other students behave better, too.
     Now headmasters _9_ the USA are trying Mr. Serious' good idea. They all say that students behave
better when _10_ come to school.
( )1. A. with        
( )2. A. students    
( )3. A. bad          
( )4. A. have        
( )5. A. come        
( )6. A. weekday      
( )7. A. will stop    
( )8. A. Other        
( )9. A. over        
( )10. A. headmasters
B. in          
B. students'  
B. badly      
B. to have    
B. to come    
B. study      
B. stop        
B. The other  
B. all over    
B. they        
C. by          
C. student's  
C. well        
C. has          
C. will come    
C. holiday      
C. stopped      
C. Others      
C. over there  
C. parents      
D. of           
D. students's
D. good        
D. having      
D. came        
D. punishing    
D. have stopped
D. The others  
D. all          
D. father      
不定项选择