1. public class ArrayTest { 2. public static void main (String[]args) { 3. float f1[], f2[]; 4. f1 = new float [10]; 5. f2 = f1; 6. System.out.printIn (“f2[0]=” + f2[0]); 7. } 8. } What is the result?()
第1题:
A.Itprintsf2[0]=0.0
B.Itprintsf2[0]=NaN
C.Anerroratline5causescompiletofail.
D.Anerroratline6causescompiletofail.
E.Anerroratline6causesanexceptionatruntime.
第2题:
有如下程序 #include<iostream> using namespace std; class base { public: virtual void f1() { cout<<"F1Base"; } virtual void f2() { cout<<"F2Base"; } }; class derive:public base { void f1() { cout<<"F1 Derive"; } void f2(int x) { cout<<"F2 Derive"; } }; int main() { base obj1,*p; derive obj2; p=& obj2; p->f1(); p->f2(); return (); ) 执行后的输出结果是( )。
A.F1Derive F2Base
B.F1Derive F2Derive
C.F1Base F2Base
D.F1Base F2Derive
第3题:
以下程序的输出结果是( )。 include<stdio.h> void main() {int f,f1,f2,i; f1=0;f2=1; printf("%d%d",f1,f2); for(i=3;i<=5;i++) {f=-f1+f2,printf("%d",f); f2=f1;f1=f; } printf("\n"); }
第4题:
public class ArrayTest { public static void main (Stringargs) { float f1, f2; f1 = new float [10]; f2 = f1; System.out.printIn (“f2[0]=” + f2[0]); } } What is the result?()
第5题:
1. public class A { 2. void A() { 3. System.out.println(“Class A”); 4. } 5. public static void main(String[] args) { 6. new A(); 7. } 8. } What is the result?()
第6题:
1. public class ForBar { 2. public static void main(String []args) { 3. int i = 0, j = 5; 4. tp: for (;;) { 5. i ++; 6. for(;;) 7. if(i > --j) break tp; 8. } 9. system.out.printIn(“i = ” + i + “, j = “+ j); 10. } 11. } What is the result?()
第7题:
Iff1(t)←→F1(jω),f2(t)←→F2(jω),Then()
第8题:
public class test { public static void add3 (Integer i){ int val = i.intValue ( ); val += 3; i = new Integer (val); } public static void main (String args [ ] ) { Integer i = new Integer (0); add3 (i); system.out.printIn (i.intValue ( ) ); } } What is the result?()
第9题:
The program runs and prints “0”
The program runs and prints “1”
The program runs but aborts with an exception.
An error “possible undefined variable” at line 4 causes compilation to fail.
An error “possible undefined variable” at line 9 causes compilation to fail.
第10题:
It prints f2[0] = 0.0
It prints f2[0] = NaN
An error at line 5 causes compile to fail.
An error at line 6 causes compile to fail.
An error at line 6 causes an exception at runtime.
第11题:
f1(x)f2′(x)-f2(x)f1′(x)=0
f1(x)f2′(x)+f1′(x)f2(x)=0
f1(x)f2′(x)-f1′(x)f2(x)≠0
f1′(x)f2(x)+f2(x)f1(x)≠0
第12题:
It prints f2[0] = 0.0
It prints f2[0] = NaN
An error at line 5 causes compile to fail.
An error at line 6 causes compile to fail.
An error at line 6 causes an exception at runtime.
第13题:
C 程序写运行结果。
class A
{
public:
void f1()
{
printf("A::f1\r\n");
}
virtual void f2()
{
printf("A::f2\r\n");
}
void callfunc()
{
printf("A::callfunc\r\n");
f1();
f2();
}
};
class B :public A
{
public:
void f1()
{
printf("B::f1\r\n");
}
void f2()
{
printf("B::f2\r\n");
}
void callfunc()
{
printf("B::callfunc\r\n");
f1();
f2();
}
};
int main()
{
B *pB=new B;
pB->callfunc();
A *pA=pB;
pA->callfunc();
return 0;
}
第14题:
有如下程序 #include<iostream> using nameSpace std; class base { public: vinual void f1() { cout<<"F1 Base"; } virtual void f2() { cout<<"F2Base"; } }; class derive:public base { void f1() { cout<<"F1Derive"; } void f2(int x) { cout<<"F2Derive"; } }; int main() { base obj1,*p; derive obj2; p=&obj2; p—>f1(); p—>f2(); return 0; } 执行后的输出结果是
A.F1Derive F2Base
B.F1Derive F2Derive
C.F1Base F2Base
D.F1Base F2Derive
第15题:
第16题:
public class ArrayTest { public static void main(String[] args) { float fl[], f2[]; fl = new float[10]; f2 = f1; System.out.println(“f2[0]= “ + f2[0]); } } What is the result?()
第17题:
1. public class X { 2. public static void main (String[]args) { 3. int [] a = new int [1] 4. modify(a); 5. System.out.printIn(a[0]); 6. } 7. 8. public static void modify (int[] a) { 9. a[0] ++; 10. } 11. } What is the result?()
第18题:
public class Test { private static float[] f = new float[2]; public static void main(String args[]) { System.out.println(“f[0] = “ + f[0]); } } What is the result?()
第19题:
public class test ( private static int j = 0; private static boolean methodB(int k) ( j += k; return true; ) public static void methodA(int i)( boolean b: b = i < 10 | methodB (4); b = i < 10 || methodB (8); ) public static void main (String args[])( methodA (0); system.out.printIn(j); ) ) What is the result?()
第20题:
15,2
15,15
2,15
8,8
第21题:
It prints f2[0] = 0.0.
It prints f2[0] = NaN.
An error at line 5 causes compile to fail.
An error at line 6 causes compile to fail.
An error at line 6 causes an expectation at runtime.
第22题:
Compilation will fail.
The program prints “0”.
The program prints “3”.
Compilation will succeed but an exception will be thrown at line 3.
第23题:
The program prints “0”
The program prints “4”
The program prints “8”
The program prints “12”
The code does not complete.