问题 单项选择题

下列程序的输出结果是( )。 public class Test
public static void main(String[] args)
char a1 = 'B', a2 = 'c';
if(a1+1<a2) ++a1;
System. out. println(a1);

A.B

B.b

C.C

D.c

答案

参考答案:C

解析: 在程序中,a1和a2均为char类型的变量,判断条件a1+1<a2的执行过程是:在 Unicode字符集中找到字符'B'的下一个字符,即'C',再将字符'C'和字符'c'的索引值做比较,在 Unicode字符集中,'C'的索引值小于'c'的索引值,因此条件表达式为true,条件分支++a1;将被执行,因此a1的值变为'C'。

选择题
阅读理解
Where to stay in Boswell? The following are some choices for you:
First Hotel. 222 Edward Road. Tel. 414-6433. Number of Rooms: 120.
Price:  Single: $ 25; Doulbe $ 35;
Special attractions: Airconditioned rooms, French restaurant, Night club, Swimming pool, Shops; Coffee shop and bar, Telephone, Radio and TV in each room, close to the city center.
 
Fairview Hotel. 129 North Road. Tel. 591-5620. Number of Rooms: 50.
Price:   Single:$ 12; Double: $ 18;
Special Attractions: Close to the airport, Telephone in each room, Bar, Restaurant, Garage, Swimming-pool.
 
Orchard Hotel. 233 Edward Road. Tel.641-6641. Number of Rooms: 150.
Price:   Single: $ 15;  Double: $ 20;
Special Attractions: Facing First Hotel, European restaurant, Coffee shop, Dry-cleaning, Shops, TV, Night-club.
 
Osaka Hotel. 1264 Venning Road. Tel. 643-8206. Number of Rooms: 180.
Price:    Single: $ 30;  Double: $ 50.
Special Attractions: Air-Conditioned rooms, Japanese and Chinese restaurant, Shops, Swimming pool, Large garden.
 
49.  The number of the room in Osaka Hotel is :
A.  50                                 B.  120                      C.  150                      D.  180
50.  If a Japanese traveller likes to eat in French restaurant, _______ is the right place for him to go to.
A.  233 Edward Road                                     B.  1264 Venning Road
C.  222 Edward Road                                             D.  129 North Road
51.  Which hotel faces the Orchard Hotel?
A.  The First Hotel                            B.  The Osaka Hotel                                  
C.  The Fairview Hotel                                D.  No Hotel
52.  If you want to book a cheapest single room, which number will you call?
A.  414-6433                    B.  591-5620           C.  641-6641           D.  643-8206