问题 填空题

下列程序的运行结果是______。
#include<stdio.h>
func(a,B)
static int m=0,i=2;
i+=m+1;
m=i+a+b;
return(m);

main0
intk=5,m=3,p;
p=func(k,m);
printf("%d",p);
p=func(k,m);
printf("%d\n",p);

答案

参考答案:11 23

解析: 在主函数中第一次调用func子函数时,m=0,i=2,i=i+m+1=3,m=i+a+b=3+5+3=11。因为在子函数中将m和i定义成了static类型,所以在子函数中对m和i进行的改变,在下一次调用子函数时能进行保存,所以第二次调用子函数时,m=11,i==3,则i=i+m+1=15,m=i+a+b=15+5+3=23。

阅读理解

阅读理解。

     The worker I hired to repair my house had just finished a difficult first day on the job. A broken wheel

made him an hour late; his ladder (梯子) fell down when he was painting the roof and now his old truck

wouldn' t start. With each problem he shouted angrily, more at himself than at his things. As I drove him

home, the man didn't say a word.

     I tried talking to the man to kill time. I managed to find out that he had come up from Blue Hills in

Victoria with his family six months ago to find a job. This was his first job since moving here. I now knew

why his price was lower than any other worker I could find in the local newspaper. He really needed the job.

His clothes told me as much.

     On arriving, much to my surprise, he invited me in to meet his family. As we walked through his front

garden he suddenly stopped at a small tree and placed his hands on it. Then, when he opened the door he

completely changed. Instead of his troubled face, there was now a warm smile, hugs for his two children

and a kiss for his wife.

     The following day, I asked him about the tree.

     "That's my trouble tree," he answered. "Work troubles aren't welcome at home with my wife and the

children. So I hang them on that tree every night when I come home. Then in the morning I pick them up

again."

     "And you know what else?" he said smiling, "The next morning I find that there aren't as many as I

remember hanging up the night before."

1. Which of the following things did NOT happen to the worker?

A. His truck broke down.

B. He was late for work.

C. He fell onto the roof.

D. His ladder fell down.

2. When did the worker first arrive in this town? 

A. Today.

B. Last night.

C. Six weeks ago.

D. Six months ago.

3. Where did the writer find the worker?

A. Through a newspaper.

B. Beside the trouble tree.

C. In his old house.

D. In Blue Hills, Victoria.

4. Why did the worker touch the tree?

A. To get good luck.

B. To leave his trouble outside.

C. To send good wishes to his family.

D. To clean his hands.

5. What can we learn from the passage?

A. Looking for a job can make trouble.

B. It is important to get to work on time.

C. Often our problems are worse than what we think.

D. A happy family can make many problems go away.

单项选择题