You are on page 1of 23

1994 GRE COMPUTER SCIENCE TEST (FORM GR9429)

Directions: Each of the questions or incomplete statements below is followed by five suggested answers
or completions. Select the one that is best in each case and then fill in corresponding space on the answer
sheet.

1 The value of the prefix expression *5-3 4 is


(A) 17 (B) 7 (C) 3 (D) -3 (E) -5
2 A disk unit uses a bit string to record the occupancy or vacancy of its tracks, with 0 denoting vacant
and 1 occupied. A 32-bit segment of this string has the hexadecimal value D4FE2003. The
percentage of occupied tracks for the corresponding part of the disk ,to the nearest percent ,is
(A) 12% (B) 25% (C) 38% (D) 44% (E) 62%
3 A starvation-free job-scheduling policy guarantees that no job waits indefinitely for service. Which
of the following job-scheduling policies is starvation-free?
(A) Round robin (B) Priority queuing
(B) Shortest job first Youngest job first
(C) (D) Youngest job first (E) None of the above
Questions 4-5 are based on the finite-state machine below with start A and where b/c represents a
transition on input b providing out c.

0/0
Start 0/0A 0/0 C
B

0/0 1/0
1/1 1/1

D
1/0

4 What is the output when the input is 001100?


(A) 010010 (B) 001001 (C) 001000 (D) 000110 (E) 000010
5 What is the greatest number of 1-output that could be made in response to an input of length 15?
(A) 3 (B) 4 (C) 5 (D) 7 (E) ?
6 In the following code for a stack machine ,“PUSH X” means “push X onto the stack”, “POP X”
means “Pop the top of the stack into X”, and an operator without an operand (ADD,MULT) means
“pop the top two items off the stack, perform the indicated operation on them ,and push the result
back onto the stack”.
1) PUSH A
2) PUSH B
3) ADD
4) POP T1
5) PUSH B
6) PUSH C
7) PUSH T1
8) PUSH T1
9) MULT

1
10) MULT
11) ADD
12) POP Z
What is the final of Z?
(A) B+C(A+B)2 (B) (B+C)(A+B)2 (C) (A+B) (B2+C)
(D) (B+C2)(A+B) (E) (B+C)(2)(A+B)

?above shows a doubly linked list that


(A) makes any node accessible from any other node
(B) is a directed tree
(C) is a circuit list
(D) has one or more illegal links
(E) is an example of acyclic graph
8 Consider the following transformations on a string of five bits.
T1: Complement any two bits
T2: Exchange any two bits
Which of the following strings CANNOT be obtained from the strings 00000 by any sequence of
applications of T1 and T2?
(A) 11011 (B) 10001 (C) 01010
(D) 00100 (E) 00011
9 A procedure that printed the following binary tree
A

B C

D E F
in postorder would output
(A) ABCDEF (B) ABDECF (C) DBEAFC
(D) DEBFCA (E) DEFBCA
10 What is the least restrictive statement about z that guarantees x > 0 after execution of the following
statement?
y := z - 4;
x := y + 5
(A) z < 0 (B) z < -1 (C) z > 0 (D) z >1 (E) z > -1
11 Consider the following grammar G bellow, where S is the start symbol
S → aSbSa
S → aaSb
S → ab
Which of the following strings is in language generated by G?
(A) aab (B) aabaab (C) aabbaba (D) abbaabb (E) aaabaaab

2
12 Sally and Sue agree to cooperate in the writing of a Pascal program in which Sally will write the
main program, and Sue will write a function ZAP to be called by the main program, ZAP will have
two parameters , x and y , and evaluated a particular function of x and y. Sally and Sue need NOT
agree on which of the following in order that their two pieces of code , debugged separately , will be
sure to compile and run correctly together?
(A) The number of places in which ZAP will be called by the main program
(B) Precisely what ZAP is supposed to compute
(C) The data type of x and y
(D) The data type returned by ZAP
(E) The order of parameters a call of ZAP
13 Computer arithmetic is by nature inexact. Suppose that on some machine the result of any binary
arithmetic operation may differ from the“correct” value(i.e., from the result produced by exact
arithmetic on the operand actually presented) by as much as 10 percent .what is the largest error that
could be introduced by this machine while evaluating the expression
100.0 + 200.0 - 300.0
from left to right?
(A) 0.0 (B) 30.0 (C) 30.3 (D) 33.0 (E) 66.0
14 Consider the following Pascal-like program segment.
var i , j : integer;
procedure P(k, l : integer) ;
begin
k : = k – l;
l:=k+l;
k:=l-k
end ;
i := 2;
j := 3;
P (i , j) ;
Both parameters to P are passed by reference, what are the value of i and j at the end of the program
segment?
(A)i=0, j=2 (B) i=1, j=5 (C) i=2, j=3 (D) i=3, j=2 (E) none of the above
15 The postfix expression ABC/-DE*+ is equivalent to which of the following infix expression?
(Assume normal rules of operator precedence.)
(A) A/B-C*D+E (B) A-B/C+D*E (C) A-B/(C+D)*E
(D) A-B/(C+D*E) (E) (A-B)/(C+D)*E
16 A computer network consists of n interconnected processors. What is the minimum number of
communication likes to provide two distinct paths between any two processors?
(A) ?|n/2| (B) n(n-1)/2 (C) n(n-1) (D) n (E) 2n
17 A stack is a appropriate mechanism to use dynamic storage allocation if
(A) requests and release occur in “last allocated, first freed ” order
(B) requests and release occur in “first allocated, first freed ” order
(C) requests and release occur in no particular order, but are of fix size
(D) requests and release occur in no particular order, and are of variable size
(E) release occur in decreasing order of request size

