试题与答案

以下程序的执行结果是()。 #include <iostream.h> int

题型:单项选择题

题目:

以下程序的执行结果是()。
#include <iostream.h>
int a[8]= 1,2,3,4,5,6,7;
void fun(int *pa,int n);
void main( )
int m=8;
fun(a,m);
cout<<a[7]<<end1;

void fun(int *pa,int n)
for (int I=0;I<n-1 ;I++)
*(pa+7)+= *(pa+I);

A.0

B.1

C. 4

D. 28

答案:

参考答案:D

解析:

void fun(int*pa,int n)函数定义的功能就是把数组的每个元素的值加到元素pa[7]中,也就是数组的元素之和放在a[7]中存储,所以结果28。

试题推荐
题型:阅读理解

We talk every day. When we have good news, we like to share it with our good friends and when something terrible happens, we make it known to others soon. But can you imagine that a tree can talk and share hews too? Of course, no tree moves lips and says words just as people do. Strange as it may sound, though, some trees do manage to communicate with each other.

Willow(柳树) trees are the best-known of these trees. When insects(昆虫) begin nibbling(叮咬) a willow tree, the tree sends out a special smell at once. This smell tells the other willows that harmful insects are coming near. All of them quickly make a chemical(化学物质) in their leaves. This chemical is bad to the insects. The insects do not like it and they fly away soon. In this way, the willow trees protect themselves from the insects.

The next time when you take a walk in the woods, maybe the trees are “talking” to each other quietly. And when someone says that trees cannot “talk”, please tell them that even trees give messages to each other, too.

小题1:Willow trees send messages with _________.

A.words

B.movements

C.smells

D.sounds小题2:the underlined word lips in the first paragraph means ________.

A.树干

B.嘴唇

C.枝条

D.手势小题3: The passage tells us that some of the trees can ________.

A.speak just as people do

B.tell stories to others

C.communicate with each other

D.kill insects in the woods小题4:According to the passage, the right order of the following is ________.

a. The willow tree gives out a smell.

b. The willow trees make a chemical in their leaves.

c. Insects fly a way because of the chemical.

d. Insects begin nibbling a willow tree.

A.d-a-b-c

B.d-b-a-c

C.a-b-c-d

D.d-c-b-a

查看答案
微信公众账号搜索答案