执行下列程序段之后,输出的结果是( )。public class Test{ public static void main(String[ ] args) { byte a = 2; short b = 3; long c = 4; c=a%b*4%b; System.out.println(c) ; } }
A.2
B.1
C.-1
D.-2
第1题:
执行下列程序段之后,输出的结果是______。 public class Test8 { public StatiC void main (String[] args) { byte a=2; short b=3; long c=4; c=a%b*4%b; System.out.println (c); } }
A.2
B.1
C.-2
D.-1
第2题:
有如下程序: #include <iostream> using namespace std; class Test { public: Test() {n+=2; } ~Test() {n-=3; } static int getNum() {return n; } private: static int n; }; int Test::n=1; int main() { Test* p=new Test; delete p; cout<<"n="<<Test::getNum()<<endl; return 0; } 执行该程序的输出结果是( )。
A.n=0
B.n=1
C.n=2
D.n=3
第3题:
第4题:
执行下列程序段之后,输出的结果是( )。 public class Test{ public static void main(String[ ] args) { byte a = 2; short b = 3; long c = 4; c=a%b*4%b; System. out. println(C); } }
A.2
B.1
C.-1
D.-2
第5题:
下列程序的输出结果是______。 #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