3
Questions 18-19 are based on the following information
Suppose that {S1,S2,……SN} is a set of N fixed- length strings ordered alphabetically so that S 1 < S2
<…< Sn .
18 If these strings are hold , in order in an array of N elements, then the time to find the location of S i+1,
given the location of Si, 1≤S<N, has order
(A) 1 (B) log 2 N (C) N (D) N log 2 N (E) N 2
19 Suppose that these strings are held in some binary search tree, where nodes consist of a string , a
pointer to the parent (nil if the node is the root), a pointer to the left child(nil if none), and a pointer
to the right child(nil if none). The worst-case time to locate the node holding S i+1 given the node
holding Si over all i , 1≤S<N,and of all possible binary search trees for S1,S2,……SN has order
(A) 1 (B) log 2 N (C) N (D) N log 2 N (E) N 2
2+3*4-5
20 Assume that subtraction has precedence over addition and multiplication, which are of equal
precedence. Also assume that operators of equal precedence are evaluated left to right. What is the
value of the expression above?
(A) -5
(B) -1
(C) 0
(D) 9
(E) 15
21 The following routine, where procedure Swap exchange its argument, sorts an array A in descending
for j := 1 to N-1
for k := 1 to N-j
if A(k) < A(k+1) then
swap (A(k) , A(k+1))
if initially, for I= 1,2, …,N, then the number of the calls to Swap is
(A) N-1 (B) N (C) N(N-1)/2 (D) (N-1)(N-2) (E) N(N-1)

SET SET SET


D Q D Q D Q

CLR
Q CLR
Q CLR
Q

clock

22 Shift register? Has its output inverted and feed back to its input ,as shown in the figure above. The ?
which this device can cycle when clock is
(A)? (B) ? (C) 1 or 3 (D) 3 or 5 (E) 2 or 6
23 Consider the following recursive definition
? f = 1 if x = 1
f = (x-1)+2x-1 if x > 1
While of following of the positive integers does f(x) define ?

4
(A) 2x-1 (B) x2 (C) x(x+1)/2 (D) x2 - x+1 (E) 2x-1
24 ?computed to other complementation of symbol tables , hash-coded symbol tables are often
preferred for use in a compiler because they
(A) make it possible to keep track information about a program’s identifiers
(B) ? information hiding by transforming a program’s identifiers to disguised internal form
(C) ? if possible to encode lexical block level as part of an identifiers
(D) provide access to information about a program’s identifiers in nearly constant time
(E) acquire less space
25 A black-and white computer graphics display is divided up into an array of pixels as show bellow

Pixel

Each of the pixels can take one of eight gray levels ranging from 0(white) to 7(black). In order to prevent
sharp discontinuities of shade, the software system that causes pictures to be displayed enforces the rule
that the gray levels of two adjacent pixels cannot differ by more than two. How many the 64 possible
assignments of gray levels to two adjacent pixels satisfy this rule?
(A) 24 (B) 32 (C) 34 (D) 40 (E) 64
Questions 26-27 are based on the following information
If the variables are suitably initialized and if i remains within appropriated bounds , then the following
code complements stack operations Push and Pop when the stack is represented as a vector V[1,…N] and
a pointer i .
Push: begin c = x ; i := i+1 ; end
Pop: begin i := i-1; x := V[i] ; end
26 Which of the following give the correct initialization for this stack implementation ?
(A) i := 0 (B) i := 1 (C) i := N-1 (D) N (E) None of the above
27 If is assumed that suitable changes in the initialization code were also made , which of the following
changes to Push and Pop would yield a correct implementation of stack ?
Ⅰ. Replace the code for Push with that for Pop and vice versa
Ⅱ. Make Push decrement i and Pop increment i
Ⅲ. Reverse the order of the statements in both Push and Pop
(A) Ⅰonly (B) Ⅱonly (C) Ⅲonly (D) ⅠandⅡ (E)Ⅱand Ⅲ

