有如下程序,运行时输出的结果是 ______。 Option Base 1 Private Sub Command1_Click() Dim a(3,3) As Integer For m=1 To 3 For n=1 To 3 a(m-1,n-1)=m+n+1 Next n Next m For m=0 To 2 For n=0 To 2 Print a(n,m); Next n Print Next m End Sub
A.0 1 2 1 2 3 2 3 4
B.3 4 5 4 5 6 5 6 7
C.1 3 5 3 5 7 5 7 9
D.2 4 6 4 6 8 6 8 10
第1题:
有如下程序: #include<iostream> usingnamespacestd; classBASE{ public: ~BASE(){cout<<"BASE";} }; classDERIVED:publicBASE{ public: ~DERIVED(){cout<<"DERIVED";} }; intmain(){DERIVEDx;return0;) 执行后的输出结果是( )。
A.BASE
B.DERlVED
C.BASEDERIVED
D.DERlVEDBASE
第2题:
有如下程序: #include <iostream> using namespace std; class BASE{ public: ~BASE() {cout<<"BASE"; } }; class DERIVED: public BASE { public: ~DERIVED() {cout<;"DERIVED"; } }; int main(){DERIVED x; return 0;} 执行后的输出结果是______ 。
A.BASE
B.DERIVED
C.BASEDERIVED
D.DERIVEDBASE
第3题:
有如下程序:
#include<iostream>
Usingnamespacestd;
classBase{
public:
Base(intx=O):valB(x){cout<<valB;)
~Base( ){cout<<valB;)
Private:
intvalB:
};
classDerived:publicBase{
public:
Derived(intX=0,inty=0):Base(x),valD(y)(cout<<valD;)
~Derived( ){cout<<valD;)
private:
intvalD;
};
intmain( ){
Derivedobj12(2,3);
return0;
}
运行时的输出结果是( )。
A.2332
B.2323
C.3232
D.3223
第4题:
有如下程序: #include<iostream> using namespace std; class Base{ int x; public: Base(int n=0):x(n){cout<<n;) int getX()const{return x;} }; class Derived:public Base{ int y; public: Derived(int m,int n):y(m,)Base(n){cout<<m;} Derived(int m):y(m){cout<<m;} }; int main(){ Derived d1(3),d2(5,7) return 0; }运行时的输出结果是
A.375
B.357
C.375
D.357
第5题:
有如下程序: #include<iostroam> using namespace std; class Base{ protected: Base{cout<<’A’;} Base(char C){cout<<c;} }; class Derived:public Base{ public: Derived(char C){tout<<C;} }; int main{ Derived dl(’B’); retum 0; } 执行这个程序的输出结果是( )。
A.B
B.BA
C.AB
D.BB
第6题:
有如下程序: #include<iostream> using namespace std; class BASE{ public: ~BASE(){cout<<"BASE";} }; class DERIVED:public BASE{ public: ~DERIVED(){cout<<"DERIVED";} }; int main(){DERIVED x;return 0;} 执行后的输出结果是( )。
A.BASE
B.DERIVED
C.BASEDERIVED
D.DERIVEDBASE