问题 单项选择题

执行以下语句后显示结果为______。 Dim x As Integer If X Then Print x Else Print X-1

A.1

B.0

C.-1

D.不确定

答案

参考答案:C

解析:[评析] Dim定义的变量,If语句 在Visual Basic中,Dim用于在标准模块、窗体模块或过程中定义变量或数组。而当引用Dim定义的变量时,变量值会被重新设置(数值变量重新设置为0,字符串变量被设置为空)。 If语句的格式: If条件Then若干条语句Else若干条语句 或者 If条件Then 若干条语句 Else 若干条语句 End If If语句的执行方式: 当“条件”为真的时候,执行Then后面的语句;“条件”为假,执行Else后面的语句。 如果“条件”是数值表达式,则数值表达式为非0值时,“条件”为真;数值表达式为0时,“条件”为假。 在此题中,“条件”是整型变量x,其值为0,“条件”为假,执行Else分支,即打印出-1。

阅读理解

任务型阅读

     Jack and his brother lived in a small village. They were very poor. To help his family, Jack often collected wood from

the forest. he also cut down small trees. One morning, a bird flew down from the tree and asked him not to cut down the

tree. The bird said that its home was in the tree.

     Jack left the tree alone. The bird was happy and it asked Jack to bring an empty bag the next morning. Early the next

day he went to the tree and waited for the bird.

     The bird soon came and asked Jack to follow him. They went to a mountain. Jack saw gold all over the ground. up, of ,

and, into, his, picked, gold, them, he, pieces, bag, put. The bird told Jack that he must leave the mountain before the

sun came up. Jack quickly filled (装满) his bag and left the mountain to go home.

     He now had a lot of money for himself and his brother. Jack told his best friend about the tree, the bird and the gold.

His friend wanted some gold, too. He went to the same tree and pretended (假装) he was going to cut it down.

     The bird asked him not to do so. The next morning Jack's friend followed the bird to the mountain of gold, when the

sun was going to appear in the east, the bird told him to leave. The boy didn't want to leave. The sun came up and he

was changed into a bird.

根据短文内容,完成下列各题:

1. Where did Jack and his brother live?

                                                                                                

2. 将文中画线部分翻译成中文:

                                                                                                

3. Who told Jack not to cut down the tree?

                                                                                                

4. 将第三段斜体部分连词成句.

                                                                                                

5. Why did Jack's friend change into a bird at last?

                                                                                                

填空题