问题 单项选择题

在C程序中,若表达式中的算术运算对象类型不同,则需要先统一为相同类型后再进行计算。例如,表达式“a-b”中,若a是双精度浮点型变量,b是整型变量,为了尽可能保证运算精度,通常进行的处理是()。

A.读取b 的值并转换为双精度浮点型数据,然后进行两个浮点数的相减运算,变量b 的值不变

B.读取a 的值并转换为整型数据,然后进行两个整数的相加减运算,变量a 的值不变

C.将b 重新定义为双精度浮点型变量(其值自动转换为双精度型数据),再进行两个浮点数的相减运算

D.将a 重新定义为整型变量(其值自动转换为整型数据),再进行两个整数的相减运算

答案

参考答案:A

解析:

本题考查程序语言基础知识。   在表达式的求值过程中,若参与运算的数据类型不一致,则编译系统自动进行相应数据的类型转换(隐式类型转换),类型转换的一般规则是:为防止精度损 失,如果必要的话,类型总是被提升为较宽的类型;所有含有小于整型的有序类型的算术表达式在计算之前其类型都会被转换成整型。 最宽的类型为long double,运算时另一个操作数无论是什么类型都将被转换成long double。如果两个操作数都不是long double型,那么若其中一个操作数的类型是double型,则另一个就被转换成double型。类似地,如果两个操作数都不是double型而其中一 个是操作float型,则另一个被转换成float型。否则如果两个操作数都不是3种浮点类型之一,它们一定是某种整值类型。在确定共同的目标提升类型之 前,编译器将在所有小于int的整值类型上施加一个被称为整值提升的过程。 在进行整值提升时类型char、signed char、unsigned char和short int都被提升为类型int。C/C++语言编译系统提供的内部数据类型的自动隐式转换规则如下:   

①程序在执行算术运算时,低类型可以转换为高类型。   

②在赋值表达式中,右边表达式的值自动隐式转换为左边变量的类型,并赋值给它。   

③当在函数调用时,将实参值赋给形参,系统隐式地将实参转换为形参的类型后,赋给形参。   

④函数有返回值时,系统将自动地将返回表达式类型转换为函数类型后,赋值给调用函数。

选择题
阅读理解

BEIJING--Alarmed by the overreaching ambitions of many Chinese provinces to grow at all costs, China’s top economic chief is calling on officials to calm down and spare a thought for the environment.

Zhang Ping, who heads China’s National Development and Reform Commission, the central economic planning agency, said only five or six of China’s 30 provinces are targeting annual economic growth of 8 percent or 9 percent.

The remaining provinces are aiming for growth rates of more than 10 percent this year, with some wanting to double economic output in the coming five years.

“China has a planned energy supply of about 4 billion cubic tons of coal equivalent(等量的)for the next five years, and this is not enough to meet demands for economic growth to double,” he was quoted as saying on the news portal Sina.Com.

Beijing is increasingly concerned with the ambitions of Chinese provinces across the country to chase high growth despite the central government’s urgent request for a more moderate and sustainable(可持续的)pace of expansion.

Years of rapid economic growth has taken a toll on China’s environment, with Beijing trying to remove some of the damage now.It has an annual growth target of 7 percent for the next five years, well down from last year’s 10 percent.

Zhang said Beijing has asked local governments to take into account the supply of “energy, environment, water and land” to set more reasonable growth targets.

小题1:Which of the following statements is TRUE according to the passage?

A.Many Chinese provinces are alarmed by Beijing.

B.Zhang Ping is an expert and economic chief from www. Sina.Com.

C.The supply of the coal in China is not sufficient(足够的) for the next five years.

D.Few Chinese provinces are aiming for economic growth rates of less than 10%.小题2:The underlined phrase “taken a toll on” in the sixth paragraph means “_________”.

A.looked forward to

B.paid attention to

C.caused damage to

D.attached importance to小题3:The general idea of the whole passage can be that ________.

A.China’s economy is developing

B.China’s top chief places more emphasis on the environment

C.all Chinese provinces should slow down their economic growth rates

D.economic high growth should go hand in hand with environmental protection小题4:What could be the best title for the news?

A.Economic Development

B.Energy Supply

C.Sustainable Development

D.Environment protection