计算机二级

3773考试网计算机等级考试计算机二级正文

2013计算机二级考试C++模拟试题十二及答案3

来源:2exam.com 2013-9-29 23:30:07

19.this指针是C++实现什么的一种机制?( )
  A.抽象 
  B.封装 
  C.继承 
  D.重载
  【参考答案】 B
  20.下列程序的输出结果是( )
  #include
  class Myclass{  来源:
  public:Myclass(int i=0,int j=0) 
  { 
    y=j; 
  }
  void show(){cout<<″x=″<X″ ″″y="″<  void show()const{cout<<″x=″<<″ ″<<″y=″<  privated: 
  int x;int y; 
  }; 
  void main() 
  {yclass my1(3,4); 
  const my2(7,8); 
  my1.show();my2.show();} 
  A.x=4,y=3;x=7,y=8 
  B.x=3,y=4;x=7,y=8 C.x=7,y=8;x=4,y=3 
  D.x=8,y=7;x=7,y=8 
  【参考答案】 A
  21.在C++语言中,打开一个文件就是将这个文件与一个什么建立关联( ) 
  A.流 
  B.类 
  C.结构 
  D.对象 
  【参考答案】 A 
  22.执行语句for(i=1;i++<4;);,后变量i的值是( ) 
  A.3 
  B.4 
  C.5 
  D.不定 
  【参考答案】 C 
  23.下列哪个是C++语言的有效标识符?( ) 
  A._No1 
  B.No.1
  C.12345 
  D.int 
  【参考答案】 A 
  24.下列程序的执行结果为( ) 
  #include
  void main()
  {int a=3,b=0;
  int *p=&a;
  b=+a++;
  cout<<*p<<″,″<B  A.3,4 
  B.4,3 C.3,-4 
  D.4,4
  【参考答案】 B
  25.下列选项,不正确的是( )
  A.for(int a=1;a<=10;a++); 
  B.int a=1;
  do
  {a++}
  while(a<=10)
  C.int a=1; 
  D.for(int a=1;a<=10;a++)a++;
  while(a<=10)
  {a++}
  【参考答案】 B
  26.下列程序的输出结果为( )
  #include
  void main()
  {char *a[]={″hello″,″the″,″world″};
  char **pa=a;
  pa++;
  cout<<*pa< 
  A.hello 
  B.the C.world 
  D.hellotheworld
  【参考答案】 B
  27.下列程序的输出结果是( )
  #include
  int min(int a,int b)
  {if(a 
  else return b;
  return 0;}
  void main()
  {cout<  
  A.0 
  B.1 
  C.2 
  D.3
  【参考答案】 B

触屏版 电脑版
3773考试网 琼ICP备12003406号-1