Saturday, June 21, 2008

CS - Paper - 1


1. In a box there are random number of white and black marbles. At a time two marbles are taken out at random and if
i. Both Black: Discard both and insert a white.
ii. Both White: Discard one and retain one.
iii. One Black and One White: Discard White and retain Black.
If initially there are nb black and nw white marbles then determine the color of the only marble remaining at the end.

A. white if nb is even.
B. white if nw is odd.
C. black if nb is even.
D. black if nw is odd.
_________________________________________________

2. In an MxN matrix such that all non-zero entries are covered in a rows and b columns. Then the maximum number of non-zero entries, such that no two are on the same row or column, is

A. <= a + b
B. <= max {a, b}
C. <= min {M-a, N-b}
D. <= min {a, b}
________________________________________________

3. The best data structure to check whether an arithmetic expression has balanced parentheses is a

A. queue
B. stack
C. tree
D. list
_________________________________________________

4. 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

A. 5
B. 6
C. 7
D. 8
_________________________________________________

5. The address resolution protocol (ARP) is used for

A. Finding the IP address from the DNS
B. Finding the IP address of the default gateway
C. Finding the IP address that corresponds to a MAC address
D. Finding the MAC address that corresponds to an IP address
_________________________________________________

6. Let G be a simple graph with 20 vertices and 100 edges. The size of the minimum vertex cover of G is 8. Then, the size of the maximum independent set of G is

A. 12
B. 8
C. Less than 8
D. More than 12
_________________________________________________

7. In a network of LANs connected by bridges, packets are sent from one LAN to another through intermediate bridges. Since more than one path may exist between two LANs, packets may have to be routed through multiple bridges.Why is the spanning tree algorithm used for bridge-routing?

A. For shortest path routing between LANs
B. For avoiding loops in the routing paths
C. For fault tolerance
D. For minimizing collisions
_________________________________________________

8. Consider the following statements with respect to user-level threads andkernel-supported threads
(i) Context switch is faster with kernel-supported threads
(ii) For user-level threads, a system call can block the entire process
(iii) Kernel-supported threads can be scheduled independently
(iv) User-level threads are transparent to the kernelWhich of the above statements are true?

A. (ii), (iii) and (iv) only
B. (ii) and (iii) only
C. (i), and (iii) only
D. (i) and (ii) only
_________________________________________________

9. Postorder traversal of a given binary search tree, T produces the following sequence of keys10, 9, 23, 22, 27, 25, 15, 50, 95, 60, 40, 29Which one of the following sequences of keys can be the result of an inorder traversal of the tree T?

A. 9, 10, 15, 22, 23, 25, 27, 29, 40, 50, 60, 95
B. 9, 10, 15, 22, 40, 50, 60, 95, 23, 25, 27, 29
C. 29, 15, 9, 10, 25, 22, 23, 27, 40, 60, 50, 95
D. 95, 50, 60, 40, 27, 23, 22, 25, 10, 9, 15, 29
_________________________________________________

10. The order of an internal node in a B+ tree index is the maximum number of children it can have. Suppose that a child pointer takes 6 bytes, the search field value takes 14 bytes, and the block size is 512 bytes. What is the order of the internal node?

A. 24
B. 25
C. 26
D. 27
_________________________________________________

11. Consider the following code fragment:
if(fork( ) = = 0)
{
a = a + 5;
printf(“%d, %d / n”, a, and a);
}
else
{
a - 5;
printf(“ %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?

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
_________________________________________________

12. Consider the grammar
E -> E + n | E x n | n
For a sentence n + n x n, the handles in the right-sentential form of the reduction are

A. n, E + n and E + n x n
B. n, E + n and E + E x n
C. n, n + n and n + n x n
D. n, E + n and E x n
_________________________________________________

13. Which one of the following are essential features of an object-orientedprogramming language?
(i) Abstraction and encapsulation
(ii) Strictly-typedness
(iii) Type-safe property coupled with sub-type rule
(iv) Polymorphism in the presence of inheritance

A. (i) and (ii) only
B. (i) and (iv) only
C. (i), (ii) and (iv) only
D. (i), (iii) and (iv) only
_________________________________________________

14. Let f: B -> C and g: A -> B be two functions and let h = f o g. Given that h is an onto function. Which one of the following is TRUE?

A. f and g should both be onto functions.
B. f should be onto but g need not be onto
C. g should be onto but f need not be onto
D. both f and g need not be onto
_________________________________________________

15. If 73x (in base-x number system) is equal to 54y (in base-y number system), the possible values of x and y are

A. 8, 16
B. 10, 12
C. 9, 13
D. 8, 11
_________________________________________________

16. Consider the languages
L1 = {ww^R | w belongs to {0, 1}*}
L2 = {w#w^R | w belongs to {0, 1}*}, where # is a special symbol
L3 = {ww | w belongs to {0, 1}*}
Which one of the following is TRUE?

A. L1 is a deterministic CFL
B. L2 is a deterministic CFL
C. L3 is a CFL, but not a deterministic CFL
D. L3 is a deterministic CFL
_________________________________________________

17. Consider the following C function

void swap(int a, int b)
{
int temp;
temp = a;
a = b;
b = temp;
}
In order to exchange the values of two variables x and y.

A. call swap(x, y)
B. call swap(&x, &y)
C. swap(x, y) cannot be used as it does not return any value
D. swap (x, y) cannot be used as the parameters are passed by value
_________________________________________________

18. Consider the following C program
main ()
{ int x, y, m, n ;
scanf (”%d %d”, &x, &y);
/ * Assume x > 0 and y > 0 * /
m = x;
n = y ;
while ( m ! = n)
{ if (m > n)m = m — n;
elsen = n - m ;
}
printf(”%d”,n);
}
The program computes

A. x + y, using repeated subtraction
B. x mod y using repeated subtraction
C. the greatest common divisor of x and y
D. the least common multiple of x and y
_________________________________________________

19. In a certain machine data references constitute 40% of the mix, and that the ideal CPI of the pipelined machine is 1. Assume that the machine with structural hazards has a clock rate that is 1.05 times higher than the clock rate of machine without hazard. What is effective speedup with pipelining without structural hazard?

A. 1.05
B. 1.3
C. 1
D. none of above
_________________________________________________

20. An organization has a class B network and wishes to form subnets for 64 departments. The subnet mask would be

A. 255.255.0.0
B. 255.255.64.0
C. 255.255.128.0
D. 255.255.252.0
_________________________________________________
_________________________________________________

Answers

1. A
2. A
3. B
4. C
5. D
6. A
7. B
8. A
9. A
10. C
11. B
12. D
13. B
14. B
15. D
16. B
17. B
18. C
19. B
20. D

Related Articles :


Stumble
Delicious
Technorati
Twitter
Facebook

0 comments:

Post a Comment

Career Launchers!!!

Note:

This blog can be viewed using all the browsers but can be best viewed in Mozilla Browser.
 

Career Launchers!!! Copyright © 2010 LKart Theme is Designed by Lasantha