问题 单项选择题

在窗体上画2个命令按钮,名称分别为Command1、Command2,并编写如下程序:Const n=5,m=4Dim a(m,n)Private Sub Command1-Click()k=1For i=1 To mFor i=1 To na(i,j)=kk=k+1Next jNext iEnd SubPrivate Sub Command2_Click()summ=0For i=1 To mFor i=1 To nIf i=1 or i=m Thensumm=summ+a(i,j)ElseIf j=1 or j=n Thensumm=summ+a(i,j)End IfEnd IfNext jNext iPrint summ End Sub过程Command1_Click()的作用是在二维数组a中存放1个m行n列的矩阵;过程Command2-Click()的作用是【 】

A.计算矩阵外围一圈元素的累加和

B.计算矩阵除外围一圈以外的所有元素的累加和

C.计算矩阵第1列和最后一列元素的累加和

D.计算矩阵第1行和最后一行元素的累加和

答案

参考答案:A

解析:本题中,Command1_Click()的作用是行成一个m行n列矩阵,并存放在二维数组a中,而通过对Command2_Click()分析得知,其作用是计算矩阵外围一圈元素的累加和。因为在Command2_Click()内的嵌套循环的内循环中的条件语句写明了只有当矩阵的下标等于首列、首行、末列、末行时才累加到变量summ中,所以应该计算的是的矩阵的外围一圈元素的累加和。

阅读理解
阅读理解。
       A man walked into a doctor's examining room. "Put out your tongue," the doctor said. The man
put out his tongue, and the doctor looked at it quickly.
       "OK. You can put your tongue back now," the doctor said. "It's clear what's wrong with you. You
need more exercise."
       "But, doctor," the man said, "I don't think…"
       "Don't tell me what you think," the doctor said. "I am the doctor, not you. I know what you need.
I see hundreds of people like you. None of them get any exercise. They sit in offices all day and in front
of the TV in the evening. What you need is to walk quickly for at least 20 minutes a day."
        "Doctor, you don't understand," the patient said. "I…"
        "I don't want to hear any excuses," the doctor said. "You must find time for exercise. If you don't, 
you will get fat and have health problems when you are older." 
        "But I walk every day," the patient said.
        "Oh, yes, and I know what kind of walking that is. You walk a few feet to the train station from
your house, a few more feet from the station to your office, and a few more feet from your office to a
restaurant for lunch and back. That is not real walking. I'm talking about a walk in the park for twenty
minutes every day."
        "Will you listen to me, doctor!" the patient shouted, getting angry with his doctor who thought he
knew everything. "I'm a mailman," the patient went on, "and I walk for seven hours every day!" For a
moment the doctor was silent, then he said quietly, "Put your tongue out again, will you?"
1. At first the doctor asked the man             .
[ ]
A. to walk to work
B. to exercise
C. to show his tongue
D. to see hundreds of other patients
2. The doctor would not             .
[ ]
A. tell the patient what was wrong with him
B. let the patient speak
C. look at the man's tongue
D. let the patient watch TV
3. The doctor told the patient that he            .
[ ]
A. should get more exercise
B. should stop making excuses
C. should watch more TV
D. was already too fat
4. The patient was very             when he heard what the doctor told him to do.
[ ]
A. angry
B. happy
C. interested
D. tired
5. The doctor             .
[ ]
A. gave him some good advice
B. walked seven hours a day
C. was really a mailman
D. knew that he was wrong at last
选择题