判断题Dim arrInt()as Integer=New Integer(2){}A 对B 错

题目
判断题
Dim arrInt()as Integer=New Integer(2){}
A

B


相似考题

1.本题中,用表格表现某个月的月历,其中标题是从Sunday到Saturday,表格中的各项是可以修改的。 import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.table.*; public class java2 ( public static void main(String[]args) { try{ UIManager.setLookAndFeel(UIManager.getSys- temLookAndFeelClassName): } catch(Exception e) JFrame. frame=new CalendarTableFrame; frame.setDefaultCloseOperation(JFrame.EXIT_ oN CLOSE); frame.show; } } clasgCalendarTableFrame. extends JFrame { private static final int WIDTH=500; private static final int HEIGHT=150: private cells= { {null,null,null,new Integer(1),new Integer (2),new Integer(3),new Integer(4)), {new Integer(5),new Integer(6),new Integer (7).new Integer(8),new Integer(9),new Integer (10),new Integer(11)), {new Integer(12),new Integer(13),new Integer (14),new Integer(15),new Integer(16),new Integer (17),new Integer(18)), {new Integer(19),new Integer(20),new Integer (21),new Integer(22),new Integer(23),new Integer (24),new Integer(25)), {new Integer(26),new Integer(27),new Integer (28),new Integer(29),new Integer(30),new Integer (31),null} }; private String[]columnNames={ "Sunday","Monday","Tuesday","Wednesday", "Thursday","Friday","Saturday" }; public CalendarTableFrame{ setTitle("java2"); setSize(WIDTH,HEIGHT); JTable table=new ; getContentPane.add(new JScrollPane(table), BorderLayout.CENTER); } }