X1

X2 Q

X3
28 A stuck-at-0 fault on the input X i of a circuit is a fault in which the circuit behaves as if X i = 0
regardless of the actual value applied . if the AND gates shown above has a stuck-at-0 fault on X 1 ,

5
which of the following represents the minimum set of inputs such that one among of them
guaranteed to signal the presence of the fault by means of an incorrect output at Q ?
(A) 011 (B) 111 (C) 011,111 (D) 000,001,010,011 (E) 100,101,110,111
29 During instruction interpretation , a processor may be in three states
(1) Fetch
(2) Defer(for indirect addressing)
(3) Execute
The interpretation of an instruction involves one of the following sequences states
Fetch only
Fetch followed by Execute
Fetch followed by Defer followed by Execute
The connectivity matrix for the states of this processor is

(A) 1 1 1 (B) 1 1 1 (C) 0 1 0


0 0 1 0 0 1 0 0 1
1 0 0 1 0 1 1 0 0

(D) 1 1 0 (E) 0 1 1
0 0 1 0 0 1
1 0 1 1 0 0

30 Which of the following is NOT a binary search tree


(A) 5

3 7

2 4

(B) 5

3 7

2 6

(C) 5

6
(D) 5

4 6

3 7

(E) 5

4 7

3 6

31 In the balanced number system the digit are 1, 0 and ~1 (for -1). For example, 1~1.0~1=1×21 -
1×20 + 0×2-1 - 1×2-2 = 3/4
Which of the following is NOT a balanced binary representation of the decimal number 6.25 ?
(A) 110.01 (B) 111. ~1~1 (C) 100~1.01
(D) 10~10.0~1 (E) 10~11. ~1~1
32 A computer communication network transmits data at a rate of 10,000,000 bits per second. The
speed at which data propagates on this network is 100,000 meters per second. If a message of 10,000
bits is send between two stations separated by 1,000 meters, how much time elapses between the
start of transmissions and the end of reception ?
(A) 0.001 sec (B) 0.0011 sec (C) 0.01 sec
(D) 0.011 sec (E) 0.11 sec
Virtual Actual
Page Page
0 3
1 --
2 4
3 0

33 The lookup page table shown above is for a job paged virtual storage system with a page size of
1,024 locations. Each virtual address is in the form [p, d] where page number and the displacement
in that page respectively.
A virtual address of [0, 514] maps to a actual address of
(A) 514 (B) 1024 (C) 3586 (D) 4514 (E) none of the above

34 Consider the following process .


begin
x:=y;
x:=x+l;
end

7
If x and y initially 0 and two copies of the process run concurrently sharing the same data. What is the set
of the possible values of x after both copies of the process terminate ?
(A) {1} (B) {2} (C) {1,2} (D) {0,1} (E) {0,1,2}
35 Which of the following indicates all integer values of n such that ? |log2(n+1)| = 1+ |log2n| ?
(A) All n≥1 (B) All n≥2 (C) All odd n≥1
(D) All even n≥2 (E) Only finitely many n
36 Consider the following program segment written in a block structured language (Which is not
Pascal) that uses a stack discipline for a allocating local variables.
begin
var x , y : real;
var i , j : integer;
for i: =1 to 10 do
begin
var j : integer;
j : = l;
end
for j : = 1 to 10 do
begin
var y : real;
y : = 2.0 * j
end
end ;
suppose integer variables and real variables require one word of storage per variable . How many words
of storage are required for the variables of the program segment above ?
(A) 4 (B) 5 (C) 6 (D) 14 (E) 24

BC
A 00 01 11 10

1 0 1 X

x 0 1 0

37 A switch function f (A,B,C) is defined by the Karnauph map shown in the figure above . The symbol
x denotes a “Don’t care”. Which of the following is NOT a valid expression of f ?
(A) (B∨~C)( ~A∨C) (B) ~A~B~C∨BC (C) (B∨~C)( ~A∨~B∨C) (D) (B∨~C)
(~B∨C) (E) B~C∨~BC

38 If the English vowels are coded by


A : 00
E : 01
I : 11
O: 110

8
U: 111
What is the average number of bits per vowel in coded message whose vowels are a, e, i, o, u have
relative frequency 2,3,2,2,1 respectively ?
(A) 2,2 (B) 2,3 (C) 2,4 (D) 2,5 (E) 2,6
39 (GR96-49) S→aS│b
The “parsing automation below is for context-free grammar with the productions indicated above .

a
S a·S
a S · aS S ·aS
Start S ·b S ·b

b b S

S b· S aS·

Each state includes certain “items”, which are productions with dots in their right sides. The parser using
this automation , with X1,X2,……Xn on the stack, reduces by the production A→a if and only if there is a
path labeled X1,X2,……Xn from the start states to a state that include the item A→a·(note the dot at the
right end)

Which of the following stack contents causes the parser to reduce by some production ?
(A) a (B) aa (C)bb (D)aaS (E) ε

40 Consider a singly linked list of the form

F L
F L

Where is a pointer to the first element in the list and is a pointer to the last element in the list. The time of
which of the following operation depend on the length of the list?
(A) Delete the last element in the list
(B) Delete the first element in the list
(C) Add an element after the last element in the list
(D) Add an element before the first element in the list
(E) None of the above

9
B
C

A A
B ∫
C C

A
B

41 The switching function∫(A,B,C) produced by the network shown in the figure above is given by
(A) ~ABC∨A~BC∨AB~C
(B) A~B~C∨~A~BC∨~AB~C
(C) BC∨CA∨AB
(D) ~A~B~C∨(B∨C)(C∨A)(A∨B)
(E) none of the above

42 If
  
F ( x)   x i  G ( x) 
i 0
 x Si .andF ( x)G ( x) 
i 0
Ax
i 0
i
i

Then AI=
(A) i/5 (B) (i/5)+1 (C) (i/5)-1 (D) (i/5) (E) (i/5)+1

Questions 43-44 are based on the following information


Consider a computer with a cache memory interposed between the processor and the primary memory.
The cache is k-way set-associative (for some fixed k); i.e., each location in primary memory “maps
to”(can be cached in) any of k locations in the cache. Let there be P locations in primary memory and C
locations in the cache.
43. On the average, how many different locations in primary memory map to a particular location in the
cache if k=2?
(A) 1 (B) 2 (C) P/C (D) 2P/C (E) P
44. If the value to the user of a k-way set-associative cache is proportional to log 2k and if the cost of
building such a cache is proportional to k, what integer value of k should a computer designer choose to
maximize the ratio of value to cost?
(A) 1 (B) 2 (C) 3 (D) 4 (E) C
45 In a radix –2 number system , the bit string
anan-1…a1a0 , where each aj∈[0,1], has the value

a
j o
j (2) j

10
which of the following is the correct representation of an increasing sequence of consecutive integers a
radix –2 ?
(A) –0110 -0111 –1000 -1001
(B) 01010 01001 01000 00111
(C) 00011 00111 01111 11111
(D) 00111 00100 00101 11010
(E) –0111 -0110 -0101 -0100

46. Consider the following program fragment


i := 0 ;
read (n) ;
while n>1 do
begin
n := n/2 ;
i := i+1 ;
end
If the value of n is 2k, where k is a positive integer, then the value of i at the fragment will be
(A) log2 (log2 n) (B) log2 n (C) n/2 (D) n-1 (E) 2n

G
H gate D
SET
Q X F D
SET
Q
Y

~X ~Y
CLR
Q CLR
Q

clock

47 A D-type flip-flop is a device that ,when clocked stores the value of its input. Two D-type flip-flops
and a gate , as shown in the figure above , are to implement a modulo-3 counter with X as the least
significant bit, i.e., to generate the count sequence YX=…,00,01,10,00….Which of the following
specifications of inputs F,G,H, and gate type, respectively, will accomplish this?
(A) X X Y NAND (B) X X Y NOR
(C) ~X ~X ~Y NOR (D) ~Y X Y AND
(F) X ~X ~Y NOR
48. A n-way tree is a tree in which each node either is a leaf or has exactly n children, which of the
following are true?
Ⅰ there is a 4-way tree with 6 leaves
Ⅱ if n is odd, there are no nonempty trees with an even number of leaves
Ⅲ if n is even, there are no nonempty trees with an even number of nodes
(A) Ⅰonly (B) Ⅱ only (C) Ⅲ only
(D) Ⅱand Ⅲ only (E) Ⅰ、Ⅱ and Ⅲ

49. A terminal or nonterminal symbol X in a context-free grammar with start symbol S is useful if there

11
is a derivation S  uXv  uwv, where u, v, and w are strings of terminals. (Note that means “derives
in 0 or more steps.”) In the following grammar, where S, A, and B are nonterminals, and a and b are
terminals, which symbol is useful?
S → AS | AB
A→a
B → aB | bB
(A) A (B) B (C) S (D) a (E) None of the above

50 Consider the regular expression


R 1 0* 1* 0
and the finite automation, M with the start state A shown below

start A B D E

In order for M to accept exactly the strings in the language defined by R, the set of all accepting state(s)
of M must be
(A) { C } (B) { E } (C) { D、E } (D) { C、E } (E) { C、D、E }
51. Suppose that a stack is used to evaluate fully parenthesized arithmetic expressions from left to right.
Each operand is placed on the stack, and operators operate on the top two elements of the stack. What is
the minimum stack size required for evaluation of the expression below?
(((a * b) + c) – (d * e))
(A) 1 (B) 2 (C) 3 (D) 4 (E) 5
52. Let L be an identity function, meaning
(x) l (x) = x
Let U be a unit function, meaning
(x) U(x) = L
Let ∫ be an arbitrary function, meaning
(x y) ∫(x) = y
Which of the following is FALSE for some x and some∫?
(A) U (∫(l (x))) = U (l (∫(x)))
(B) l (U (∫ (x))) = ∫(U (l (x)))
(C) ∫(l(U (x))) = l (∫(U(x)))
(D)∫(U (l (x))) =∫(l (U (x)))
(E) l (U (∫(x))) = U (l (∫(x)))
53. If the factorial function for real x is defined by
x (n) = x ( x –1 ) ( x – 2 )….( x – n + 1 ) for all positive integers n, and

12
x (0) = 1,
then ( x + 1 ) (n) – x ( n) =
(A) ( n – 1 ) ( n – 1) (B) ( n – 1 ) ( x + 1 ) ( n) (C) ( n – 1 ) ( x + 1 ) ( n – 1) (D) nx
( n – 1)

(E) n( x + 1 ) ( n – 1)

54. A floating-point number, Which is a fractional part times a power of 2, is represented in a


hypothetical computer by:
s e m
7 bits 24bits
The exponent part e is a 7-bit, excess 64 integer. The mantissa m is a signed magnitude fraction with sign
bit s and effective magnitude of 25 bits consisting of a implied leftmost 1 followed by the 24 bits of m.
The value of the number represented by
1 1010101 11000…0
is
(A) –0.125 × 2-43 (B) –0.75 × 2-43 (C) –0.125 × 221
(D) –0.75 × 221 (E) –0.875 × 221
55. A multiple-function unit CPU has two adders, two multipliers, and a divider. Assume that all
arithmetic operations take unit time and that the time to load the inputs of a function unit is negligible.
Another piece of hardware supplies operands to the function units so as to maximize at each step the
number of operations that can be properly performed simultaneously. How many time units does the
CPU take to execute the following program fragment?
a := b + c ;
d := e * f ;
g := e * c ;
h := d + e;
b := a / c ;
g := g / d
(A) Two (B) Three (C) Four (D) Five (E) Six

56 . var i, j, x : integer
read(x);
i : = 1;
j : = 1;
while i < 10 do
begin
j : = j * i;
i : = i + 1;
if i = x then
exit;
end
For the program fragment above, written in a Pascal-like language, which of the following statements
about the variables i and j must be true after execution of the fragment ?

13
(A) ( j = (x-1)!) ^ ( i ≧ x)
(B) ( j = 9!) ^ ( i = 10)
(C) ( j = 10!) ^ ( i =10)
D 和 E 看不清。

Questions 57-58 are based on a linked list of records of type dnode as shown below.
A record of type dnode has two fields : val, which is of type integer, and link, which is of type pointer to
donde.

As in Pascal , let X.∫denote field∫of data item X, and let Y| be the object to which data item Y points.
HEAD
4 8 17 14

SPOT

BLOB
12

57. If HEAD. SPOT and BLOB are all variables, of type pointer to dnode, which sequence of operations
should be executed in order to insert the record to which BLOB points after the record to which SPOT
points?
(A) SPOT : = BLOB; SPOT|.val : = BLOB|.val
(B) SPOT|.val : = BLOB|.val; SPOT|.link : = BLOB|.link
(C) BLOB|.link : = SPOT|.link; SPOT|.link : = BLOB
(D) SPOT|.link : = BLOB; BLOB|.link : = SPOT|.link
(E) SPOT|.link : = SPOT|.link; SPOT| : = BLOB|
58. Let p and q be of type pointer to dnode and consider the following list structure.

p q

3 8 7 5

With no references other than the ones shown, assume that a reference-contend garbage-collection
discipline is in use. Which of the following assignment statements frees one or more cells that are NOT
properly recovered ?
(A) q : = p (B) p : = q (C) q| .link : = p (D) p| .link : = q (E) p : = p| .link
59. Which of the following is NOT a context-free language?
(A) {0i 1j | i = j 2}

14
(B) {0 j 1j 0k | I + k =j}
(C) {0i 1j 0k | i + j = k}
(D) {0i 1j | i ≠ j}
(E) {0i 1j | i ≤ j ≤ 2i}
60 For n >= 0, let Sn be the number of the 2n subsets of {1, 2, …., n } that do not contain two
consecutive integers. Which of the following is a recurrence relation that correctly determines the S n’s?
(A) S0 = 1, Sn = 2Sn-1 – 1, n >= 1
(B) S0 = 1, S1 = 2, Sn = Sn-1 + Sn-2 , n >= 2
(C) S0 = 1, Sn = 2Sn-1 + 1, n >= 1
(D) S0 = 1, S1 = 2, Sn = Sn-1 + Sn-2 + 1, n >= 2
(F) None of the above.

Questions 61-62 are based on the following information.


A palindrome is a string that reads the same from left to right as it does from right to left. Let S be a
string and S[k] be the kth character in the string . Let the positive integer n be the number of characters in
S. Consider the following program for determining whether or not S is a palindrome
PAL : = True;
i : = 1; j : = n;
while _ _ _ do
begin i : = i + 1; j: = j – 1 end; (1)
if j > i then
PAL : = false;
61. Which of the following expressions in place of the “_ _ _”in the program above will make the
program correct (PAL has value true at the end of the program if S is a palindrome and false otherwise ) ?
(A) S[i] ≠ S[j] or j ≦ i (B) S[i] ≠ S[j] and j ≦ i (C) S[i] = S[j] or j > i
(D) S[i] = S[j] and j ≦ i (E) S[i] = S[j] and j > i

62. Let n be even. Suppose that half of all the strings S presented to the program are palindromes and that
of the others. It is equally probable that the test for being a palindrome will fail the first time for each of
the pairs S[1] – S[n], S[2] – S[n-1], ……, S[n/2] – S[n/2 + 1] where n is the length of the string. On the
average, how many times will the statements labeled(1) be executed ?
(A) n/4 + 1/8 (B) 3n/8 – 1/4 (C) n/2 (D) n – 1/n (E) n

x2 y2 x1 y1 x0 y0

Z 15
63 The logic circuit above is used to compare two unsigned 3-bit numbers. X 2X1X0 = X and Y2Y1Y0 =
Y. where X0 and Y0 are the least significant bits. ( In general, a small circle on any line in a logic
diagram indicates logical not.)
Which of the following always makes the output Z = 1?
(A) X > Y (B) X < Y (C) X = Y (D) X ≧ Y (E) X ≠ Y

S→S + S
S→S • S
S→a
64. How many distinct parse trees does the string
a+a•a+a
have under the grammar above?
(A) Five (B) Six (C) Seven (D) Eight (E) Nine
65. Let S be the statement:
for i := 1 to N do V[i] := V[i]+1
Which of the following perform(s) the same changes to V as S?
I. i:= 0;
while i≤N do
begin i:=i+1; V[i] := V[i]+1 end.
II. i:= 1;
while i<N do
begin V[i] := V[i]+1; i:=i+1 end.
III. i:=0
while i<N do
begin V[i+1] := V[i+1]+1; i:=i+1 end.
(A) I only (B) II only (C) III only
(D) II and III only (E) I and II and III

66. A committee is a group of one or more people. One of whom is designated as its head. Which of the
following expressions correctly describe the number of different committees that can be formed from a
group of N people? ( Two selections of the same people with two different people as heads count as
different committees.)
I. N 2 N-1

N N
I . _  i N N
I .i_1Ni   
i0 i 16
(A) I only (B) II only (C) III only
(D) I and II (E) I and III

67. p := 1; k := 0;
while k<n do
begin
p := 2*p;
k := k+1
end;
For the program fragment above involving integers p, k, and n, which of the following is a loop invariant,
i.e., true at the beginning of each execution of the loop and at the completion of the loop?
(A) p = k+1 (B) p = (k+1) 2 (C) p = (k+1)*2 k
(D) p=2 k (E) p=2 k+1

Questions 68-70 are based on the following information.


A relation is a set of k-tuples for some fixed k. Normally, the k-tuples are shown as rows of a table, and
the columns are headed by attributes. As an example, consider the following relation, R 0.
A B C
0 2 5
4 2 3
0 6 5
4 1 5

Note that the attributes are A, B, and C; and one of the four 3-tuples is (0,2,5), which has 0 as its A-
component, 2 as its B-component, and 5 as its C-component.
The projection PROJ(R,X) of a relation R onto a subset X of its attributes is the relation formed by
deleting from the tuples of R those components corresponding to attributes not in X. If two or more
tuples thereby become identical, all but one copy is removed from the projection.
The selection SEL(R,P) of a relation R by a condition P is the relation formed by deleting all those
tuples that do not satisfy P. (A tuple t satisfies P if P is true when attributes occurring in P are replaced by
the corresponding component values from t.)

68. For the example relation R0 above,


PROJ ( SEL (R0, A<C ), {A,B})
is which of the following relations?
(A) A B (B) A B C
0 2 0 2 5
0 6 0 6 5
4 1 4 1 5

(C) A B C (D) A C (E) A B


0 2 5 0 5 0 2

17
0 6 5 4 5 0 6
0 6 5

69. Which of the following must be true for arbitrary relatons R, subsets X of the attributes of R, and
conditions P that invlove only attributes in X?
I. PROJ ( SEL(R,P), X) contains every tuple in SEL( PROJ(R,X), P).
II. SEL( PROJ(R,X), P) contains every tuple in PROJ(SEL(R,P), X).
III. The number of tuples in PROJ(R,X) is greater than or equal to the number of tuples in SEL(R,P).
(A) I only (B) I and II only (C) I and III only
(D) II and III only (E) I, II and III

70. A relation R is said to satisfy the functional dependency X-Y, where X and Y are attributes of R, if
every pair of tuples in R that have equal values in their X-components also have equal values in their Y-
components. Which of the following functional dependencies does the example relation R 0 above satisfy?
(A) A-B (B) A-C (C) B-C (D) C-A (E)None of the above

71. A 4-to-1 multiplexer has input terminals labeled A, B, C 0, C1, C2, C3, an output terminal F and
implements the Boolean function :
F = C0~B~A ∨ C1~BA ∨ C2B~A ∨ C3BA
Thus , in the figure.

0 ~Z 1 0

C0 C1 C2 C3
X B

Y A
F

where signals X, Y, ~Z and the constants 0 and 1 are connected as shown., the multiplexer implements
the function:
~Z~XY ∨ X~Y
which of the following input combinations would NOT yield this function ?

A B C0 C1 C2 C3
Ⅰ X Y 0 1 ~Z 0
Ⅱ Y Z X ~Y X 0

X Z Y ~Y 0 ~Y

18
Ⅳ Z Y X X ~X 0

(A)Ⅰ (B) Ⅱ (C) Ⅲ (D) Ⅳ


(E) All of the input combinations listed would yield this function

Faulty

U1 U2

Faulty

72. The directed graph shown above represents a system of two processors U1 and U2, diagnosing one
another, with each one indicating that the other is faulty. It is assured that a correctly functioning
processor will always correctly diagnose the other processor, but that a faulty processor may indicate that
the processor it is testing is either correct or faulty regardless of the latter’s actual condition. The four
possibilities that can occur are indicated as A1, A2, A3, A4 below.

U1 U2
A1 Correct Correct
A2 Correct Faulty
A3 Faulty Correct
A4 Faulty Faulty
(A) {A2} (B) {A3} (C) {A4} (D) {A2, A3} (E) {A2, A3, A4}

73. Consider the following simultaneous equations.


3x+ 9y + 6z=35
7x+21y+ 14z=15
5x+ 8y+ z=25
Which of the following is true?
(A) There exists a unique set of values for x, y, and z that satisfies these equations; all the values have
the same sign.
(B) There exists a unique set of values for x, y, and z that satisfies these equations; not all the values
have the same sign.
(C) There exist many sets of values for x, y, and z that satisfy these equations.
(D) There does not exist any set of values for x, y, and z that satisfies these equations.
(E) This problem is ill conditioned, and computer solutions will be extremely inaccurate.

19
Questions 74-76 are based on the following information.
The retrieval of a record from a new type of storage device, given a key x for this record, is broken
up into three processes P1, P2, and P3, as illustrated below.

x X’ X’’(x)
P1 PRecord
2 P3

