网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

如果有一下的程序代码: int[] arr1={1,2,3}; int[] arr2=new int[arr1.length]; arr2=arr1; for(int value:arr2){ System.out.printf("%d",value); }

A.执行时显示123

B.执行时显示12300

C.执行时出现ArrayIndexOutOfBoundException错误

D.编译失败


参考答案和解析
B子函数Subf(ByValx,ByRefy,z)中x值通过值传递,y,z是传引用,子函数执行后b,
更多 “如果有一下的程序代码: int[] arr1={1,2,3}; int[] arr2=new int[arr1.length]; arr2=arr1; for(int value:arr2){ System.out.printf("%d",value); }A.执行时显示123B.执行时显示12300C.执行时出现ArrayIndexOutOfBoundException错误D.编译失败” 相关考题
考题 有如下程序 include using namespace std; int i=1; class Fun { 有如下程序 #include <iostream> using namespace std; int i=1; class Fun { public: static int i; int value( ){ return i-l;} int value( )const { return i+1;} }; int Fun::i=2; int main( ){ int i=3; Fun funl; const Fun fun2; ___________ return 0; } 若程序的输出结果是: 123 则程序中下划线处遗漏的语句是A.cout<<funl.value( )<<Fun::i<<fun2.value( );B.cout<<Fun::i<<funl.value()<<fun2.value( );C.cout<<funl.value( )<<fun2.value( )<<Fun::i;D.cout<<fun2.value( )<<Fun::i<<fun1.value( );

考题 类MyClass的定如下,若要对value赋值,则下面语句正确的是( )。 class MyClass { public: MyClass(){} MyClass(int i){value=new int(i);} int*value; };A.MyClass my;my.value=10;B.MyClass my;*my.value=10;C.MyClass my;my.*value=10;D.MyClass my(10);

考题 下列数组定义语句错误的是( )。A.k%=10Dim Arr(k)B.Const k%=10Dim Arr(k)C.Dim Arr1(10) As IntegerDim Arr2 (10)D.Dim Arr1(1 To 10)Dim Arr2(1 To 10, 2 To 11)

考题 有如下程序 include using namespace std;int i=1;class Fun {public:static int i;i 有如下程序 #include <iostream>using namespace std;int i=1;class Fun {public:static int i;int value(){ return i-1;}int value()const{ return i+1;}};int Fun:: i=2;int main() {int i=3;Fun fun1;const Fun fun2;______________________return ();}若程序的输出结果是:123A.cout<<fun1.value()<<Fun:: i<<fun2.value();B.cout<<Fun::i<<fun1.value()<<fun2.value();C.cout<<fun1. value()<<fun2.value()<<Fun:: i;D.cout<<fun2.value()<<Fun:: i<<fun 1.value();

考题 求任意一个数(用16位二进制码表示)的补码。 main( ) { unsigned int a; 【】 ; scanf("%O", a);printf("%o\n",getbits(a));}unsigned int getbits(value)unsigned int value;{unstgned int z;z=【 】 ;if(z==0100000)【 】 ;elsez=value;return(z);}

考题 关于函数声明,下面语法错误的是() A. func f(a, b int) (value int, err error)B. func f(a int, b int) (value int, err error)C. func f(a, b int) (value int, error)D. func f(a int, b int) (int, int, error)

考题 在窗体上画一个命令按钮Command1,然后编写如下代码: Private Sub Command1_Click() Dim Arr1(10) As Integer, Arr2(10)As Integer n=3 For i = 1 To 5 Arr1 (i)=i Arr2(n)=2 * n+i Next i Print Arr2(n); Art1 (n)End Sub运行程序后,单击命令按钮,输出结果是( )。A.11 3B.3 11C.13 3D.3 13

考题 下列程序的运行结果是【 】。 include class SomeClass { public: SomeClass(int va 下列程序的运行结果是【 】。include <iostream. h>class SomeClass{public:SomeClass(int value) { some_value=value;};void show_data(void) { cout<<data<<"<<~some_value<<endl; };static void set_data(int value) {data=value; }private:static int data;int some_value};int SomeClass::datavoid main(void){SomeClass my_class(1001),your_class(2002);your_class. set_data(4004);my_elass. show_data()}

考题 使用VC6打开考生文件夹下的工程RevProj3。此工程包含一个源程序文件 RevMain3.cpp。阅读文件中的程序代码,找出程序中的错误,并改正。源程序文件RevMain3.cpp清单如下://RevMain3.cppinclude<iostream>using namespace std;class MyClass{public:/* * * * * * * * *found * * * * * * + * * */void MyClass(int a){ value=a;}int Max(int x,int y){if(x>y)return x>y?x:y;elsereturn y>value?y:value;}/* * * * * * * * *found * * * * * * * * * */~MyClass(int a){value=a;}private:int value;};int main(){MyClass my(10);cout<<my.Max(20,30)<<end1;return 0;}

考题 有如下程序:includeusing namespace std;int i=1;class Fun{public:static int i;int 有如下程序: #include<iostream> using namespace std; int i=1; class Fun { public: static int i; int value(){return i-1;} int value()const{return i+1;} }; int Fun::i=2; int main() { int i=3; Fun fun 1; const Fun fun2; ______ return 0; } 若程序的输出结果是: 123 则程序中横线处的语句是( )。A.cout<<fun1.value()<<Fun::i<<fun2.value();B.cout<<Fun::i<<fun1.value()<<fun2.value();C.count<<fun.value()<<fun2.value()<<Fun::i;D.cout<<fun2.value()<<Fun::i<<fun1.value();

考题 在窗体上画一个命令按钮Command1,然后编写如下代码: Privae Sub Command1_Click() Dim Arr1(10) As Integer,Arr2(10) As Integer n=3 For i=1 To 5 Arr1(i)=i Art2(n)=2*n+i Next i Print Arr2(n);Arr1(n) End Sub 运行程序后,单击命令按钮,输出结果是( )。A.11 3B.3 11C.13 3D.3 13

考题 已知Value是一个类,value是Value的一个对象。下列以非成员函数形式重载的运算符函数原型中,正确的是A.Value operator+(Value v, int i);B.Value operator+(Value v=value, int i);C.Value operator+(Value v, int i=0);D.Value operator+(Value v=value, int i=0);

考题 下列程序用于打印出ASCⅡ字符,其析构函数内的语句应为【 】。 include inelude 下列程序用于打印出ASCⅡ字符,其析构函数内的语句应为【 】。include<iostream. h>inelude<iomanip, h>template<class T>class Array{T * elems;int size;public:Array(int.s);~Array()T operator[](int)void perator=(T)};template<class T>Array<T>::Array(int s)size=s;elems=new T[size]for(int i=0;i<size;i++)elems[i]=0}template<celass T>Array<T>::~Array(){______template <class T>T Array<T>::operator[](int index){return elems[index];}template<class T>void Array<T>::operator=(T temp){for(int i=0;i<size;i++)elems[i]=temp;}void main(){int i,n=26;Array<int> arr1(n)Array<char> arr2(n)for(i=0;i<n;i++){ -.arr1[i]='a'+i;arr2[i]='a'+i;}cout<<"ASCII 字符"<<endl;for(i=0;i<n;i++)cout<<setw(8)<<arr1[i]<<setw(8)<<arr2[i]<<endl;}

考题 有如下类声明: class Base{ protected: int amount; public: Base(int n=0):amount(n){} int getAmountconst{retum amount;} }; class Derived:public Base{ protected: int value; public: Derived(int m,int n):value(m),Base(n){} int getDataconst{return value+amount;} }: 已知x是一个Derived对象,则下列表达式中正确的是( )。A.x.value+X.getAmountB.x.getData一x.getAmountC.x.getData一x.amountD.x.value+X.amount

考题 在窗体上画一个命令按钮(其Name属性为Command1),然后编写如下代码: Private Sub Command1_Click() Dim Arr1(10)As Integer,arr2(10)As Integer n=3 For i=1 To 5 Arr1(i)=i arr2(n)=2*n+i Next i Print arr2(n);Arr1(n) End Sub 程序运行后,单击命令按钮,输出结果是 ______。A.11 3B.3 11C.13 3D.3 13

考题 Q4 :int iVal1 = 0, iVal2 = 0;int * ipVal;ipVal = iVal1; What is the Value of ipVal = *ipVal =ipVal = (int*)iVal1; What is the Value of ipVal = *ipVal =iVal2 = (int)iVal1; What is the Value of ipVal = *ipVal =

考题 类MyClass的定义如下: class MyClass { public: MyClass(){} MyClass(int i) { value=new int(i); } int *value; }; 若要对类中的value赋值,则下面的语句中,正确的是( )。A.MyClass my;my.value=10;B.MyClass my;*my,value=10;C.MyClass my;my.*value=10;D.MyClass my(10);

考题 下列程序的运行结果是( )。 #includeiostream.h class Loeation{ private: int X,Y; public: void init(int=0,int=0); void valueX(int val){X=val;} int valueX{returnx;} void valueY(int val){Y=val;} int valueY{return Y;}}; void Location::init(int initX,int initY) {X=initX; Y=initY4} void main(X {Location A,B; A.init; B.value X(5); coutA.value XendlA.value Yendl; B.init(6,2); B.value Y(4); eoutB.value XendlB.value Yendl; }A.5 0 6 4B.0 0 6 4C.5 0 6 2D.0 0 6 2

考题 在窗体上画一个命令按钮和一个文本框,其名称分别为Command1和Text1,然后编写如下事件过程: Private Sub Command1 Click() Dim arr1(10), arr2(10) For i = 1 To 10 arr1(i) = 3 * i arr2(i) = arr1(i) * 3 Next i Text1.Text = Str (arr2(i / 2 - 0.1)) End Sub程序运行后,单击命令按钮,在文本框中显示的是______。A.36B.45C.54D.63

考题 以下有关数组定义的语句序列中,错误的是( )。A.Static arr1(3) arr1(1)=100 arr1(2)="Hello" arr1(3)=123.45B.Dim arr2() AsInteger Dim size As Integer Private Sub Command2_Click () size=InputBox("输入:") ReDim arr2(size) …… EndSubC.Option Base 1 Private Sub Command3 Click() Dim art3(3) As Integer …… End SubD.Dim n As Integer Private Sub Command4 Cliok() Dim arr4(n)As Integer …… End Sub

考题 Which code determines the int value foo closest to a double value bar?()  A、 Int foo = (int) Math.max(bar);B、 Int foo = (int) Math.min(bar);C、 Int foo = (int) Math.abs(bar);D、 Int foo = (int) Math.ceil(bar);E、 Int foo = (int) Math.floor(bar);F、 Int foo = (int) Math.round(bar);

考题 Given the following interface definition, which definitions are valid?()   interface I {   void setValue(int val);   int getValue();   }    DEFINITION a:   (a) class a extends I {  int value;   void setValue(int val) { value = val;  }   int getValue() {  return value;  }   }   DEFINITION b:   (b) interface b extends I {   void increment();   }   DEFINITION c:   (c) abstract class c implements I {   int getValue() {  return 0;  }  abstract void increment();   }   DEFINITION d:   (d) interface d implements I {  void increment();  }   DEFINITION e:   (e) class e implements I {  int value;   public void setValue(int val) { value = val; }  }  A、Definition a.B、Definition b.C、Definition c.D、Definition d.E、Definition e.

考题 int index = 1;   int foo = new int ;   int bar = foo [index];   int baz = bar + index;   What is the result?()A、 Baz has the value of 0B、 Baz has the value of 1C、 Baz has the value of 2D、 An exception is thrown.E、 The code will not compile.

考题 多选题Given the following interface definition, which definitions are valid?()   interface I {   void setValue(int val);   int getValue();   }    DEFINITION a:   (a) class a extends I {  int value;   void setValue(int val) { value = val;  }   int getValue() {  return value;  }   }   DEFINITION b:   (b) interface b extends I {   void increment();   }   DEFINITION c:   (c) abstract class c implements I {   int getValue() {  return 0;  }  abstract void increment();   }   DEFINITION d:   (d) interface d implements I {  void increment();  }   DEFINITION e:   (e) class e implements I {  int value;   public void setValue(int val) { value = val; }  }ADefinition a.BDefinition b.CDefinition c.DDefinition d.EDefinition e.

考题 单选题int index = 1;   int foo = new int ;   int bar = foo [index];   int baz = bar + index;   What is the result?()A  Baz has the value of 0B  Baz has the value of 1C  Baz has the value of 2D  An exception is thrown.E  The code will not compile.

考题 单选题int index = 1;  int [] foo = new int [3];  int bar = foo [index];  int baz = bar + index;   What is the result?()A  Baz has the value of 0B  Baz has the value of 1C  Baz has the value of 2D  An exception is thrown.E  The code will not compile.

考题 单选题Which code determines the int value foo closest to, but not greater than, a double value bar?()A  Int foo = (int) Math.max(bar);B  Int foo = (int) Math.min(bar);C  Int foo = (int) Math.abs(bar);D  Int foo = (int) Math.ceil(bar);E  Int foo = (int) Math.floor(bar);F  Int foo = (int) Math.round(bar);

考题 单选题已知Value是一个类,value是Value的一个对象。下列以非成员函数形式重载的运算符函数原形中,正确的是(  )。A Value operator+(Value v,int i);B Value operator+(Value v=value,int i);C Value operator+(Value v ,int i=0);D Value operator+(Value v=value,int i=0);