最新电大开放教育C++语言程序设计(本)期末考试复习题及参考答案资料小抄

上传人:1888****888 文档编号:37910539 上传时间:2021-11-05 格式:DOC 页数:10 大小:85KB
收藏 版权申诉 举报 下载
最新电大开放教育C++语言程序设计(本)期末考试复习题及参考答案资料小抄_第1页
第1页 / 共10页
最新电大开放教育C++语言程序设计(本)期末考试复习题及参考答案资料小抄_第2页
第2页 / 共10页
最新电大开放教育C++语言程序设计(本)期末考试复习题及参考答案资料小抄_第3页
第3页 / 共10页
资源描述:

《最新电大开放教育C++语言程序设计(本)期末考试复习题及参考答案资料小抄》由会员分享,可在线阅读,更多相关《最新电大开放教育C++语言程序设计(本)期末考试复习题及参考答案资料小抄(10页珍藏版)》请在装配图网上搜索。

1、电大C+语言程序设计期末考试复习题及参考答案资料小抄一、单选题1 在定义函数的格式类型修饰符 函数名 (形式参数表)函数体;中,函数体可以是( )。A、基本语句 B、复合语句C、空语句 D、语句序列2ABAB的值( )。A、为true B、为falseC、与AB 的值相同 D、与AB的值相同3每一个实在参数就是一个( )。A、表达式 B、常量 C、变量 D、函数调用4. 假定AB为一个类,则该类的拷贝构造函数的声明语句为_。 A AB&(AB x); B AB(AB x) C AB(AB &x); D AB(AB* x)5. 对于结构中定义的成员,其隐含访问权限为_。 A public B p

2、rotected C private D static6当使用fstream流类定义一个流对象并打开一个磁盘文件时,文件的隐含打开方式为_。 A ios:in B ios:out C ios:in | ios:out D 没有7在PC机中运行的C+ 语言程序,char类型的数据占 字节。A、1 B、2 C、3 D、48指出下列哪种基本类型是错误的 B 。A、float B、integer C、char D、long9若a,b,c均为整型变量,则表达式a=2,b=a+2,c=0的值为 。A、不定 B、2 C、4 D、010设char t=A;则表达式5+0.6+t值的数据类型为 。A、int B

3、、float C、不确定 D、double11以下 为不正确的if语句。A、if (xy); B、if (x= =y) x+y;C、if (x! = y) cinx else ciny; D、if(xy) x+;y+;12指向数组元素为整型的一维数组的指针变量的定义是 。A、int *p( ) B、int (*p)( ) C、int *p4 D、int (*p)413以下关于switch语句和break语句的描述中不正确的是 。A、 break语句不能用于循环语句和switch语句外的任何其它语句B、 switch语句中使用break语句或continue语句的作用相同C、 在循环语句中使用b

4、reak语句是为了使流程跳出循环体,提前结束循环D、 在循环语句中使用continue语句是为了结束本次循环,而不是终止整个循环的执行。14下列关于函数定义的说法,正确的是 。A、函数定义时,可以嵌套 B、函数定义不可以嵌套,但可以嵌套调用C、主函数main()内可以定义函数 D、函数定义可以嵌套,调用也可以嵌套。15若有以下说明语句int a34=2,3,4,5,3,4,5,6,4,5,6,7;则正确对数组元素引用为 。A、*(a+1) B、*(a3+2) C、a1+3 D、a0016若定义如下的共同体类型变量x,则x所占用的内存字节数为 (以IBM PC机为例)union dataint

5、i;char ch;double f;x;A、7 B、11 C、8 D、10二、填空题1应用程序TEST.CPP中只有一个函数,这个函数的名称是 main 。25|6,5&6和56的值分别是 7 , 4 和 3 。3不借助于其他变量交换x和y两个变量的值,应顺序执行的三个赋值语句是 x=x+y , y=x-y 和 x=x-y 。4下面的语句显示输出8行8列数组h的主对角线上的所有元素,请补充完整:for( i=0 ; i8 ;i+)cout hii ;5若一函数是以return;结束运行的,说明该函数是 无参 函数。6若正常执行了如下语句:int m20,*p1=m5,*p2=m+17,n;n

