A directory of Objective Type Questions covering all the Computer Science subjects. Here you can access and discuss Multiple choice questions and answers for various compitative exams and interviews.

51. The most appropriate matching for the following pairs

X: depth first search 1: heap
Y: breadth-first search 2: queue
Z: sorting 3: stack

is
a. X—1, Y—2 ,Z --3
b. X—3, Y—1, Z --2
c. X—3, Y—2, Z--1
d. X—2 ,Y—3 ,Z--1
View Answer Report Discuss Too Difficult! Search Google
Answer: (c).X—3, Y—2, Z--1

52. Consider the following nested representation of binary trees: (X Y Z) indicates Y and Z are the left and right sub stress, respectively, of node X. Note that Y and Z may be NULL, or further nested. Which of the following represents a valid binary tree?
a. (1 2 (4 5 6 7))
b. (1 (2 3 4) 5 6) 7)
c. (1 (2 3 4)(5 6 7))
d. (1 (2 3 NULL) (4 5))
View Answer Report Discuss Too Difficult! Search Google
Answer: (c).(1 (2 3 4)(5 6 7))

53. Let s be a sorted array of n integers. Let t(n) denote the time taken for the most efficient algorithm to determined if there are two elements with sum less than 1000 in s. which of the following statements is true?

a) t (n) is O(1)
b) n < t (n) < n log2n
c) n log 2 n < t (n) < (n/2)
d) t (n) = [/Tex]{n \choose 2} [/Tex]
a. a
b. b
c. c
d. d
View Answer Report Discuss Too Difficult! Search Google
Answer: (a).a

54. Aliasing in the context of programming languages refers to
a. multiple variables having the same memory location
b. multiple variables having the same value
c. multiple variables having the same identifier
d. multiple uses of the same variable
View Answer Report Discuss Too Difficult! Search Google
Answer: (a).multiple variables having the same memory location

55. Consider the following C declaration

struct {
short s [5]
union {
float y;
long z;
}u;
} t;

Assume that objects of the type short, float and long occupy 2 bytes, 4 bytes and 8 bytes, respectively. The memory requirement for variable t, ignoring alignment considerations, is
a. 22 bytes
b. 14 bytes
c. 18 bytes
d. 10 bytes
View Answer Report Discuss Too Difficult! Search Google
Answer: (c).18 bytes

56. The number of tokens in the following C statement

printf("i = %d, &i = %x", i, &i);

is
a. 3
b. 26
c. 10
d. 21
View Answer Report Discuss Too Difficult! Search Google
Answer: (c).10

57. B+ trees are preferred to binary trees in databases because
a. Disk capacities are greater than memory capacities
b. Disk access is much slower than memory access
c. Disk data transfer rates are much less than memory data transfer rates
d. Disks are more reliable than memory
View Answer Report Discuss Too Difficult! Search Google
Answer: (b).Disk access is much slower than memory access

58. Suppose you are given an array s[1..n] and a procedure reverse (s, i, j) which reverses the order of elements in a between positions i and j (both inclusive). What does the following sequence do, where 1 <= k <= n:

reverse(s, 1, k) ;
reverse(s, k + 1, n);
reverse(s, l, n);
a. Rotates s left by k positions
b. Leaves s unchanged
c. Reverses all elements of s
d. None of the above
View Answer Report Discuss Too Difficult! Search Google
Answer: (a).Rotates s left by k positions

59. Let LASTPOST, LASTIN and LASTPRE denote the last vertex visited in a postorder, inorder and preorder traversal, respectively, of a complete binary tree. Which of the following is always true?
a. LASTIN = LASTPOST
b. LASTIN = LASTPRE
c. LASTPRE = LASTPOST
d. None of the above
View Answer Report Discuss Too Difficult! Search Google
Answer: (d).None of the above

60. Consider the following functions. Which of the following is true?
f(n) is O(g(n)) Big-oh notation
a. h(n) is O(f(n))
b. h(n) is O(g(n))
c. g(n) is not O(f(n))
d. f(n) is O(g(n))
View Answer Report Discuss Too Difficult! Search Google
Answer: (d).f(n) is O(g(n))

Page 6 of 12