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

题目

Dim arrInt()as Integer=New Integer(2){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(2){0,1,2}”相关问题
  • 第1题:

    (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。

  • 第2题:

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

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

  • 第3题:

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

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

  • 第4题:

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

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

  • 第5题:

    有如下的程序。 Private Sub Commandl_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 m=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


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

  • 第6题:

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

  • 第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题:

    ( 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题:

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


    正确答案:正确

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

  • 第14题:

    执行下列程序后,变量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正确。

  • 第15题:

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

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

  • 第16题:

    有如下的程序: 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。

  • 第17题:

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

  • 第18题:

    单击命令按钮时,下列程序代码的执行结果为______。 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

  • 第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(2){}
    A

    B


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