6、=p2-p1; 则n的值为 12 。7已知 A一Z的ASCII码为6590,当执行char ch=14*5+2;coutchendl;语句序列后,得到的输出结果为 H 。8float和double类型的长度分别为 4 和 8 。9表达式xx+l表示成增量表达式为 x+ 。10假定p所指对象的值为36,p+l所指对象的值为49,则*+p的值为 49 。11假定要访问一个结构对象x中的由a指针成员所指向的对象,则表示方法为 *(xa) 。12对一个类中的数据成员的初始化可以通过构造函数中的 初始化表 实现,也可以通过构造函数中的 函数体 实现。13在C+程序中,语句之间必须用 ; 分隔。14在C+

7、程序中, 运算符优先级最低。15在C+语言中,在IBM PC机环境下,double型数据占 8 字节。16若k 为int型变量,则下列语句的输出为 16 。k=017;cout0 是判断一元二次方式ax2+bx+c=0有实根的表达式。18表达式(b=10)&(c=0)的值为 0 。19已知a的ASCII的十进制代码为97,则表达式10+15.2-27*(a-b)的值为 52.2 。20在C+语言中,& 作为双目运算符时表示的是 按位与 ,而作为单目运算时表示的是 引用 。21一个函数由函数 名 和函数 体 两部分构成。22C+在执行过程中不检查数组是否 越界 。23C+语言规定,调用一个函数时

8、,实参数变量与形参数变量之间的数据传递是 。24指针变量的指针是 地址 。25结构体变量中的成员的引用一般形式:结构变量名成员名 。26写出满足AB则把A+B赋给M的if语句 if(AB) M=A+B 。27写出指向int型变量的指针变量p的一个定义语句: int *p 。三、给出下列程序运行后的输出结果1#include void SB(char ch) switch(ch) case A: case a: coutwell !; break; case B: case b: coutgood !; break; case C: case c: coutpass ! ; break; def

9、ault: coutbad! ; break; coutendl; void main() char a6 =Abcaf; for(int i=0; ai; i+) SB(ai);答案:well !good !pass !well !bad!2#include void main() int a10= 36,25,48,14,55,40,72,40,86,27; int b1, b2; b1 = b2 = a0; for(int i= 1;ib1) if(b1b2) b2=b1; b1 = ai; coutb1 b2endl; 答案:86 723#include void main() int

10、 a8= 3,5,7,9,11,13,15,17; int *p=a; for(int i=0;i8;i+) *p+=10; coutsetw(5) *p+; if (i+1) %3=0) coutendl; 答案:13 15 2719 21 2325 274. #include void LE(int* a, int* b) int x=*a; *a=*b; *b=x; cout*a *bendl; void main() int x=10, y=25; LE(&x,&y); coutx yendl; 答案:25 1025 105. #include class A int a,b; pub

11、lic: A() a=b=0; A(int aa, int bb) a=aa; b=bb; couta bendl; ; void main() A x,y(2,3),z(4,5); 答案:(下面是四个数,中间有空格)2 34 56#includevoid main()int m=3,x=4,y=4,z=7;m=(mx)?x+: m;m=(my)?y+: m;m=(m“m=”mendl”x=”xendl”y=”yendl”z=”z;程序运行后的输出结果为:答案:m=7x=5y=4z=87#includevoid sort(int x,int y,int z) int t;if (xy)t=x;

12、x=y;y=t;if(xz)t=x;x=z;z=t;if(yz)t=y;y=z;z=t;cout“x=”x ”y=”y ”z=”z;void main() int a,b,c;cinabc;cout“a=”a ”b=”b ”c=”c;sort(a,b,c);cout“a=”a ”b=”b ”c=”c;假设输入为:10 6 8则程序运行后的输出结果为:参考答案:a=10 b=6 c=8x=6 y=8 z=10a=10 b=6 c=88. #includevoid prn str(char *str,int m,int n)int i;for (i=1;i“*”;str+;for (i=1;(i*

