下列语句输出结果为( )。public class test{public static void main(String args[]){byte b=OXA;System.out.println(b);}}
A.OXA
B.A
C.1
D.10
第1题:
下列程序的输出结果为2,横线处应添加语句( )。 #include<iostream> using namespace std; { public: ______void fun(){cout<<1;} }; class TestClass2:public TestClass1 { public:void fun(){cout<<2;) }; int main() { TestClass1 *p=new TestClass2; p->fun(); delete p; Teturn 0; }
A.public
B.private
C.virtual
D.protected
第2题:
下列程序的输出结果是______。 #include<iostream> using namespace std; class Test( public: Test() {cnt++;} ~Test() {cnt--;} static int Count(){return cnt;} private: static int cnt; }; int Test::cnt=0; int main() { cout<<Test::Count()<<""; Test t1,t2; Test*pT3=new Test; Test*pT4=new Test; cout<<Test::Count()<<""; delete pT4; delete pT3; cout<<Test::Count()<<end1; return 0; }
A.024
B.042
C.420
D.240
第3题:
第4题:
要使程序执行后的输出结果为ABCD,应在横线处添加语句( )。 #include<iostream> using namespace std; { public:A(){cout<<'A';} }; class B=______ { public:B(){cout<<'B';} }; class C:virtual public A { public:C(){cout<<'C';} }; class D:public B,public C { public:D(){cout<<'D';} }; void main(){D obj;}
A.public A
B. private A
C.protected A
D.virtual public A
第5题:
下列代码执行之后,输出的结果为______。 public class ex34 { public static void main(String[] args) { byte a=-128; byte b=(a|127)>0?(byte)(~a>>128:(byte)(~a<<128); System. out. Println(b); } }
A.-128
B.128
C.127
D.-127
第6题: