11 |
The best data structure to check whether an
arithmetic expression has balanced parentheses is a |
Options |
A) queue |
B) stack
|
C) tree |
D) list
|
|
Correct Answer |
B |
|
12 |
A Priority-Queue is implemented as a Max-Heap.
Initially, it has 5 elements. The level-order traversal of the heap
is given below:
10, 8,5,3,2
Two new elements 1 and 7 are inserted in the heap in that order. The
level-order traversal of the heap after the insertion of the
elements is |
Options |
A) 10,8,7,5,3,2,1 |
B) 10,8,7,2,3,1,5 |
C) 10,8,7,1,2,3,5 |
D) 10,8,7,3,2,1,5 |
|
Correct Answer |
D |
|
13 |
Consider the following C program segment
struct CellNode {
struct CellNode *leftChild ;
int element;
struct CellNode *rightChild ;
};
int DoSomething (struct CellNode *ptr)
{
int value = 0 ; if (ptr ! = NULL)
{ if (ptr->leftChild ! = NULL)
value = 1 + DoSomething (ptr - > leftChild) ;
if (ptr - > rightChild ! = NULL)
value = max (value, 1 + DoSomething (ptr - >
rightChild)) ;
}
return (value);
}
The value returned by the function DoSomething when a pointer to
the root of a
non-empty tree is passed as argument is
|
Options |
A) The number of leaf nodes in the tree
|
B) The number of nodes in the tree |
C) The number of internal nodes in the tree |
D) The height of the tree
|
|
Correct Answer |
D |
|
14 |
An organization has a class B network and
wishes to form subnets for 64 departments. The subnet mask would be |
Options |
A) 255.255.0.0 |
B) 255.255.64.0
|
C) 255.255.128.0 |
D) 255.255.252.0 |
|
Correct Answer |
D |
|
15 |
Suppose the round trip propagation delay for a
10 Mbps Ethernet having 48-bit jamming signal is 46.4 ms.
The minimum frame size is: |
Options |
A) 94 |
B) 416 |
C) 464 |
D) 512 |
|
Correct Answer |
C |
|
16 |
Consider the following C program segment:
char p [ 20];
char * s = "string" ;
int length = strlen (s) ;
for (i = 0 ; i < length; i++)
p[ i ] = s [length - i] ;
print f ("%s", p) ;
The output of the program is
|
Correct Answer |
A |
|
17 |
Consider the grammar
S ® (S) | a
Let the number of states in SLR(1), LR(1) and LALR(1) parsers for
the grammar be n1, n2 and n3
respectively. The following relationship holds good |
Options |
A) n1< n2 < n3 |
B) n1= n3 < n2 |
C) n1= n2 = n3 |
D) n1 ³ n3
³ n2 |
|
Correct Answer |
B |
|
18 |
Consider the following C function:
int f (int n)
{ static int i = 1;
if (n >= 5) return n;
n = n + i;
i ++;
return f (n);
}
The value returned by f(1) is
|
Options |
|
Correct Answer |
C |
|
19 |
Consider the following code fragment:
if (fork ( ) = = 0)
{a = a + 5; print f (“%d, %d / n”, a, and a); }
else {a - 5; print f (“ %d, %d / n”, a,& a); }
Let u, v be the values printed by the parent process, and x, y be
the values printed by the child process. Which one of the following
is TRUE? |
Options |
A) u = x + 10 and v = y |
B) u = x + 10 and v ¹ y |
C) u + 10 =x and v = y |
D) u + 10 = x and v ¹ y |
|
Correct Answer |
B |
|
20 |
The following numbers are inserted into an
empty binary search tree in the given order: 10, 1, 3, 5, 15, 12,
16. What is the height of the binary search tree (the height is the
maximum distance of a leaf node from the root)? |
Options |
|
Correct Answer |
B |