问题 单项选择题

以下不能正确进行字符串赋初值的语句是

A.char str[5]="good!";

B.char str[]="good!";

C.char*srt="good!";

D.char str[5]={ 'g', 'o', 'o', 'd'};

答案

参考答案:A

解析: 本题考核的知识点是字符数组和字符指针变量的初始化。选项A定义了一个字符数组str,具有5个元素,但赋初值的时候,初值个数却是6个(有一个'\0'),故选项A错误的;选项B定义了一个字符数组str并给它赋初值,由于省去了长度定义,长度由初值个数确定,相当于 str[6],选项B正确;选项C定义了一个字符型指针变量并用一个字符串给它赋初值,使该字符型指针指向了该字符串,选项C正确;选项D是对字符型数组中单个元素依次赋初值,选项D正确。所以,4个选项中A为所选。

单项选择题

Suddenly, the economics of American suburban life are under assault as skyrocketing energy prices inflate the costs of reaching, heating and cooling homes on the distant edges of metropolitan areas. Just off Singing Hills Road, in one of hundreds of two-story homes dotting a former cattle ranch beyond the southern fringes of Denver, Phil Boyle and his family openly wonder if they will have to move close to town to get some relief.

They still revel in the space and quiet that has drawn a steady exodus from American cities toward places like this for more than half a century. But life on the edges of suburbia is beginning to feel untenable. Mr. Boyle and his wife must drive nearly an hour to their jobs in the high-tech corridor of southern Denver. With gasoline at more than $ 4 a gallon, Mr. Boyle recently paid $121 to fill his pickup truck with diesel fuel. In March, the last time he filled his propane tank to heat his spacious house, he paid $ 566, more than twice the price of 5 years ago.

Though Mr. Boyle finds city life unappealing, it is now up for reconsideration. "Living closer in, in a smaller space, where you don’t have that commute," he said, "It’s definitely something we talk about. Before it was’we spend too much time driving.’ Now, it’s ’we spend too much time and money driving.’ "

Across the nation, the realization is taking hold that rising energy prices are less a momentary blip than a change with lasting consequences. The shift to costlier fuel is threatening to slow the decades-old migration away from cities, while exacerbating the ’housing downturn by diminishing the appeal of larger homes set far from urban jobs. In Atlanta, Philadelphia, San Francisco and Minneapolis, homes beyond the urban core have been falling in value faster than those within, according to an analysis by Moody’s Economy. com. In Denver, housing prices in the urban core rose steadily from 2003 until late last year compared with previous years, before dipping nearly 5 percent in the last three months of last year, according to Economy. com. But house prices in the suburbs began falling earlier, in the middle of 2006, and then accelerated, dropping by 7 percent during the last three months of the year from a year earlier.

Many factors have propelled the unraveling of American real estate, from the mortgage crisis to a staggering excess of home construction. But economists and real estate agents are growing convinced that the rising cost of energy is now a primary factor pushing home prices down in the suburbs. More than three-fourths of prospective home buyers are now more inclined to live in an urban area because of fuel prices, according to a recent survey of 903 real estate agents with Coldwell Banker, the national brokerage firm.

The key factor contributing to the downturn of American suburban real estate is().

A.crisis of loan

B.excessive home construction

C.buyers’inclination to live in an urban area

D.the constant rise of fuel prices

单项选择题