问题 单项选择题

执行下面的程序,单击命令按钮后,窗体中的输出结果是 ______。
Private Sub Cotomand1_Click()
Ch$="Welcome Home!"
a=Len(ch$)
For i= 1 To a
b$ = Mid(ch$, i 1)
If b$ = "m" Then m = m + 1
Next 1
Print m
End Sub

A.2
B.3
C.1
D.0

答案

参考答案:A

解析: 题中程序的功能是统计字母m在字符串“Welcome Home!”中出现的次数。程序中有两个字符串函数,Len()和Mid()。Len()函数的作用为计算字符串中字符的个数,而Mid()函数的作用为取子串。题中依次选取字符串中的字母,与字符“m”进行比较,所以答案选A。

单项选择题

Some spiders hunt on the ground, others build webs to trap their food, but the grass water spider catches its prey by running along the surface of the water.

This special water spider lives on the grassy banks of streams where mosquitoes, damsel flies and other insects come to feed and breed.

Although it is one of the largest spiders in New Zealand, it has an unusual ability. It doesn’t disturb the water as it waits for its meal, and there is barely a ripple when it skims across the surface at lightning speed to catch its prey.

Grass water spiders deal swiftly with larger insects like damsel flies by pulling their heads under the water and holding them there until they drown.

After a meal, the grass water spider spends up to half an hour grooming itself. It wipes its eight eyes, brushes its antennae, and takes special care to clean the hairs on its body.

It is the hairs that trap tiny bubbles of air so that the spider can run down a blade of grass and stay underwater for up to an hour when it is frightened. The hairs also keep the spider dry, even underwater.

It is only when the female spider is caring for the young that she does not hunt on the water. After mating, she produces a large egg sac, which she carries around for five weeks. Once the eggs start to hatch, she attaches the sac to some blades of grass or a thistle. She then tears the sac open and releases the tiny spiders into the nursery web.

The passage tells us that the spider()

A. feeds grass and thistles to its young

B. lives on blades of grass under the water

C. lives in the grass on the banks of streams

D. eats a meal once every five weeks

单项选择题