参考答案和解析
正确答案:
解析: 暂无解析
更多“Dim arrInt()as Integer=New Integer(2){}”相关问题
  • 第1题:

    单击命令按钮时,下列程序代码的执行结果为( )。 Private Function FirProc(x As Integer,y As Integer,z As Integer) FirProc=2*x+y+3*z End Funcfion Private Function SecProc(x As Integer,y As Integer,z As Integer) SecProc=FirProc(z,x,y)+x End Funcfion Private Sub Command1_Click() Dim a As Integer Dim b As Integer Dim c As Integer a=2 b=3 c=4 Printf SecProc(c,b,a) End Sub

    A.21

    B.19

    C.17

    D.34


    正确答案:A

  • 第2题:

    单击命令按钮时,下列程序的执行结果为 Private Sub Command1_Click() Dim a As Integer,b As Integer,c As Integer a=2:b=3:C=4 Print P2(c,b,A)End Sub Private Function P1(x As Integer,y As Integer,z As Integer) P1=2 * X + y + 3 * z End Function Private Function P2(x As Integer,y As Integer,z As Integer) P2=P1(z,x,y) + X End Function

    A.21

    B.19

    C.17

    D.34


    正确答案:A
    解析:对于多个过程或函数依次调用和处理与简单过程调用处理一样,本题先调用函数P2,而函数P2又调用函数P1,结果返回的顺序是从P1到P2,P2计算后输出到调用的地方。

  • 第3题:

    下面正确使用动态数组的是( )。

    A.Dim arr( )As Integer … ReDim arr(3,5)

    B.Dim arr( )As Integer … ReDim arr(50)As String

    C.Dim arr( ) … RcDim arr(50)As Integer

    D.Dim arr(50)AS Integer … ReDim arr(20)


    正确答案:A
    A。【解析】定义动态数组使用Dim数组名[]As数组类型,不规定数组的大小。重定义后,可以定义数组的长度,但不能定义数组的类型。本题A选项正确。选项B中,重定义后不可改变数组类型。选项C中必须先定义数组类型,选项D中开始定义了数组长度,不是动态数组。

  • 第4题:

    以下有关数组定义的语句序列中,错误的是

    A.Static arrl(3) arr1(1)=100 arrl(2)="Hello" arrl(3)=123.45

    B.Dim arr2()As Integer Dim size As Integer Private Sub Command2_Click() size=InputBOX(“输入:”) ReDim arr2(size) ┄ End Sub

    C.Option Base 1 Private Sub Command3_Click() Dim arr3(3)As Integer ┄ End Sub

    D.Dim n As Integer Private Sub Command4_Click() Dim arr4(n)As Integer ┄ End Sub


    正确答案:D
    解析:本题考查动态数组的定义。A项定义了一个默认数组。B项定义了一个动态数组。C项直接定义。由于声明数组时不能通过变量声明数组长度,故D项是错误的。

  • 第5题:

    以下有关数组定义的语句序列中,错误的是 ______。

    A.Static arrl(3) arrl(1)=100 arrl(2)="Hello" arrl(3)123.45

    B.Dim arr2()As Integer Dim size As Integer Private Sub Command2_click() size=InputBox("输入:") ReDimarr2(size) End Sub

    C.Option Base1 Private Sub Command3_click() Dim arr3(3)As Integer End Sub

    D.Dim n As Integer Private Sub Command4_Click() Dim arr4(n)As Integer End Sub


    正确答案:D
    解析:在数组定义中,定义的数组元素个数不能是变量。而选项D中的n是一个变量。

  • 第6题:

    以下程序运行后,单击命令按钮,窗体显示的结果是 ______。 Private Function p1(x As Integer,y As Integel,z As Integer) p1=2*x+y+3*z End Function Private Function p2(x As Integer,y As Integer,z As Integer) p2=p1(2,y,x)+x End Function Private SubCommandl_Click() Dim a As Integer Dim b As Integer Dim c As Integer a=2:b=3:c=4 Print p2(c,b,A)

    End Sub

    A.19

    B.21

    C.22

    D.23


    正确答案:D
    解析:当程序执行到Print p2(c,b,a)语句时,首先调用函数过程p2,将实参c、b、a,的值4、3、2按顺序传递给p2的形参x、y、z,使形参x、y、z的值分别是4、3、2。当执行到函数过程p2中的语句p2=p1(z,y,x)+x时,又去调用函数过程p1,并将实参x、y、x的值2、3、4按顺序传递给形参x、y、z,使函数过程p1的形参x、y、z的值分别是2、3、4。于是执行p1中的语句p1=2*x+y+3*x=2*2+3+3*4=4+3+12=19。即函数过程p2中p1(2,y,x)的值为19,因此p2=p1(2,y,x)+x=19+4=23。该值返回给Command1_Click事件过程中的p2(c,b,a),所以窗体显示的值是23。

  • 第7题:

    阅读下面的程序; Function Func(x As Integer,y As Integer)As Integer Dim n As Integer Do While n < = 4 x=x + y n = n + 1 Loop Func=x End Function Private Sub Command1_Click() Dim x As Integet, y As Integer Dim n As Integer,z As Integer x=1 y=1 For n = 1 To 6 z=Func(x,y) Next n Print z End Sub 程序运行后,单击命令按钮,输出的结果为.

    A.16

    B.21

    C.26

    D.31


    正确答案:D
    解析:过程Func有两个参数,使用的是引用方式,参数和返回值均为整型,在命令按钮事件过程的For循环中调用Func过程,共循环6次,每次循环调用一次。两个过程中使用的变量(包括参数)基本相同,但由于是局部变量,不会发生冲突。无论在事件过程还是通用过程中,y的值始终保持不变,总等于1。在Func过程中,DoLoop循环共执行5次,通过变量n控制(从0~4),每次都执行x=x+1,因此,每调用一次Func过程,都使得x=x+5,并将返回值赋给事件过程中的变量z。6次调用中,循环变量n的计算过程为:1、2、3、4、5、6:返回值z的结果为:6、11、16、21、26、31。

  • 第8题:

    下列程序段的执行结果为______。 Dim m(3,3)As Integer Dim i As Integer Dim j As Integer Dim x As Integer For i=1 To 3 m(i,i)=i Next For i=0 T0 3 For j=0 To 3 x=x+m(i, j) Next Next Print x

    A.3

    B.4

    C.5

    D.6


    正确答案:D
    解析:通过第一个以i为循环变量的循环,令a(1,1)=1,a(2,2)=2,a(3,3)=3。然后通过双重循环,求数组a中所有元素的和并将结果赋值给x,由于在数组a中除了a(1,1)、a(2,2)和a(3,3)外其他元素都为0,所以x=1+2+3=6。

  • 第9题:

    下列各语句中,正确的是

    A) Dim x As Variant=Array(1, 2,3, 4. 5)

    B)Dim xo As Integer: x=Array (1, 2:3: 4.5)

    C)Dim x As ariant: x=Array(1: abc: 2,3. 41)

    D) Dim x As Integer: x=Arra (1, 2, 3+25)


    正确答案:C

  • 第10题:

    Dim arrInt()as Integer=New Integer(2){}


    正确答案:正确

  • 第11题:

    Dim arrInt()as Integer=New Integer(2){0,1,2}


    正确答案:正确

  • 第12题:

    判断题
    Dim arrInt()as Integer=New Integer(2){}
    A

    B


    正确答案:
    解析: 暂无解析

  • 第13题:

    (13)单击命令按钮时,下列程度的执行结果是 Private Sub Command1_Click() Dim a As Integer,b As Integer,c As Integer a=2:b=4:c=6 Call S2(a,b) Print"a=";a;"b=";b;"c=";c; End Sub Private Sub S1(x As Integer,y As Integer) Dim c As Integer x=2*x:y=y+2:e=x+y End Sub Sub S2(x As Integer,By Val y As Integer) Dim e As Integer x=2*x:y=y+2:e=x+y End Sub A.a=4 b=6 c=6 B.a=8 b=6 c=6 a=4 b=6 c=6 a=8 b=6 c=6 C.a=4 b=6 c=6 D.a=8 b=6 c=6 a=8 b=6 c=6 a=4 b=6 c=6


    正确答案:C
    【解析】在定义子过程的参数时,如果在参数前加上ByVal,表示是“传值”参数,主调函数中参数的值不被改变;否则表示是“传地址”参数,参数值会被调用的子过程改变。
    题中S1过程的参数是“传地址”,因此调用后a、b、c的值都改变了,分别为4、6、6;S2过程的参数中a是“传地址”参数,b是“传值”参数,因此调用后a值改变,b值不变,因为。是过程变量,所以也没有变化,因此输出的值为8、6、6。

  • 第14题:

    有如下程序: Private Sub Command1_Click() Dim k As Integer,m As Integer Dim p As Integer k=4:m=1 p=PC(k,m):Print p; p=PC(k,m):Print p End Sub Private Function PC(a As Integer,b As Integer) Static m As Integer,i As Integer m=0:i=2 i=i + m + 1 m=i + a + b PC=m End Function 程序运行后,输出的结果为

    A.4 6

    B.6 6

    C.8 8

    D.10 12


    正确答案:C
    解析:在Sub过程中,程序段先定义了3个Integer型变量k,m,P,并给k赋给初值4,m的初值为1,然后调用事件过程PC,并将它的值赋给p;在事件过程PC中定义了两个形参,参数的传送是通过引用实参,即将k,m的地址作为a,b的地址;在PC中,将m,I定义为静态变量,所以第一次调用后的值仍然保留,但是m,I分别都有赋值语句,将它们的值变为0,2,所以返回值不变。

  • 第15题:

    执行下列程序后,变量a的值为 ( ) Dim i As Integer Dim a As Integer a=0 For i=l To 100 Step 2 a=a+l Next i

    A.1

    B.10

    C.50

    D.100


    正确答案:C
    解析:本题主要是对For循环语句的考查。其一般格式为:
      For循环变量=初值To终值[Step步长]循环体
      [Exit For]
      Next循环变量
      要计算For循环的循环次数,可用公式:
      Int(循环次数=(终值-初值)/步长+1)
      本题中经过运算可知循环次数为50次,即执行了50次语句a=a+l。故最后a的值为50。选项C正确。

  • 第16题:

    单击命令按钮时,下列程序代码的执行结果为 ( ) Function FirProc(x As Integer, y As Integer, z As Integer) FirProc=2*x+y+3*z End Function Function SecProc(x As Integer, y As Integer, z As Integer) SecProc=FirProc(z, x, y)+x End Function Private Sub Commandl Click() Dim a As Integer, b As Integer, c As Integer a=2 :b=3 :c=4 Print SecProc(c, b,A)End Sub

    A.21

    B.19

    C.17

    D.34


    正确答案:A
    解析:执行语句Print SecProc (c,b,a)时,调用SecProc函数,此时将实参c, b,a的值对应传递给形参x,y,z。得SecProc =FirProc(a,c,b)+c,此时又需要调用Fir- Proc函数将a,c,b的值传递给对应形参x,y, z。在FirProc函数中执行语句FirProc=2*x +y+3*z即执行语句FirProe=2*a+c+3 *b其结果值为2*2+4+3*3即17。故 FirProe(a,c,b)的返回值为17。再与c相加即得SecProc函数的返回值结果21。选项A正确。

  • 第17题:

    有如下的程序: Private Sub Command1_Click() Dim k As Integer,m As Integer Dim P As Integer k=4:m=1 P=Fun(k,m):Print P; P=Fun(k,m):Print P End Sub Private Function Fun(a As Integer,b As Integer) Static m As Integer,i As Integer in=5:i=2 i=i+m+1 m=i+a+b Fun=m\2 End Function 单击命令按钮后,输出结果为

    A.2 2

    B.4 4

    C.5 5

    D.6 6


    正确答案:D
    解析:在Sub过程中,程序段先定义了3个Integer型变量k,m,p,并赋给k初值为4,m的初值为1,然后调用事件过程Fun,并将它的值赋给p;在事件过程Fun中定义了两个形参,参数的传送是通过引用实参,即将k,m的地址作为a,b的地址;在Fun中,将m,i定义为静态变量,所以第一次调用后的值仍然保留,但是m,i分别都有赋值语句,将它们的值变为5,2,所以返回值不变,都是6,6。

  • 第18题:

    有如下函数:Private Function firstfunc(x As Integer, y As Integer) As Integer Dim n As Integer Do While n <= 4 x=x +y n=-+1 Loop firstfunc = x End Function调用该函数的事件过程如下:Private Sub Command1_lick() Dim x As Integer Dim y As Integer Dim n As Integer Dim z As Integer x=1 y=1 For n = 1 To 3 z = firstfunc(x, y) Next n Print z End Sub该事件过程的执行结果是 ______。

    A.1

    B.3

    C.16

    D.9


    正确答案:C

  • 第19题:

    以下将变量NewVar定义为Integer型正确的是______。

    A.Integer NewVar

    B.Dim NewVar Of Integer

    C.Dim NewVar As Integer

    D.Dim Integer NewVar


    正确答案:C
    解析:定义变量最常用的是使用Dim...AS[VarType]。

  • 第20题:

    以下有关数组定义的语句序列中,错误的是( )。

    A.Static arr1(3) arr1(1)=100 arr1(2)="Hello" arr1(3)=123.45

    B.Dim arr2() AsInteger Dim size As Integer Private Sub Command2_Click () size=InputBox("输入:") ReDim arr2(size) …… EndSub

    C.Option Base 1 Private Sub Command3 Click() Dim art3(3) As Integer …… End Sub

    D.Dim n As Integer Private Sub Command4 Cliok() Dim arr4(n)As Integer …… End Sub


    正确答案:D
    解析:在声明数组时,其下标必须为确定的值。

  • 第21题:

    Dim arrInt()as Integer=New Integer(3){0,1,2}


    正确答案:错误

  • 第22题:

    在VB中,使用变量前一般应对变量进行定义。以下变量定义语句错误的是()。

    • A、Dim  x As Integer
    • B、Dim  x As Integer,y As Single
    • C、Var  x,y:Integer
    • D、Dim  x As Integer,y As Integer

    正确答案:C

  • 第23题:

    判断题
    Dim arrInt()as Integer=New Integer(3){0,1,2}
    A

    B


    正确答案:
    解析: 暂无解析

  • 第24题:

    判断题
    Dim arrInt()as Integer=New Integer(2){0,1,2}
    A

    B


    正确答案:
    解析: 暂无解析