13、str+;while(*str)cout“*”;str+;coutendl;void main() char *p=“information”;prn str(p,3,4);程序运行后的输出结果为:答案: *form*四、写出下列每个函数的功能1.int Count(double a, int n) double m=0; int i;for(i=0;in;i+) m+=ai; m=m/n; int c=0;for(i=0;i=m) c+;return c; 答案:计算并返回参数数组中大于等于参数数组中所有元素平均值的元素个数2.long fact(long n)if (n=1L) retur

14、n 1L;return n*fact(n-1L);答案:通过函数递归调用,计算并返回参数n的阶乘 3. #include void WA(int a, int n) for(int i=0;in-1;i+) int k=i; for(int j=i+1;jn;j+) if(ajak) k=j; int x=ai; ai=ak; ak=x; 答案:对参数数组中的元素进行升序排序 4#include #include void JB(char* fname) /可把以fname所指字符串作为文件标识符的文件称为fname文件, /假定该文件中保存着一批字符串,每个字符串的长度均小于20。 ifst

15、ream fin(fname); char a20; int i=0; while(fina) coutaendl; i+; fin.close(); couti=iendl; 答案:依次把参数fname所指的文件中字符输入到字符串数组a中,并输出文件中字符个数五、编程题1设计一程序,它输入一个整数,判断它是否是整数序列32,52,31,86,3,44,11,7,55,63中的一个;若是,显示该整数在序列中的序号(注:最小序号是1),否则显示0。答案:#include int getno(int val) int a=32,52,31,86,3,44,11,7,55,63; for(int i

16、=0;ival; coutgetno(val);2.编写一个程序,统计输入的一行字符中数字、空格及其它字符分别有多少个。答案:#includevoid main() int i,eng=0,numb=0,blan=0,others=0; char a100; cin.getline(a,100); for(i=0;ai;i+) if(ai48) numb+; else if(ai=32) blan+; else if(ai65&ai97&ai97+25) eng+; else others+; couteng=engendlnumb=numbendl;coutblan=blanendlothe

17、rs=othersendl; 3.有8个学生,每个学生四门课程的成绩存放在一个8行5列的二维数组的0到7行的1到4列中,编写一个函数实现:计算每个学生四门课程的总成绩,并存放在该学生所在行的第0列中。答案:#includevoid main() int i,j;int a85=0;for(i=0;i8;i+)for(j=1;jaij; /输入学生成绩for(i=0;i8;i+)for(j=1;j5;j+)ai0+=aij; /求学生四门课程总成绩请您删除一下内容,O(_)O谢谢!2016年中央电大期末复习考试小抄大全,电大期末考试必备小抄,电大考试必过小抄Basketball can make

18、 a true claim to being the only major sport that is an American invention. From high school to the professional level, basketball attracts a large following for live games as well as television coverage of events like the National Collegiate Athletic Association (NCAA) annual tournament and the Nati

19、onal Basketball Association (NBA) and Womens National Basketball Association (WNBA) playoffs. And it has also made American heroes out of its player and coach legends like Michael Jordan, Larry Bird, Earvin Magic Johnson, Sheryl Swoopes, and other great players. At the heart of the game is the playi

20、ng space and the equipment. The space is a rectangular, indoor court. The principal pieces of equipment are the two elevated baskets, one at each end (in the long direction) of the court, and the basketball itself. The ball is spherical in shape and is inflated. Basket-balls range in size from 28.5-

21、30 in (72-76 cm) in circumference, and in weight from 18-22 oz (510-624 g). For players below the high school level, a smaller ball is used, but the ball in mens games measures 29.5-30 in (75-76 cm) in circumference, and a womens ball is 28.5-29 in (72-74 cm) in circumference. The covering of the ba

22、ll is leather, rubber, composition, or synthetic, although leather covers only are dictated by rules for college play, unless the teams agree otherwise. Orange is the regulation color. At all levels of play, the home team provides the ball. Inflation of the ball is based on the height of the balls b

23、ounce. Inside the covering or casing, a rubber bladder holds air. The ball must be inflated to a pressure sufficient to make it rebound to a height (measured to the top of the ball) of 49-54 in (1.2-1.4 m) when it is dropped on a solid wooden floor from a starting height of 6 ft (1.80 m) measured fr

