问题 单项选择题

有以下程序:main(){ char *p[]={"3697","2584"}; int i, j; long num=0; for(i=0;i<2;i++) {j=0;while(p[i][j]!='\0'){ if((p[il[j] -'0')%2) num=10*num+ p[i][j] -'0'; j+=2;}printf("%d\n", num);}程序执行后的输出结果是 ( )。

A.35

B.37

C.39

D.3975

答案

参考答案:C

解析: 本题首先定义了一个字符指针数组p,然后使用一个两重循环遍历数组p。因为内循环的循环变量j每次会加2,所以只能遍历到数组p每行中列下标为偶数的字符,它们是‘3’、‘9’、‘2’、‘8’。然后,将它们通过p[i][j]-‘0’表达式转换为对应的整数3、9、2、8,并用%2来判断该整数是否为奇数。所以最终能执行到num=10*num+ p[i][j]-‘0’,语句的只有‘3’和‘9’两个字符。此时已不难算出,运行后num中的值为39。故应该选择C。

实验题
阅读理解

The Great Hanshin-Awaji Earthquake at 5:46 a. rn. on January 17, 1995,Kobe (神户) and its surrounding areas suffered a killer earthquake. Only two other events in this century, the Great Kanto Earthquake of 1923 and World War II caused more deaths in Japan than this earthquake. The epicenter was at the northern tip of Awaji Island. The quake registered 7.2 on the Richter scale (里氏震级). The greatest amount of damage was seen in the Japanese port city of Kobe, and at final count 6 348 people had lost their lives.

The people of the area were quite unprepared for such a big earthquake. Experts had said that most modern buildings would be quite safe even from an earthquake as strong as the Great Kanto Earthquake. This was clearly not true. Television cameras showed the many buildings that had fallen down. The highway that ran through the city had fallen over on its side looking as if it had been pushed over by a giant.

Thousands of people were homeless, However, some of the finest human qualities were seen in the time of crises (moment of great danger). People formed long lines for water and other supplies. They shared what they had with one another. People from young to old stopped to talk to each other and give a few encouraging words. The people living in the area knew that their old life had been destroyed. They believe they can rebuild their life, and a better one,

64. Only two other events caused more deaths in Japan. They are _____.

A. the Great Hanshin-Awaji Earthquake and the Second World War

B. the Great Kanto Earthquake of 1923 and World War II

C. the Great Kanto Earthquake of 1923 and the Great Hanshin-Awaji Earthquake of 1995

D. the First World War and the Second World War

65. Which of the following is true?

A. The Hanshin-Awaji Earthquake was the greatest in the world history. 

B. The earthquake broke out in summer.

C. The center of the earthquake was in the northern end of the port city.

D. More than six thousand people lost their lives in the earthquake.

66. The passage seems to suggest that _____.

A. a giant was able to start an earthquake

B. modem buildings were strong enough to be safe from any earthquake

C. less people would have died if they had been prepared for it

D. experts always tell lies