1
2
3
4
第1题:
有如下类声明: class XA{ int X; public: XA(int n){x=n;} }; class XB:publicXA{ int y; public: XB(int a,int b); ); 在构造函数XB的下列定义中,正确的是( )。
A.XB::XB(int a,int b):x(a),y(b){}
B.XB::XB(int a,int b):XA(a),y(b){}
C.XB::XB(int a,int b):x(a),XB(b){}
D.XB::XB(int a,int b):XA(a),XB(b){}
第2题:
A.1
B.2
C.3
D.4
第3题:
有如下类声明: class TestClass int i; private:int j; protected:int k; public:int m,n; 其中,私有成员的数量为( )。
A.0
B.1
C.2
D.3
第4题:
有如下类声明: c1ass TeStClass { int i; private:int j; protected:int k; public:int m,n; }; 其中,私有成员的数量为( )。
A.0
B.1
C.2
D.3
第5题:
若有如下定义和声明: struct s { int m;char ch;double x; union t {char a[6];int b[3];}tt;}ss; 则sizeof(struets)的值是( )
A.6
B.14
C.17
D.20
第6题:
如下类定义中包含了构造函数和拷贝构造函数的原型声明,请在横线处填写正确的内容,使拷贝构造函数的声明完整。
Class myClass{
private:
int data;
public:
myClass(int value);//构造函数
myClass(const【 】anotherObject);//拷贝构造函数
}
第7题:
已知一个函数的定义如下:double fun(int x,double y){⋯⋯}则该函数正确的函数原型声明为()
第8题:
下面声明数组的写法错误()
第9题:
下面的哪些声明是合法的?()
第10题:
现有: 1. interface Altitude { 2. //insert code here 3. } 和4个声明: int HIGH = 7; public int HIGH = 7; abstract int HIGH = 7; interface int HIGH = 7; 分别插入到第2行,有多少行可以编译?()
第11题:
1
2
3
4
第12题:
0
1
2
3
4
第13题:
现有如下程序段,则程序段的输出结果为 【16】 。
#include "stdio.h"
int fun()
{static int k;
return k;}
main()
{int m;
m=fun();
printf("%d\n",m);}
第14题:
A.Line1
B.Line3
C.Line4
D.Line5
第15题:
有如下类声明: class SAMPLE { int n; public: SAMPLE(int i=0):n(i) { } void setValue(int nO); }; 下列关于getValue 成员函数的实现中,正确的是
A.SAMPLE::setValue(int nO){ n=nO;}
B.void SAMPLE::setValue(int nO){ n=nO;}
C.void setValue(int nO){ n=nO;}
D.(int nO){ n=nO;}
第16题:
有如下类声明: class XA { int x; public: XA(int n) {x=n;} }; class XB: public XA{ int y; public: XB(int a,int b); };在构造函数XB的下列定义中,正确的是______。
A.XB:: XB(int a, int b):x(a),y(b) { }
B.XB::XB(int a, int b):XA(a),y(b){}
C.XB::XB(int a,int b):x(a),XB(b)i}
D.XB::XB(int a,int b):XA(a),XB(b){}
第17题:
有如下类声明: class SAMPLE { int n: public: SAMPLE(int i=0):n(i){} void setValue(int nO); }; 下列关于9etValue成员函数的定义中,正确的是( )。
A.SAMPLE::setValue(int nO){n=n0;}
B.void SAMPLE::setValue(int胡){n=n0;
C.void setValue(int nO){n=n0;}
D.setValue(int nO){n=n0;}
第18题:
现有如下程序段
#include "stdio.h"
int *fun(int *a,int *b)
{int c;
c=*a%*b;
return &c;}
main()
{int a=5,b=19,*c;
c=fun(&a,&b);
printf("%d\n",++*c);}
则程序段执行后的结果为
A.8
B.7
C.6
D.5
第19题:
现有如下五个声明: int a_really_really_really_long_variable_name = 5; int _hi =6; int big = Integer.getInteger("7"); int $dollars = 8; int %percent = 9; 有几个可以通过编译?()
第20题:
现有如下五个声明: Linel: int a_really_really_really_long_variable_name=5 Line2: int _hi=6; Line3: int big=Integer. getlnteger("7”); Line4:int $dollars=8; line5: int %opercent=9; 哪行无法通过编译?()
第21题:
现有 public class Parentt public void change (int x){) ) public class Child extends Parent{ //覆盖父类change方法 } 下列哪个声明是正确的覆盖了父类的change方法?()
第22题:
protected void change (int x){}
public void change(int x, int y){}
public void change (int x){}
public void change (String s){}
第23题:
Line1
Line3
Line4
Line5
第24题:
2
3
4
5
1