最新电大开放教育C++语言程序设计期末复习题资料小抄【含答案】

上传人:仙*** 文档编号:31310279 上传时间:2021-10-11 格式:DOC 页数:12 大小:80.50KB
收藏 版权申诉 举报 下载
最新电大开放教育C++语言程序设计期末复习题资料小抄【含答案】_第1页
第1页 / 共12页
最新电大开放教育C++语言程序设计期末复习题资料小抄【含答案】_第2页
第2页 / 共12页
最新电大开放教育C++语言程序设计期末复习题资料小抄【含答案】_第3页
第3页 / 共12页
资源描述:

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

1、电大C+语言程序设计期末复习题及答案小抄资料一、单项选择题1、 面向对象程序设计数据与_放在一起,作为一个相互依存、不可分割的整体来处理。A、对数据的操作B、信息C、数据隐藏D、数据抽象2、 已知:int a=1,b=2,c=3,d=4,则表达式ab?a:cd?c:d 的值为_。A、1B、2C、3D、43、下列while循环的次数是_。while( int i=0 ) i- -;A、0B、1C、5D、无限4、以下程序的输出结果是_。#include fuc( char* s) char* p=s; while( *p) p+; return (p-s);main() coutfuc(ABCDE

2、F); A、3B、6C、8D、05、_的功能是对对象进行初始化。A、析构函数B、数据成员C、构造函数D、静态成员函数6、下列引用的定义中,_是错误的。A、int i;B、int i;C、float i;D、char d;int& j=i; int &j; float& j=i;j=i; char &k=d;7、若类A和类B的定义如下:class A int i,j;public: void get(); /.;class B:public A int k;public: make(); /.;void B:make() k=i*j;则上述定义中,_是非法的表达式。A、void get();B、

3、int k;C、void make();D、k=i*j;8、以下程序段_。int x = -1;do x = x*x;while( !x );A、是死循环B、循环执行2次C、循环执行1次D、有语法错误9、对定义重载函数的下列要求中,_是错误的。A、要求参数的个数不同B、要求参数中至少有一个类型不同C、要求参数个数相同时,参数类型不同D、要求函数的返回值不同10、一个_允许用户为类定义一种模式,使得类中的某些数据成员及某些成员函数的返回值能取任意类型。A、函数模板B、模板函数C、类模板D、模板类(Key:1-5:AAABC6-10:BDCDC)二、填空题1、在C+类中可以包含 、 和 三种具有不

4、同访问控制权的成员。(Key:公有或public,保护或protected,私有或private)2、以下程序的执行结果是_。#include void func( int );void func( double );void main( ) double a=88.18; func(a); int b=97; func(b); void func( int x ) coutxendl;void func( double x ) coutx,;(Key: 88.18,97)3、类中的数据和成员函数默认访问类型为_。(Key:私有或private)4、以下程序的执行结果是_。#include u

5、sing namespace std;f(int b,int n)int i,r=1;for( i=0;i=n;i+ )r=r*bi;return r;int _tmain()int x,a = 2,3,4,5,6,7,8,9;x=f(a,3);coutx=xendl;return 0;(Key: x=120)5、在类内部定义的_数据不能被不属于该类的函数来存取,定义为_的数据则可以在类外部进行存取。(Key:private或 私有 或 protected 或 保护;public 或 公有)6、下列程序输出的结果是_。#include using namespace std;void sub(

6、 char a,char b )char c=a;a=b;b=c;void sub( char* a,char b )char c=*a;*a=b;b=c;void sub( char* a,char* b )char c=*a;*a=*b;*b=c;int _tmain() char a=A,b=B;sub(&a,&b);coutabendl;return 0;(Key: BA)7、下列程序输出的结果是_。#include using namespace std;void Exchange( int* pFirst,int* pLast )if( pFirstpLast )int Chang

7、e = *pFirst;*pFirst = *pLast;*pLast = Change;Exchange(+pFirst,-pLast);void Print( int Integer,int HowMany)for( int Index=0; IndexHowMany; Index+ )coutIntegerIndex ;coutendl;int _tmain()int Integer = 1,2,3,4;Exchange(&Integer0,&Integer3);Print(Integer,4);return 0;(Key: 4 3 2 1)8、下列程序输出的结果是_。#include

8、using namespace std;int _tmain()int nInteger = 5, &rInteger = nInteger;rInteger = nInteger+1;coutnInteger,rIntegerendl;return 0;(Key: 6,6)9、_是一种特殊的成员函数,它主要用来为对象分配内存空间,对类的数据成员进行初始化并进行对象的其他内部管理操作。(构造函数)10、下列程序输出的结果是_。#include using namespace std;int _tmain()int x=2,y=3,z=4;cout( xy ) & ( !z ) | (x*y)

9、)endl;return 0;(Key:1)三、程序分析:给出程序运行后的输出结果(每小题5分,共20分)1、#include using namespace std;int _tmain() int x=1,y=2,z=3; x+=y+=z; cout(xy?y:x),; cout(xy?x+:y+),; coutyendl; return 0;Key: 6,5,6 2、#include using namespace std;void func( int b );void main() int a = 5,6,7,8 ,i; func(a); for( i=0;i4;i+ ) coutai

10、 ;void func( int b ) int j; for( j=0;j4;j+ ) bj = 2*j;Key: 0 2 4 63、#include using namespace std;class CSampleint i;public:CSample(void);CSample(void);CSample(int val);void Print(void);CSample:CSample(void)coutConstructor1endl;i=0;CSample:CSample(int val)coutConstructor2endl;i=val;void CSample:Print