For example, P1 might hash x, P2 compute an address from the hashed value, and P 3 perform the
actual retrieve, but the details of what the process do are irrelevant. It is only important to know that the
processes must occur sequentially; Pi can not begin until Pi-1 has been completed.
Suppose P1, P2, and P3 require times t1, t2, and t3, respectively.
74 The minimum delay between the time P1 receives a key x and the time the Record(x) is retrieved is
(A) t1 (B) t3 (C) max(t1, t2, t3) (D) min(t1, t2, t3) (E) t1+ t2+ t3

75 Suppose that there are three processors, with P 1, P2, and P3 each having its own dedicated processors.
Let r be the minimum average time interval between requests that the system can handle unbounded
delays, which of the following defines r ?
(A) r = t1+ t2+ t3 (B) r = ( t1+ t2+ t3)/3 (C) r =max(t1, t2, t3)
(D) r = min(t1, t2, t3) (E) 3/(1/ t1+1/ t2+1/ t3)

76 Suppose that there are three processors, but each one can execute any of P 1, P2, and P3. Let r be the
minimum time interval between requests that the system can handle without unbounded delays. Which of
the following defines r ?
(A) r = t1+ t2+ t3 (B) r = (t1+ t2+ t3)/3 (C) r = max(t1, t2, t3)
(E) r =min(t1, t2, t3) (E) r = 3/(1/ t1+1/ t2+1/ t3)

Questions 77-78 are based on the following program fragment:


var x, y : integer ;
procedure P( var a, b, c : integer) ;
begin
a := b + x ;
b := c + y
end;
begin
x := 10 ;
y := 15 ;
P (y, x, y);
Write ( x, y)
end
77. If the implementation of var parameters is call-by-reference, what is written by this fragment?
(A) 40, 20 (B) 30, 15 (C) 10, 15 (D) 35, 20 (E) 30, 25

78. If the implementation of var parameters is call-by-value-result with values of arguments restored in

20
left-to-right order, what is written by this fragment?
(A) 40, 20 (B) 30, 15 (C) 10, 15 (D) 35, 20 (E) 30, 25

79 A finite state machine, comprising a 2-bit register and an 8-word by 2-bit read-only-memory (ROM),
is organized as shown in the figure. The input signal, X, may be 0 or 1 and is assumed not to change
when a clock pulse occurs, which causes the current ROM output to be loaded into the register. The
ROM contents are shown in the table beside the figure.

clock > REGISTER

D D1
A2 2
A1 ROM

X A0

Address Data
A2 A1 A0 D2 D1
0 0 0 1 1
0 0 1 0 1
0 1 0 0 0
0 1 1 1 0
1 0 0 0 1
1 0 1 1 1
1 1 0 1 0
1 1 1 0 0

Of the following, which best describes this machine?


(A) A three – bit counter
(B) A two-bit up/down counter
(C) A three-bit to two-bit data compressor

21
(D) A controller for an eight-state computer
(E) A three-bit shift register

80. A 2-to-1 multiplexer and a depth-k tree of 2-to-1 multiplexers are shown below.
xk
xi
Xk-1
a x2
xk
b ∫=xia∨~xib ...
X1

. .
... x2
xk . .
. .

Xk-1

xk
...

For a depth-n multiplexer tree consider the statement:


If the inputs(other than those labeled by some Xj) are chosen
from the set S(n) then the tree can be used to realize any
combinational function of i(n) variables.
Which of the following choices for S(n) and i(n) will make the statement true?
I. S(n) = {0, 1} i (n) = n
II. S(n) = {0, 1, Xn+1, ~Xn+1} i (n) = n+1
III. S(n) = {0, 1, Xn+1} i (n) = n+1
(A) None (B)I only (C)II only
(D)I and II only (E)I、 II and III

ANSWER

22
EDACC AADDE CADDB E(D)AACA
CEBDC BEBAE CDCCA BEBBA
ABDCD BBDED CBDEB ECBAC
EBA?AC DDABE EEDEC B?ABBD

80 实际上就是由左图为结点组成的一个满二叉树,左子树的 f 连到父结点的 a, 右子树的 f 连到


父结点的 b ,最低层有 2*2 k-1=2 k 个输入端,整个二叉树有 k 层,第 i 层的 X 为 Xi. 答案是
(D)
58. 答案是(B) p:=q .我觉得答案应该是 A, 因为这样原来 q 所指的单元的引用记数就为 0 了,系统
才会自动回收
59. 答案是 A 凭直觉就可以知道是 A,但是有没有一种可行的方法来判断一个文法到底属于哪类
文法(0,1,2,3 型)?如果要自己构造就太慢了。

23

You might also like