一、單選題:(每題4分,共12題) 48%
01( )陣列宣告 DIM A(10),有幾個元素? (A)9 B)10 C)11 (D)12
02( )陣列宣告 DIM A(0 To 10, 0 To 3),有幾個元素?(A)13 (B)30 (C)44
(D)60
03( )陣列宣告 DIM A(2,3,4),有幾個元素?(A)24 (B)6 (C)60
(D)120
04( )要一次就刪除清單方塊(ListBox)中的所有資料可使用?
(A) Items.Add (B) Items.Clear (C) Items.Remove (D) Items.RemoveAt
(A) Items.Add (B) Items.Clear (C) Items.Remove (D) Items.RemoveAt
05( )若要增加下拉式清單方塊(ComboBox)中的項目,可使用?
(A) Items.Add (B) Items.Clear (C) Items.Remove (D) Items.RemoveAt
(A) Items.Add (B) Items.Clear (C) Items.Remove (D) Items.RemoveAt
06( )哪一屬性可取得清單方塊中被選取項目的索引編號?
(A) SelectedItem (B)SelectedMode (C) SelectedIndexChange (D) SelectedIndex
(A) SelectedItem (B)SelectedMode (C) SelectedIndexChange (D) SelectedIndex
07( )要從屬性視窗中設定核取清單方塊(CheckedListBox)的資料,可在下列哪一個屬性中輸入?
(A)Items (B)Text (C)Name (D)List
(A)Items (B)Text (C)Name (D)List
08( )陣列宣告 DIM A(0 To 9),有幾個元素?(A)8 (B)9 (C)10
(D)11
09( )陣列宣告 DIM A(5,3),有幾個元素?(A)8 (B)15 (C)18
(D)24
10( )陣列宣告 DIM A(8) As Integer,共佔幾Bytes?(A)18 (B)20
(C)36 (D)42
11( )陣列宣告 DIM A(3,4) As Double,共佔幾Bytes?(A)160 (B)96
(C)80 (D)48
12( )下列何者為錯誤的陣列宣告?
(A)Dim A(30,5), B(8), C(5,6,7) (B)Dim D(10,20), G(5)
(C)Dim F(20,5,4,8) (D)Dim M(10), P(5,7), M(3,4,5)
(A)Dim A(30,5), B(8), C(5,6,7) (B)Dim D(10,20), G(5)
(C)Dim F(20,5,4,8) (D)Dim M(10), P(5,7), M(3,4,5)
二、填充題:(每格3分,共9格,第10格佔5分) 32%
6
|
8
|
10
|
3
|
9
|
4
|
1
|
5
|
11
|
2
|
0
|
7
|
1~6格寫出元素個數及佔用記憶Bytes數
1、 DIM A&(5,3) (1)________元素、 (2)________Bytes
3、 DIM B(8) As Integer (3)________元素、 (4)________Bytes
5、 Dim C(2,2,3) As Double (5)________元素、 (6)________Bytes
7、Dim A(3,2) ,A的內容如右 ,問 A(A(2,1)-3,A(1,2)-2)=? ___________0
8、4x4的幻方如下,1~3已填入,將4~16填入空格後,直的4格、橫的4格和皆為34,圈內(第2列第3格)應填?_____
9、8x8的幻方如下,1~3已填入,將4~64填入空格後,直的8格、橫的8格和皆為260,圈內(第6列第3格)應填?_____
|
|
10、寫出 100 ~ 125 之間的所有質數__________________{本題5分,全對才算分}
三、看程式寫結果:資1忠選5每題4分 資1孝任選4題:每題5分
‘ 程式1
Dim b(3, 3) As Integer
For I = 0 To 3
For J = 0 To 3
b(I, J) = 2 * J * (I + J)
Next
Next
Debug.print(B(2,2) & “,” & B(3,0))
‘ 問B(2,2)=______、B(3,0)=______
|
‘ 程式2
Dim A(10) As Integer
For K = 1 To 8
A(K) = K * 3 \ 4
Next
Debug.print(A(4)+A(7))
‘ 問A(4)+A(7)=_______
|
‘ 程式3
Dim A(3, 5), B(5, 3) As Integer
For m = 2 To 3
For n = 2 To 5
A(m, n) = m * n \ 2
B(n, m) = A(m, n)
Next
Next
Debug.print(A(1,2)+A(3,4)+B(5,2))
‘ 問 A(1,2)+A(3,4)+B(5,2) =______
|
|
‘ 程式4
Dim S = 3, A(6) As Integer
For K = 1 To 6
If K Mod 2 = 0 Then
S = S + K : A(K) = S
Else
S = S - K : A(K) = S
End If
Next
Debug.Print(
S )
‘問 S 值?_________
|
‘ 程式5
Dim S(10, 10) As Integer
For A = 1 To 10
For B = 1 To 10
If (A > 1 And B >
1) Then
S(A, B) = S(A - 1, B
- 1) + 1
Else
S(A, B) = 1
End If
Next
Next
Debug.Print(S(2,5)+S(6,8))
‘問S(2,5)+S(6,8) 值?_________
|
‘ 程式6
Dim g() = {5,2,3,6,0,4,1 }
Dim n = UBound(g)
Dim A(n) As Integer
For i = 0 To n
A(g(i)) = i + 2
Next
Debug.Print(A(1) & “,” & A(2) & “,” & A(3))
‘ 問 A(1)~A(3)值_______________
|
|
‘ 程式7
Dim k = 0
Dim
A(,) = {{2, 3, 4}, {5, 6, 7}, {8, 10, 12}, {9, 11, 13}}
Dim m
= UBound(A, 1), n = UBound(A, 2)
Dim c(20) As Integer
For i = 0 To m
For j = 0 To n
If A(i, j) Mod 3 = 0
Then
c(k) = A(i, j)
Else
c(k) = i + j
End If
k += 1
Next
Next
Debug.Print(C(7) & “,” & C(8)
& “,” & C(9))
‘ 列出C(7)~C(9)的值 _________
|
‘ 程式8
Dim S() As Integer = {70, 80, 90, 88, 77, 66, 54, 92}
Dim N As Integer = S.Length
Dim X As Integer = 0
Dim Y As Integer = 0
For A = 0 To n-1
X += S(A)
If S(A) > Y Then Y =
S(A)
Next
Dim Z As Double = X/N
Debug.Print(X & “,” & Y & “,”
& Z)
‘問X,Y,Z =
_________
|
||
另有 實作中的 求2~500中的質數問第k個是? 、 還有4N階4x4或8x8或12x12某一格例A(5,6)是?
期考的筆試佔 70%
Ans:
一、 C C C B
A D A C D D A D
二、
第1題 24 192
第3題 9 36
第5題 36 288
第7題 11
第8題 10
第9題 22
第10題 101 , 103 , 107 , 109
, 113
三、
程式1 : 16 , 0
|
程式2: 8
|
程式3 : 11
|
程式4 : 6
|
程式5: 8
|
程式6 : 8 ,3 ,4
|
程式7 : 3,12,9
|
程式8 : 617,92,77.125
|
|
補充
|
|
|
2
3 5 7
11 13 17
19 23 29 31 37
41 43 47
53 59 61
67 71 73
79 83 89 97
101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 {2~200質數表}