11、(void)couti=iendl;CSample:CSample(void)coutDestructorendl;int _tmain() CSample a,b(10);a.Print();b.Print();return 0;Key: Constructor1Constructor2i=0i=10DestructorDestructor4、#include using namespace std;class CDataprotected:int nInteger;public:CData( int Integer );CData( void );void Print(void);CDat

12、a:CData( int Integer ): nInteger(Integer)coutConstructing a dataendl;CData:CData( void )coutDestructing a dataendl;void CData:Print(void)coutThe data is nIntegerendl;class CNumber :public CDataprotected:double fNumber;public:CNumber(int Integer,double Number);CNumber(void);void Print(void);CNumber:C

13、Number( int Integer,double Number ): CData( Integer ), fNumber(Number)coutConstructing a numberendl;CNumber:CNumber( void )coutDestructing a numberendl;void CNumber:Print(void)CData:Print();coutThe number is fNumberendl;int _tmain()CNumber Number(1,3.8);Number.Print();return 0;Key: Constructing a da

14、taConstructing a numberThe data is 1The number is 3.8Destructing a numberDestructing a data四、根据要求完成程序1、完成以下程序,求1!+2!+3!+4!+5!+6!+7!+8!+9!+10!之和。#include using namespace std;int _tmain() long Term=_ ,Sum=_;for( int Index=1;Index=_;Index+)Term *=_;Sum +=_;coutSum of factorial from 1 to 10 is ; coutSum

15、endl;return 0; Key:1 0 10 Index Term2、完成下面程序,计算三角形和正方形的面积。设三角形和正方形的宽为fWidth,高为fHeight,则三角形的面积为fWidth*fHeigth/2。#include using namespace std;class CShapepublic:CSquare:CSquare(double Width,double Height):_double CSquare:Area(void)_;int _tmain() CTriangle Triangle(16,8); coutThe area of triangle is Tr

16、iangle.Area()endl; CSquare Square(13,8); coutThe area of square is Square.Area()endl; return 0; Key: fWidth(Width) CShape(Width,Height) return fWidth*fHeight/2 CShape(Width,Height) return fWidth*fHeight五、用面向对象方法设计一个阶乘类CFactorial,在CFactorial类的构造函数CFactorial(long Integer)中,将Integer的值赋给nInteger;在主函数int

17、 _tmain(),键盘输入任一整数Integer,以Integer的值为实际参数构造一个阶乘对象Factorial,调用对象Factorial的相应成员函数输出nInteger的阶乘值fFactorial。完成以下函数的代码设计:(1)、设计构造函数CFactorial(long Integer),求出nInteger的阶乘值fFactorial。若nInteger没有阶乘值,则fFactorial赋值为0。(2)、设计CFactorial类的成员函数void Print(void),输出nInteger的阶乘值fFactorial。若nInteger没有阶乘,则输出nInteger没有阶乘

18、的信息。#include using namespace std;class CFactorialpublic:CFactorial(long Integer);protected:long nInteger;float fFactorial;public:void Print(void);CFactorial:CFactorial(long Integer) : nInteger(Integer)/作答处void CFactorial:Print(void)/作答处int _tmain()long Integer;coutInteger; CFactorial Factorial(Integ

19、er);Factorial.Print();return 0; Key: 解:参考程序:#include using namespace std;class CFactorialpublic:CFactorial(long Integer);protected:long nInteger;float fFactorial;public:void Print(void);CFactorial:CFactorial(long Integer) : nInteger(Integer)if( nInteger1 ) /1分fFactorial*=Integer; /1分Integer-; /1分voi

20、d CFactorial:Print(void)if( fFactorial ) /0.5分coutThe factorial of nInteger is fFactorialendl; /1分else /0.5分coutThere is not any factorial for nIntegerendl;/1分int _tmain()long Integer;coutInteger; CFactorial Factorial(Integer);Factorial.Print();return 0; 请您删除一下内容,O(_)O谢谢!2016年中央电大期末复习考试小抄大全,电大期末考试必备

21、小抄,电大考试必过小抄Basketball can make 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)

22、annual tournament and the National 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

23、heart of the game is the playing 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-

24、balls range in size from 28.5-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 circumf

25、erence. The covering of the ball 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 base

26、d on the height of the balls bounce. 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 heigh

27、t of 6 ft (1.80 m) measured from 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 spher

28、e commands considerable attention. 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

29、the International Training School 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 coordin

30、ation required in handling a ball. 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 Na

31、ismith asking for copies of the 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

32、 the players was restricted against 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 o

33、f an allotted time period wins. 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.

34、 The team size became generally 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 b

35、asketball enthusiasts played in 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 Canad

36、a immediately. It was played in 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 i

37、n (10 cm) larger than a soccer 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

38、from several groups early in the 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 Rul

39、es Committee for colleges, the 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 th

40、e NCAA Rules Committee assumed 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 col

41、lege levels. After World War II, 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

42、 school championships in some 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

43、 for women were modified to more 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 ou

44、tside of the United States, with 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 atte

45、ntion to international teams. 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

46、a team. After the Great Depression, 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 t

47、wo joined to form the National 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. Uni

48、fication came just in time for 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,

49、originally from Al-monte, Ontario, 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 w

50、as originally a rough sport. Although 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 thr

51、ee. A year later, the first five-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 professi

52、onal game was played. A year later, 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. Nonethe

53、less, many rules still differed, 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 pr

54、evented a national game or audience 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 a

55、mateur, were played in facilities 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 a

56、reas from which shots could be 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,

57、 ethnic teams excelled and played 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 Globetrotters, which was actually from Chicago. While these teams had some notable players, no superstars, such as Babe Ruth, Jack Dempsey, or Red Grange,

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