Beruflich Dokumente
Kultur Dokumente
D
. NIL pointer
A N S W E R:
D
10. If a stack conta ined the entrie s
w
,
x
,
y
,
z
( f rom top to bot tom) , which of the fo ll owing would be the
c onte nts a fte r two e ntrie s we re re m ove d a nd the e ntry
r
was inserted?
A.
w
,
x
,
r
B.
y
,
z
,
r
C.
r
,
y
,
z
D.
r
,
w
,
x
A N S W E R:
C
1 1 . I f a qu e u e co nt a i ne d t he e nt ri e s
w
,
x
,
y
,
z
(from hea d to tail), which of the following would be the
c on te nt s a fte r tw o e nt ri e s w e re re m o ve d a n d t he e nt ry
r
was inserted?
A.
w
,
x
,
r
B.
y
,
z
,
r
C.
r
,
y
,
z
D.
r
,
w
,
x
A N S W E R:
B
12. If the number of nodes in a binary tree is 2
n
(where
n
is a positive inte ge r) , the n the entire tree
would contain at least
A. 2
n
+1
nodes
B
. 2
2
n
nodes
C. 2
n
+1
- 1 nodes
D. 2
n
+2
nodes
A N S W E R:
C
A. 4
B. 7
C. 15
D. 31
A N S W E R:
C
14. The node s in which of the trees below will be printe d in
a lphabetical orde r by the following
recursive procedure?
procedure printTree (Tree)
if (Tree is not empty)
then (print the root node;
apply the procedure printTree to the right subtree of Tree;
apply the procedure printTree to the left subtree of Tree)
A.
B.
C.
A N S W E R:
C
15. The nodes in which of the trees below will be printed in a
lphabetical order by the following
recursive procedure?
procedure printTree (Tree)
if (Tree is not empty)
then (apply the procedure printTree to the left subtree of Tree;
apply the procedure printTree to the right subtree of Tree;
print the root node)
A.
B.
C.
A N S W E R:
B
16. The table below represents a portion of a compute rs ma
in memory containing a binary tree. Each
node consists of three cells, the fi rst being data, the second
being a pointe
r to the nodes left child, and
the third being a pointer to the nodes right child. If the nil p
ointer is represented by 00 and the trees
root pointer contains 50, which of the following is a picture of
the tree?
Address
Contents
50
51
56
52
53
53
54
00
55
00
56
57
00
58
00
A.
B.
C.
A N S W E R:
C
17. Suppose a binary tree is implemented as a linked structur
e in which each node contains both a left
c hild pointe r and a right child pointe r. W hich of the followin
g sta te me nts is fa lse?
Address
Contents
50
51
52
53
54
55
56
A. W
B. X
C. Y
D. Z
A N S W E R:
C
19. The table below represents a portion of a compute rs ma
in memory containing a binary tree stored
row by ro w in a cont iguous bl ock as des cri be d in the cha pte
r. W ha t is the pa re nt of the node Z?
Address
Contents
50
51
52
53
54
55
56
A.
B. U
C. V
D. Y
A N S W E R:
C
20. In a machine language, the technique in which the data
to be manipulated by an instruction is
included within the instruction itself is called
A. I m m e d i a t e a d d re s s i n g
B. Direct addressing
C. Indirect addressing
A N S W E R:
A
21. In a machine language, the technique in which an instruc
tion contains the location of a pointer to
the da ta to be manipula te d is ca lled
A. I m m e d i a t e a d d re s s i n g
B. Direct addressing
C. Indirect addressing
A N S W E R:
C