问题 单项选择题

程序代码如下,当单击窗体上的Command1控件时,窗体上输出的结果是( )。
Private Sub Command1_Click()
Dim Y As Integer,I As Integer
Dim A(7)As Integer
Y=18:I=0
Do
A(I)=Y Mod 2
I=I+1
Y=Y\2
Loop Until Y<1
For j=I-1 To 0 Step-1
Print A(j);
Next j
End Sub

A.1 0 0 0

B.1 0 0 1 0

C.0 0 1 1 0

D.1 0 1 0 0

答案

参考答案:B

解析: 程序中Do-Loop循环的执行过程是:第一次I=0,Y=18,把Y Mod 2的值0存入a(0),I加1使I值变成1,Y\2存入Y,从而使Y变成9,Y为9不小于1,依旧循环:第二次I=1,Y=9,把Y Mod 2的值1存入a(1),i加1变成2,Y\2存入Y,从而使 Y变成4,Y为4不小于1,依旧循环:第三次I=2,Y=4,把Y Mod 2的值0存入a(2),i值加1变成3,Y\2存入Y,从而使Y变成2,Y为2不小于1,依旧循环;第四次I=3,Y=2,把Y Mod 2的值0存入a(3),i值加1变成4,Y\2存入Y,从而使Y变成1,Y为1不小于 1,依旧循环:第五次I=4,Y=1,把Y Mod 2的值1存入a(4),i值的加1变成5,Y/2存入 Y,从而使Y变成0,Y为0小于1,循环退出。再通过For循环从a(4)到a(0)输出数组元素,结果是“1 0 0 1 0”。

阅读理解
阅读理解。
       A small man with a fat stomach got on the train at the last station before the frontier (边境). He carried   
a paper bag. And four feet of ducks (鸭子) could be seen under the cover. The man found an empty seat,        
put the bag in the middle of the floor, took out a newspaper and began to read. 
       Then a policeman came in. Of course he saw the bag with the ducks' feet at once and said, "Whose is
that bag?"
        Nobody answered. The policeman repeated the question, and said, "I shall have to take it away from
the owner. Food mustn't be taken out of country."
        "Well, then," said the small man with a fat stomach." Hurry up and take it away. We want to go home.
"The policeman took the bag and went on to the next carriage (车厢).
         At the next station, when they were safely across the frontier, the small man got up, smiled at other
passengers and said, "I hope that they'll enjoy the ducks' feet. The rest of the bag had nothing but rubbish in
it." Then he opened his coat and pointed to another bag he was carrying under it. It was tied over the stomach,
which was not really fat. "I have the rest of the two ducks here," he said. With these words, he got off the
train.
         But while he was happily walking to the exit with the bag in his hand, a policeman came up to him,
saying, "Hey, man! Foreign food mustn't be brought in."
1. The small man put the bag in the middle of the floor              .
[ ]
A. because the other passengers didn't like it
B. so that the policeman could find it easily
C. so that he could make more room for himself
D. because there was not an empty seat in the carriage
2. Why did the first policeman take the paper bag away? Because              .
[ ]
A. he wanted to find the owner of the bag
B. he enjoyed the ducks' feet in the bag
C. the bag was put in a wrong place in the carriage
D. food can't be taken abroad
3. The bag the policeman took away had nothing in it except              .
[ ]
A. two ducks
B. rubbish
C. the ducks'feet and rubbish
D. the ducks'feet
4. How many ducks are there in the passage?
[ ]
A. 2.
B. 4.
C. 6.
D. We don't know.
5. What happened in the end? The small man               .
[ ]
A. failed to take his food home
B. crossed the frontier with two paper bags
C. took the ducks safely home
D. hid his ducks under his coat again
单项选择题