Friday, September 17, 2010

GATE Questions: Computer Science and Engineering (2003)

1. Consider the following C function.

float f(float x, int y)
{
    float p, s; int i;
    for (s=1, p=1, i=1; i < y; i++) {
        p *= x/i;
        s += p;
    }
    return s;
}
For large values of y, the return value of function f best approximates?

Ans: 1 + x + (x^2/2!) + (x^3/3!) +... = e^x

2. Assume the following C variable declaration
int * A[10], B[10][10];
of the following expressions
1) A[2]    2) A[2][3]    3) B[1]    4) B[2][3]
Which will not give compile-time errors if used as left hand sides of assignment statements in a C program?

Ans: 1), 2) and 4) only

3. Which of the following assertions is FALSE about the Internet Protocol (IP)?
A) It is possible for a computer to have multiple addresses
B) IP packets from the same source to the same destination can take different routes in the network
C) IP ensures that a packet is discarded if it is unable to reach its destination within a given number of hops
D) The packet source cannot set the route of the outgoing packets; the route is determined only the routing tables in routers on the way.

Ans: A)

4. Which of the following functionalities must be implemented by a transport protocol over and above the network protocol?
A) Recovery from packet losses
B) Detection of duplicate packets
C) Packet delivery in the correct order
D) End to end connectivity

Ans: D)