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

题目

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


相似考题

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(3){0,1,2}”相关问题
  • 第1题:

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

    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中开始定义了数组长度,不是动态数组。

  • 第2题:

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

    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项是错误的。

  • 第3题:

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

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

    B.Dim arr2()As Integer Dim size As Integer Private Sub Command2_Click() size=Input Box("输入:") ReDimarr2(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
    解析:在数组定义中,定义的数组元素个数不能是变量。而选项D中的n是一个变量。

  • 第4题:

    23 有如下程序段,该程序段循环的次数是______。 Dim i As Integer Dim j As Integer Dim k As Integer k=0 For i = 0 To 10 Step 3 For j = 1 To 5 If j > 3 Then k = k + 4: Exit For k=k+1 Print k Next j If i > 8 Then Exit For Next i

    A.9

    B.10

    C.11

    D.12


    正确答案:D

  • 第5题:

    有如下函数: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

  • 第6题:

    单击命令按钮时,下列程序代码的执行结果为______。 Private Function FirProc (x As Integer,y As Integer,z As Integer) FirProc=2*x+y+3*z End Function Private Function SecProc(x As Integer,y As Integer,z As Integer) SecProc=FirProc(z,x,y)+x End Function Private Sub Command1_Click() Dim a As Integer Dim b As Integer Dim 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

  • 第7题:

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

    A.Integer NewVar

    B.Dim NewVar Of Integer

    C.Dim NewVar As Integer

    D.Dim Integer NewVar


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

  • 第8题:

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

    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
    解析:在声明数组时,其下标必须为确定的值。

  • 第9题:

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

    A )

    Dim arr () As Integer

    ReDim arr ( 3 , 5 )

    B )

    Dim arr () As Integer

    ReDim arr ( 50 ) As String

    C )

    Dim arr ()

    ReDim arr ( 50 ) As Integer

    D )

    Dim arr ( 50 ) As Integer

    ReDim arr ( 20 )


    正确答案:A

     

  • 第10题:

    在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

  • 第11题:

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

    B


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

  • 第12题:

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

    B


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

  • 第13题:

    以下定义数组或给数组元素赋值的语句中,正确的是

    A.Dim x%(2) x(1)="等级考试"

    B.Dim x(3), y(3)As Integer x(0)=1:y=x

    C.Dim x x=Array(0,1,2)

    D.Dim x(3)As Integer x=Array(0,1,2)


    正确答案:C
    解析:在选项A中,用类型说明符“%”放在变量名x的尾部来标识该变量为整型数组,执行语句“x(1)=“等级考试"”会产生“类型不匹配”的错误。在选项B中,执行语句“y=x”,会产生“不能给数组赋值”的错误。在使用Array函数对数组进行初始化时,数组变量不能是具体的数据类型,只能是Variant(变体)类型。所以选项C是正确的,选项D是错误的。

  • 第14题:

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

    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是一个变量。

  • 第15题:

    单击命令按钮时,下列程序的执行结果是

    Private Sub Commandl_Click()

    Dim a As Integer,b As Integer,c As Integer

    a=3:b=4:c=5

    Print SecProc(c,b,A)End Sub

    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

    A.20

    B.22

    C.28

    D.30


    正确答案:C
    解析:此题程序代码中用了双层调用,我们对这样的问题要多加小心,千万不要把实参和相对应的形参弄混。主调过程Command1_Click输出的是SecProc(c,b,A)的返回值,调用过程SecProc时,主调过程分别把实参c、b、a地址传给形参x、y、z,此时在过程SecProc中,SecProc=FirProc(a,c,B)+c。由此看出,程序段执行此语句时,将调用过程FirProc。把实参a、c、b的地址分别传给形参x、y、z,此时在过程FirProc中,FirProc=2*x+y+3*z,所以FirProc(a,c,B)=6+4+ 15=25,SecProc(a,c,B)=25+3=28,所以选项C)是正确的。

  • 第16题:

    以下程序运行后,单击命令按钮,窗体显示的结果是 ______。 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。

  • 第17题:

    程序代码如下,当单击窗体上的Command1控件时,在窗体上输出的结果是( )。 Private Sub Command1_Click() Dim aa(3,3)As Integer Dim i As Integer,j As Integer Dim s As Integer For i=0 To 3 For j=0 To 3 aa(i,j)=i*4+j+1 Next j Next i For i=0 To 3 s=s+aa(i,1) Next i Print s End Sub

    A.32

    B.28

    C.30

    D.36


    正确答案:A
    解析:当发生Command1_click事件时,将定义一个4行4列的数组aa(数组下标从0开始),然后通过一个两层For循环给它的各个元素赋值,赋值规律是给每一个元素赋它的行下标值乘以4,再加上列下标值再加1。然后通过一个For循环把数组元素aa(0,1)、aa(1,1)、aa(2,1)和aa(3,1)的值2、6、10、14加到s中,s的值为32。

  • 第18题:

    阅读下面的程序; 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。

  • 第19题:

    下列程序段的执行结果为______。 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。

  • 第20题:

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

    A.20

    B.25

    C.37

    D.32


    正确答案:C
    解析:此题程序代码中用了嵌套调用,我们对这样的问题要多加小心,不能掉以轻心,千万不要把实参和相对应的形参弄混淆。主调过程Command1_Click输出的是SecProc(c,b,a)的返回值,调用过程SecProc时,主调过程分别把实参c、b、a地址传给形参x、y、z,此时在过程SecProc中,SecProc;FirProc(a,c,B)+7。由此看出,程序段执行此语句时,将调用过程FirProc。把实参a,c,b的地址分别传给形参x、y、z,此时在过程FirProc中,FirProc=2*x+y+3*z+2,所以FirProe(a,c,b)=6+4+15+2=27,SecProc(a,c,b)=27+3+7=37。

  • 第21题:

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


    正确答案:正确

  • 第22题:

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


    正确答案:正确

  • 第23题:

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

    B


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