问题 单项选择题

有以下程序: #include <stdio.h> #include <string.h> main(int argc,char *argv[]) { int i,len=0;for(i=1;i<argc;i+=2)len+=strlen(argv[i]);prinff("%d\n",len); } 此程序经编译链接后生成的可执行文件是ex.exe,若运行时输入以下带参数的命令行: ex abed efg h3 k44则执行后的输出结果时( )。

A.14

B.12

C.8

D.6

答案

参考答案:D

解析: main函数可以有两个参数,第一个参数为一个整型变量,表示命令行参数的个数,本题为5;第二个参数为一个字符型指针数组,其中第一个数组元素指向程序名,第二个数组元素指向命令行中的第一个参数,以后依此类推。 由程序中的for循环可以看出,程序是求第一(argv[1])、第三(argv[3])个参数的长度之和,即4+2=6。

填空题

Turkey’s Bodrum peninsula is different. The tourist boom in this part of the world (1) turned some small villages into resorts yet left neighbouring beaches undisturbed, making it quite (2) southern France or the Spanish Coasts where few stretches of coastline are undevelopeD.
The (3) for this happy set of circumstances is simple. For thousands of years, travel here (4) easier by boat than by lanD.So when mass tourism arrived in the (5) 1980s, there was no coast road for ribbon development to follow. So the peninsula, just (6) hour from Bodrum airport, has not become one long littoral of resort.
The building (7) new hotels has mainly been confined to places easily reached by then relatively (8) roads. Such ease of access has made Gumbet, near Bodrum, a busy resort, while the little fishing village of Gumusluk, 12 miles further west and only recently reachable by (9) , remains tranquil and undisturbeD.
It’s worth thinking carefully about location when planning a family (10) on the peninsulA.Choose a place that is centrally located, preferably out of earshot (11) Bodrum town’s "lively"—which means nosy—nightlife, and you can then use (12) area’s comfortably small scale to your advantage. Today’s new roads mean most places can (13) reached in under an hour by taxi or the ubiquitous dolmus-minibus.
The (14) of facilities at the Tamarisk Beach Hotel near the small village of Ortakent makes (15) a good base. The family-run hotel—rooms and suites are in two-storey buildings (16) by palm trees and flowers in terracotta pots—sits above its own sandy (17) beach, shaded by tamarisk trees and sheltered by nearby islands.
The hotel is (18) child-friendly, too. Children, from infants up to young teenagers, can take part in a (19) of games and activities that include tuition in windsurfing, dinghy (20) catamaran sailing.

单项选择题