【技藝競賽試題】
【D】01.下列哪一個變數的名稱不符合Basic的命名規則? (A)a
Loop是保留字
【D】02.在Basic中,若變數資料未經宣告就使用,則會將其內定為何種資料型態? (A)Integer
(B)Boolean (C)String (D)Variant。[96技競VB6]
【B】03.在Basic程式語言的邏輯運算中,Print 7 < 9 Xor
((20 Mod 3) = 2)的邏輯值是 (A)True (B)False (C)1 (D)2。[97技競VB6]
7 < 9 Xor
((20 Mod 3) = 2) = 7 < 9 Xor (2 = 2) = 7 < 9 Xor T =
T Xor T = F
【D】04.一邏輯運算式為"a < 60 And b
< 60 Or c > 60 And d > 60",則下列何種情況,可使其值為"真(True)"? (A)a = 100,
c = 0, b = d = 60 (B)a = b = 60, c = d = 59 (C)a = b = c = d = 60 (D)a = b = c
= d = 59。[97技競]
59 < 60 And 59 < 60
Or 59 > 60 And 59 > 60 = T And T Or F And F =
T Or F = T
【C】05.設I = 3,J = 10,K = 8,以下之邏輯運算式何者之運算結果為真(true)? (A)I + K <= J
(B)(I < J) AND NOT (J > K) (C)((I < K) OR (J > K)) AND (K >=0)
(D)NOT ((I > J) OR (K > I))。[97技競]
(A)3 + 8 <= 10 → 11 <= 10 → F
(B)(3 < 10) And Not (10
> 8) → T And Not T → T And F → F
(C)((3 < 8) Or (10
> 8)) And (8 >=0) → (T Or T) And T → T And T → T
(D)Not ((3 > 10) Or (8
>3)) → Not (F Or T) → NOT (T) → F
【B】06.在Visual Basic程式中執行Print
"Time:" & #8:8:8#,則輸出的資料為 (A)Time:& #8:8:8:8#
(B)Time:AM 08:08:08 (C)Time:PM 08:08:08 (D)Time:AM 8:8:8。[98技競VB6]
【A】07.一個邏輯閘,若有任一輸入端為1時,其輸出0,則此邏輯閘為 (A)NOR閘 (B)NAND閘 (C)AND閘 (D)OR閘。[98技競]
【D】08.在Visual Basic程式中執行Print Not (3 ^ 4 = 81)
Or (12 <> 3 * 4),則輸出的資料為 (A)1 (B)True (C)-1 (D)False。[98技競VB6]
Not (3 ^ 4 = 81) Or (12
<> 3 * 4) = Not (81 = 81) Or (12 <> 12) = Not
(T) Or F = F Or F = F
【A】09.以下程式片段,可將x及y值交換,請問在空白處應依序填入內容為何? (A)y = x - y及x =
x - y (B)x = x - y及y = y + x (C)y = y + x及x =
x - y (D)x = x + y及y = x - y。[99技競VB6]
Dim x As Integer, y As
Integer
x = 10: y = 20: x = x
+ y
______
______
Print x, y
【B】10.若邏輯運算子的優先順序由高而低依序為NOT、AND與OR,假設三運算元X、Y與Z的邏輯值均為假,則運算式X OR NOT Y AND Z的邏輯值為下列哪一項? (A)真 (B)假 (C)不真不假 (D)不一定。[99技競]
F Or Not F And F = F Or T
And F = F Or F = F
【B】11.下列Visual Basic程式片段,Print 19 Mod 3 * 2 + 2
^ (-1),請問其執行結果為何? (A)0 (B)1.5 (C)5.5
(D)3.5。[100技競VB6]
19 Mod 3 * 2 + 2 ^ (-1) =
19 Mod 3 * 2 + 0.5 = 19 Mod 9 + 0.5 = 1 + 0.5 = 1.5
【A】12.執行以下Visual Basic程式片段,Print 49 \ 6 / 2 Mod 2
* 2,其結果為何? (A)0 (B)1 (C)4 (D)16。[100技競VB6]
49 \ 6 / 2 Mod 2 * 2
= 49 \ 3 Mod 4 = 16 Mod 4 = 0
【B】13.A, B分別為八位元資料,下列八位元邏輯運算式,何者錯誤? (A)NOT(A AND B) = NOT
X OR NOT B (B)NOT(NOT A OR NOT B) = A OR B (C)A AND NOT A = 00000000 (D)A OR
NOT A = 11111111。[100技競]
Not (Not A Or Not B) = A And B
【其他試題】
【B】01.VB中,變數敘述何者無法與A與B互換? (A)T = B: B = A: A =
T (B)A = B: B = A (C)SWAP A, B (D)T = A: A = B: B = T。
若A = 2:
B = 5,(B)A = B → A = 5,B = A → B = 5
【A】02.VB中,何者有最高運算權? (A)/ (B)\ (C)Mod (D)+。
算術運算符號優先順序:1.括號(),2.指數^,3.負號-,4.乘*、除/,5.整數除法\,6.餘數Mod,7.加+、減-。
【D】03.下列哪項運算式結果為True? (A)"kitty >
"kitty" (B)"XYZ" > "abc" (C)NOT 50 > 60 AND
10.A (D)5 * 3 > 40 XOR "abc" > "ABC"。
(A)"kitty >
"kitty" → 前後相等,前者不大於後者,結果為F
(B)"XYZ" >
"abc" → X之ASCII碼為88,a之ASCII碼為97,前者不大於後者,結果為F
(C)Not 50 > 60 And 10 = Not
F And 10 = T And 10 = 10
(D)5 * 3
> 40 Xor "abc" > "ABC" = 15 > 40 Xor "abc"
> "ABC" = F Xor T = T
【B】04.執行Print (2 > 20) And (3 >= 1)的結果為何? (A)True (B)False (C)2 (D)1。
(2 > 20) And (3 >= 1) = F And T = F
【B】05.若「1」代表真;「0」代表假,布林代數(Boolean Algebra)運算中,下列何者為真? (A)1 AND 0 = 1 (B)0 OR 1 =
1 (C)1 AND 1 = 0 (D)1 OR 1 = 0。
OR前後,只要有一個為真即為真。
(A)1 And 0 = 0。(B)0 Or 1 = 1。(C)1 And 1 = 1。(D)1 Or 1 = 1。
【綜合題】
算術運算
【題目1】NOT 13的binary code?
以8位元處理,13轉成2進位為00001101,NOT 13的結果為11110010,因為是負數,所以要轉為2的補數,結果為00001110,答案為-14。
【題目2】2 + 15
* 6 MOD 45 \ 7 =?
2 + 15
* 6 MOD 45 \ 7 = 2 + 90 MOD 45 \ 7 = 2 + 90
MOD 6 = 2 + 0 = 2
【題目3】PRINT
16.7 \ 4 - 3 * 4 MOD 5 + 10 =?
16.7 \ 4 -
3 * 4 MOD 5 + 10 = 16.7 \ 4 - 12 MOD 5 + 10 = 17 \ 4 - 12
MOD 5 + 10 = 4 - 12 MOD 5 + 10 = 4 - 2 + 10 = 2 + 10 = 12
【題目4】Print 2 + 3 * 4 ^ 2 / 2
- 12 Mod 10的結果為何?
2 + 3 * 4 ^ 2 / 2 - 12 Mod 10 = 2 + 3 * 16
/ 2 - 12 Mod 10 = 2 + 48 / 2 - 12 Mod 10 = 2 + 24 - 12 Mod 10 =
2 + 24 - 2 = 26 - 2 = 24
【題目5】2 * 4 - 3 ^ 2 *
(2 + 3) Mod 7
2 * 4 - 3 ^ 2 * (2
+ 3) Mod 7 = 2 * 4 - 3 ^ 2 * 5 Mod 7 = 2 * 4 - 9 *
【題目6】2 * 4 - 3 ^ 2 +
(2 + 3) Mod 7
2 * 4 - 3 ^ 2 + (2
+ 3) Mod 7 = 2 * 4 - 3 ^ 2 + 5 Mod 7 = 2 * 4 - 9 +
邏輯運算
【題目1】7 + 50 Mod 6 / 12 And
Not 6 Or 7 > 4 + 5?
7 + 50 Mod
6 / 12 And Not 6 Or 7 > 4 + 5 = 7 + 50 Mod 0.5 And Not 6 Or 7
> 4 + 5 = 7 + 50 Mod 0 And Not 6 Or 7 > 4 + 5 → 50 Mod 0,因為除以0,無法執行
【題目2】2 * 3 And 4 Or Not -5
+ 5 > 3?
2 * 3
And 4 Or Not -5 + 5 > 3 = 6 And 4 Or Not -5 + 5 > 3 = 6 And 4 Or
Not 0 > 3 = 6 And 4 Or Not False = 6 And 4 Or
True = 4 Or True = -1
沒有留言:
張貼留言
注意:只有此網誌的成員可以留言。