24、om the bottom of the ball. The factory must test the balls, and the air pressure that makes the ball legal in keeping with the bounce test is stamped on the ball. During the intensity of high school and college tourneys and the professional playoffs, this inflated sphere commands considerable attent

25、ion. Basketball is one of few sports with a known date of birth. On December 1, 1891, in Springfield, Massachusetts, James Naismith hung two half-bushel peach baskets at the opposite ends of a gymnasium and out-lined 13 rules based on five principles to his students at the International Training Sch

26、ool of the Young Mens Christian Association (YMCA), which later became Springfield College. Naismith (1861-1939) was a physical education teacher who was seeking a team sport with limited physical contact but a lot of running, jumping, shooting, and the hand-eye coordination required in handling a b

27、all. The peach baskets he hung as goals gave the sport the name of basketball. His students were excited about the game, and Christmas vacation gave them the chance to tell their friends and people at their local YMCAs about the game. The association leaders wrote to Naismith asking for copies of th

28、e rules, and they were published in the Triangle, the school newspaper, on January 15,1892. Naismiths five basic principles center on the ball, which was described as large, light, and handled with the hands. Players could not move the ball by running alone, and none of the players was restricted ag

29、ainst handling the ball. The playing area was also open to all players, but there was to be no physical contact between players; the ball was the objective. To score, the ball had to be shot through a horizontal, elevated goal. The team with the most points at the end of an allotted time period wins

30、. Early in the history of basketball, the local YMCAs provided the gymnasiums, and membership in the organization grew rapidly. The size of the local gym dictated the number of players; smaller gyms used five players on a side, and the larger gyms allowed seven to nine. The team size became generall

31、y established as five in 1895, and, in 1897, this was made formal in the rules. The YMCA lost interest in supporting the game because 10-20 basketball players monopolized a gymnasium previously used by many more in a variety of activities. YMCA membership dropped, and basketball enthusiasts played i

32、n local halls. This led to the building of basketball gymnasiums at schools and colleges and also to the formation of professional leagues. Although basketball was born in the United States, five of Naismiths original players were Canadians, and the game spread to Canada immediately. It was played i

33、n France by 1893; England in 1894; Australia, China, and India between 1895 and 1900; and Japan in 1900. From 1891 through 1893, a soccer ball was used to play basketball. The first basketball was manufactured in 1894. It was 32 in (81 cm) in circumference, or about 4 in (10 cm) larger than a soccer

34、 ball. The dedicated basketball was made of laced leather and weighed less than 20 oz (567 g). The first molded ball that eliminated the need for laces was introduced in 1948; its construction and size of 30 in (76 cm) were ruled official in 1949. The rule-setters came from several groups early in t

35、he 1900s. Colleges and universities established their rules committees in 1905, the YMCA and the Amateur Athletic Union (AAU) created a set of rules jointly, state militia groups abided by a shared set of rules, and there were two professional sets of rules. A Joint Rules Committee for colleges, the

36、 AAU, and the YMCA was created in 1915, and, under the name the National Basketball Committee (NBC) made rules for amateur play until 1979. In that year, the National Federation of State High School Associations began governing the sport at the high school level, and the NCAA Rules Committee assumed

37、 rule-making responsibilities for junior colleges, colleges, and the Armed Forces, with a similar committee holding jurisdiction over womens basketball. Until World War II, basketball became increasingly popular in the United States especially at the high school and college levels. After World War I

38、I, its popularity grew around the world. In the 1980s, interest in the game truly exploded because of television exposure. Broadcast of the NCAA Championship Games began in 1963, and, by the 1980s, cable television was carrying regular season college games and even high school championships in some

39、states. Players like Bill Russell, Wilt Chamberlain, and Lew Alcindor (Kareem Abdul-Jabbar) became nationally famous at the college level and carried their fans along in their professional basketball careers. The womens game changed radically in 1971 when separate rules for women were modified to mo

40、re closely resemble the mens game. Television interest followed the women as well with broadcast of NCAA championship tourneys beginning in the early 1980s and the formation of the WNBA in 1997. Internationally, Italy has probably become the leading basketball nation outside of the United States, wi

