Java程序中,关于变量的定义,下面哪个语句是的?
A: Dim i as Integer
B: var i = 0;
C: i:Integer;
D: int i = 0;
A: Dim i as Integer
B: var i = 0;
C: i:Integer;
D: int i = 0;
举一反三
- 以下声明I是整型变量的语句正确的是____。 A: Dim<br/>I, j As Integer B: I=12.34 C: Dim<br/>I As Integer D: I<br/>As Integer
- 以下声明I是整型变量的语句正确的是( ). A: Dim I,j As single B: I=1234 C: Dim I As Integer D: I As Integer
- 在下列程序段中,不能计算1到100之间奇数之和的是__________。 A: Dim sum As Integer sum = 0 For i = 1 To 100 Step 2 sum = sum + i Next B: Dim sum As Integer sum = 0 For i = 1 To 100 If i Mod 2 <> 0 Then sum = sum + i Next C: Dim sum As Integer sum = 0 For i = 1 To 99 sum = sum + i Next D: Dim sum As Integer sum = 0 For i = 100 To 1 Step -1 If i Mod 2 <> 0 Then sum = sum + i Next
- 使用数组x输出10个1-100之间的随机整数(包括1和100),下列命令中正确的是:( ) A: Dim x(9) As Integer For i = 1 To UBound(x) x(i) = Int(Rnd() * 100 + 1) Print x(i); Next B: Dim x(9) As Integer For i = 0 To UBound(x) x(i) = Rnd(10) Print x(i); Next C: Dim x(9) As Integer For i = 0 To UBound(x) x(i) = Int(Rnd() * 100 ) Print x(i); Next D: Dim x(9) As Integer For i = 0 To UBound(x) x(i) = Int(Rnd() * 100 + 1) Print x(i); Next
- 下面程序运行后,语句“Print i”执行的次数是( )。 Private Sub Form_Click() Dim i As Integer,j As Integer i=0 Do i=i+1 Forj=10 To 1 Step-3 i=i+j Print i Next j Loop While i<50 End Sub A: 4 B: 8 C: 12 D: 16