问题 单项选择题

有以下程序段: int k=0,a=1,b=2,c=3; k=a<bb:a; k=k>cc:k; 执行该程序段后,k的值是【 】。

A.3

B.2

C.1

D.0

答案

参考答案:B

解析:三目运算符的一般形式为(表达式1)(表达式2):(表达式3),当(表达式1)值为真时,(表达式2)的值为整个表达式的值;当(表达式1)值为假时,(表达式3)的值为整个表达式的值。题中执行表达式"k=a<bb:a"后,k=2,将此值代入后一个表达式"k=k>cc:k,由于"k>c"值为假,故k的值还等于原来k的值,即B。

多项选择题
完形填空

第一节 完形填空

People joke that no one in Los Angeles reads; everyone watches TV, rents DVDs, or goes to the movies. The most popular reading material is comic books, movie magazines, and TV guides. City 21      has only 10 percent of the traffic that car washes have.

But how do you explain the following? An annual book festival in west Los Angeles is “22      ”,year after year. People wait half an hour for a parking space to become 23     .

This outdoor festival, 24       by a newspaper, occurs every April for one weekend. This year’s attendance was about 145,000. There were about 90 talks given by authors, with an       25        question period following each talk. Book lovers were also able to collect some of the signatures of their favourite authors. A food store sold all kinds of popular foods. 26           a$7 parking fee, the festival was free. Even so, some people 27          the food store prices by 28       taking in their own sandwiches and drinks.

The idea for the festival occurred years ago, but nobody knew if it would succeed.       29    book festivals were already popular in other US cities, would Los Angeles people welcome one?“Los Angeles people are very 30        ,”said one of the festival founders.

1. A. cinemas     B. libraries       C. supermarkets   D. parkings

2. A. broken out   B. carried out     C. sold out       D. run out

3. A. possible     B. available      C. acceptable     D. useful

4. A. bought      B. discovered     C. taken         D. sponsored

5. A. expert       B. accurate       C. audience      D. optimistic

6. A. Except for    B. Consisting of   C. Rather than    D. Along with

7. A. avoided      B. increased      C. asked         D. bargained

8.  A. openly     B. secretly       C. slowly         D. naturally

9.  A. As if      B. When         C. Even that       D. Although

10. A. confident   B. unexpected     C. friendly        D. unpredictable