41、th national, corporate, and professional teams. The Olympics boosts basketball internationally and has also spurred the womens game by recognizing it as an Olympic event in 1976. Again, television coverage of the Olympics has been exceptionally important in drawing attention to international teams.

42、The first professional mens basketball league in the United States was the National Basketball League (NBL), which debuted in 1898. Players were paid on a per-game basis, and this league and others were hurt by the poor quality of games and the ever-changing players on a team. After the Great Depres

43、sion, a new NBL was organized in 1937, and the Basketball Association of America was organized in 1946. The two leagues came to agree that players had to be assigned to teams on a contract basis and that high standards had to govern the game; under these premises, the two joined to form the National

44、 Basketball Association (NBA) in 1949. A rival American Basketball Association (ABA) was inaugurated in 1967 and challenged the NBA for college talent and market share for almost ten years. In 1976, this league disbanded, but four of its teams remained as NBA teams. Unification came just in time for

45、 major television support. Several womens professional leagues were attempted and failed, including the Womens Professional Basketball League (WBL) and the Womens World Basketball Association, before the WNBA debuted in 1997 with the support of the NBA. James Naismith, originally from Al-monte, Onta

46、rio, invented basketball at the International YMCA Training School in Springfield, Massachusetts, in 1891. The game was first played with peach baskets (hence the name) and a soccer ball and was intended to provide indoor exercise for football players. As a result, it was originally a rough sport. A

47、lthough ten of Naismiths original thirteen rules remain, the game soon changed considerably, and the founder had little to do with its evolution. The first intercollegiate game was played in Minnesota in 1895, with nine players to a side and a final score of nine to three. A year later, the first fi

48、ve-man teams played at the University of Chicago. Baskets were now constructed of twine nets but it was not until 1906 that the bottom of the nets were open. In 1897, the dribble was first used, field goals became two points, foul shots one point, and the first professional game was played. A year l

49、ater, the first professional league was started, in the East, while in 1900, the first intercollegiate league began. In 1910, in order to limit rough play, it was agreed that four fouls would disqualify players, and glass backboards were used for the first time. Nonetheless, many rules still differe

50、d, depending upon where the games were played and whether professionals, collegians, or YMCA players were involved. College basketball was played from Texas to Wisconsin and throughout the East through the 1920s, but most teams played only in their own regions, which prevented a national game or aud

51、ience from developing. Professional basketball was played almost exclusively in the East before the 1920s, except when a team would barnstorm into the Midwest to play local teams, often after a league had folded. Before the 1930s very few games, either professional or amateur, were played in facilit

52、ies suitable for basketball or with a perfectly round ball. Some were played in arenas with chicken wire separating the players from fans, thus the word cagers, others with posts in the middle of the floor and often with balconies overhanging the corners, limiting the areas from which shots could be

53、 taken. Until the late 1930s, all players used the two-hand set shot, and scores remained low. Basketball in the 1920s and 1930s became both more organized and more popular, although it still lagged far behind both baseball and college football. In the pros, five urban, ethnic teams excelled and pla

54、yed with almost no college graduates. They were the New York Original Celtics; the Cleveland Rosenblums, owned by Max Rosenblum; Eddie Gottliebs Philadelphia SPHAs (South Philadelphia Hebrew Association); and two great black teams, the New York Renaissance Five and Abe Sapersteins Harlem Globetrotte

55、rs, which was actually from Chicago. While these teams had some notable players, no superstars, such as Babe Ruth, Jack Dempsey, or Red Grange, emerged to capture the publics attention as they did in other sports of the period. The same was true in college basketball up until the late 1930s, with co

56、aches dominating the game and its development. Walter Doc Meanwell at Wisconsin, Forrest Phog Allen at Kansas, Ward Piggy Lambert at Purdue, and Henry Doc Carlson at Pittsburgh all made significant contributions to the games development: zone defenses, the weave, the passing game, and the fast break. In the decade preceding World War II, five events changed college basketball and allowed it to become a major spectator sport. In 1929, the rules committee reversed a decision that would have outlawed dribbling and slowed the game considerably. Five years later, promoter Edward Ned Irish st

展开阅读全文
温馨提示:
1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
2: 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
3.本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!