For each question, choose one correct answer and write its symbol (A–E) in the box.
以下の各問に対して正しい答えを選び,その記号
(A–E)
を枠の中に書いてください.Q16. Select the output of the following C program.
以下の
C
言語のプログラムを実行したときの出力を次から選べ.#include <stdio.h>
int main() {
int n = 0;
while ( n++ < 5 ) printf("%d ", n);
return 0;
}
(A) 1 2 3 4 5 (B) 5 4 3 2 1 (C) 0 1 2 3 4 (D) 4 3 2 1 0 (E) None of these
Q17. Select a value that is the closest to the value output by the following C program.
以下の
C
プログラムを実行した時,出力される数値に最も近い値を選べ.#include <stdio.h>
#include <math.h>
double fx(double x) { return exp(x); }
double intf(double (*f)(double), double a, double b, int n) {
double sum, h;
int i;
h = (b - a) / n;
sum = (f(a) + f(b))/ 2.0;
for ( i = 1; i < n; i += 1 ) { sum += f(a + h * i);
}
return sum * h;
}
int main() { printf(‘‘%f\n’’, intf(&fx, 0.0, 1.0, 10)); return 0;}
(A) e
0.5(B) e
0.6(C) e − 1 (D) (e + 1) · 0.4 (E)
e+12Q18. When the following Java program is executed, what value will be output?
以下の
Java
言語のプログラムを実行させた場合,どの値が出力されるか?class TClass {
private int val = 0;
public void func(int num) { if (num % 3 != 0) val += num; else val = -val; } public int get() { return val; }
}
class Sample {
public static void main(String args[]){
TClass t = new TClass();
for (int i = 1; i <= 10; i++) t.func(i);
System.out.println(t.get());
} }
(A) 5 (B) 1 (C) − 1 (D) − 5 (E) None of these
Q19. There are 5 algorithms (with input size n) A, B, C, D, E such that the time complexity of each algorithm is as follows. Which algorithm has the largest time complexity?
入力サイズ
n
に対し,時間計算量が以下のような5
つのアルゴリズムA, B, C, D, E
がある. 時間計算量が 一番大きいアルゴリズムはどれか答えよ.(A) Θ ( n
2log n )
(B) Θ (n log n) (C) Θ (log n!) (D) Θ (n log log n) (E) Θ ( n
2log log n )
Q20. Define a Boolean function f using ¯ (negation), ∧ (conjunction), and ∨ (disjunction) by f (p, q) = (p ∨ q) ∧ (p ∧ q). Which Boolean function is equal to f ?
否定
(¯),論理積 ( ∧ ),論理和 ( ∨ )
から定義されるブール関数f (p, q) = (p ∨ q) ∧ (p ∧ q)
と等しい関数を選べ.(A) p (B) p (C) q (D) q (E) None of these
Q21. Let f be the Boolean function given by f = x
1x
2x
3∨ x
1x
2x
3∨ x
1x
2x
3∨ x
1x
2x
3. Suppose that we can use NOT gates, AND gates of fan-in two and OR gates of fan-in two to form a circuit. What is a minimum number of gates in a circuit that computes f ?
ブール関数
f
がf = x
1x
2x
3∨
x
1x
2x
3∨
x
1x
2x
3∨
x
1x
2x
3で与えられているとする.ブール関数f
を論理 回路を用いて計算したい.論理否定ゲート,2入力論理積ゲート,および,2入力論理和ゲートが使用できQ22. Select a repeating decimal number that has no terminating decimal representation.
10
進数表示をした場合に,循環小数となり,かつ有限小数表示を持たない数を選べ.(A)
√ 5
10 (B) 256
999 (C) 256
1000 (D) 256
1024 (E) None of these
Q23.
Let n be a natural number, and define T(n) by the following recurrence equation:
T (n) = {
1, if n = 1,
T ( ⌊ n/2 ⌋ ) + 2n, if n ≥ 2.
Which is the closest to T (1024)?
自然数
n
に対して,T(n)
を以下の再帰式で定める:T(n) = {
1, n = 1
のとき,T ( ⌊ n/2 ⌋ ) + 2n, n ≥ 2
のとき.T (1024)
に一番近いのはどれか.(A) 2
9(B) 2
10(C) 2
11(D) 2
12(E) 2
13Q24. Let L be a language defined by the regular expression “1
∗2
∗3”. Which word does not belong to L?
次の正規表現
“1
∗2
∗3”
によって定義される言語をL
とする.L
に属さない語を選べ.(A) 3 (B) 123 (C) 1233 (D) 11223 (E) 111113
Q25. For a regular expression E, L(E) denotes the language defined by E. Choose one which satisfies the condition: L(E) ⊆ { x ∈ { 0, 1 }
∗| ♯
0(x) is an odd number } , where ♯
0(x) denotes the number of 0’s contained in x.
正規表現
E
に対して,L(E)をE
によって定義される言語とする.L(E) ⊆ { x ∈ { 0, 1 }
∗| ♯
0(x)
は奇数}
を満たすものを選べ. ただし,♯0(x)
はx
に含まれる0
の個数を指す.(A) E = ∅
∗+ 0
(B) E = 00
∗0
(C) E = 0
∗00
∗(D) E = 0(1
∗01
∗0)
∗(E) E = 0(0 + 1 + 0)
∗Q26. Select a bit string which means 8-bit two’s complement representation of − 5.
8
ビット整数の− 5
を2
の補数で表わすとどれになるか.(A) 00000101 (B) 11111010 (C) 01111011 (D) 11111001 (E) None of these
Q27. What is the transposed matrix of the following matrix A
A = (
A
11A
12A
21A
22)
,
where A
ij(i, j ∈ { 1, 2 } ) is a submatrix of A and A
tijis the transposed matrix of A
ij?
以下の行列A
の転置行列は何か?A = (
A
11A
12A
21A
22) ,
ここで,
A
ij(i, j ∈ { 1, 2 } )
はA
の部分行列で,A
tijはA
ijの転置行列である.(A) (
A
t11A
t12A
t21A
t22)
(B) (
A
t11A
t21A
t12A
t22)
(C) (
A
11A
t12A
t21A
22)
(D) (
A
11A
t21A
t12A
22)
(E) None of these
Q28. A database designer defined the following functional dependencies on the relation R(A, B, C, D, E, F, G). What is a candidate key on R ?
Functional dependencies: A → B, BC → E, E → F , D → F G
データベース設計者が関係
R(A, B, C, D, E, F, G)
に対し,次の関数従属性を定義した.関係R
の候補キー を選択せよ.関数従属性:
A → B, BC → E, E → F, D → F G
(A) { A, C, D } (B) { B, C, D } (C) { B, D } (D) { A, D } (E) None of these
Q29. Let X and Y be independent random variables exponentially distributed with rate λ and µ as P (X ≤ x) = 1 − e
−λx, and P (Y ≤ y) = 1 − e
−µy. Let the random variable T = min(X, Y ). How is P (T ≤ t) given?
X, Y
は率λ, µ
の指数分布に従う互いに独立な確率変数であり,P (X ≤ x) = 1 − e
−λx,P (Y ≤ y) = 1 − e
−µy とする.確率変数T = min(X, Y )
とすると,P(T≤ t)
はどのように与えられるか.(A) 1 − e
−(λ+µ)t(B) e
−(λ+µ)t(C) (1 − e
−λt)(1 − e
−µt) (D) e
−λµt(E) None of these
Q30. Choose a probability distribution that can be encoded into the two Huffman codes: { 00, 01, 10, 11 } and { 0, 10, 110, 111 } .
ふたつのハフマン符号