网站大量收购闲置独家精品文档,联系QQ:2885784924

《面向对象程序设计语言C++》_期末考试试卷.doc

《面向对象程序设计语言C++》_期末考试试卷.doc

  1. 1、本文档共4页,可阅读全部内容。
  2. 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
《面向对象程序设计语言C》_期末考试试卷

《面向对象程序设计语言C++》 期末考试试卷 一、填空题 1、在字长为32位的机器中,sizeof(char)= 1 字节,sizeof(unsigned int)=4字节. 2、C++语法规定,任何变量在使用前必须先 定义 ;变量有两个值,一个是变量本身的值,另一个是变量的 地址 。 3、C++中任何一个数组的名字是一个 常量 指针,该指针的值是该数组 第0号元素 的地址。 4、函数调用时的参数传递主要分为单向传递和 双向 传递,前者的特点是 只能把实参对应的值依次传递给形参 。 5、函数重载时要求同名函数的参数 个数和参数类型 或返回值 (10) 不同,否则无法确定是哪个函数。 6、静态数据成员是类的所有对象中 共享 的成员,静态数据成员初始化与一般数据成员初始化 不同 。 二、写出程序的运行结果 1、#include iostream.h void main() { int a,b,c,d(5); c=2,c+=10; a =b=10; a * = 2; b / = 2; c % = 2; couta,b,cendl; } 20,5,0 2、#include iostream.h void main() { int a = 50 , b(0) ; b = ++a; couta,bendl; b = a++; couta,bendl; } 50,51 50,50 3、#include iostream.h void main() { int f = 2002 , x; if( f != 3) x = 2003 ; else x = 20 ; coutf,xendl; } 2002,2003 4、#include iostream.h void main() { int i=1,sum=0; while(i=10) sum+ = ++i; cout sum= sum , i= iendl; } 65,110 5、#include iostream.h void main() { int i; for(i=4 ; i=10 ; i++ ) { if (i%3= =0) continue; couti; } } 4,5,7,8,10 6、#include iostream.h void main() { char flag=c ; switch(flag) { case a :cout1endl ; case b :cout 2endl ; break; case c : cout 3endl ; default : cout 4endl ; break; } } 30 7、#include iostream.h void main() { static int b[][3] = { {1,2,3},{4},{5,6} }; b[0][2]=12,b[1][2]=18; cout **b\t**(b+1) \t**b+1\t*(*(b+1)+2) \n; cout b[0][2]+b[1][2]+b[2][2] endl; } 1 4 2 18 30 8、#include iostream.h void Swap( int a, int b); void main() { int x( 10 ), y( 7 ); coutx=x y=yendl; Swap( x , y ); coutx=x y=yendl; } void Swap(int a, int b) { int temp; temp = a ; a=b ; b=temp ; } 10 7 7,10 9、#include iostream.h int add(int a, int b); void main() { extern int x, y; coutadd(x,y)endl; x/=y; coutadd(x,y)endl; } int x(50),y(100); int add(int a, int b) { int s=a+b ; return s; } 150 100 10、#include iostream.h class A { public: A(); A(int i,int j); ~A(){coutDonstructor.\n;} void print(); p

文档评论(0)

xcs88858 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

版权声明书
用户编号:8130065136000003

1亿VIP精品文档

相关文档