1
GATE CSE 2003
MCQ (Single Correct Answer)
+2
-0.6
The following program fragment is written in a programming language that allows global variables and does not allow nested declarations of functions.
global int i = 100, j = 5;
void P(x) {
    int i = 10;
    print(x + 10);
    i = 200;
    j = 20;
    print (x);
}
main() {
    P(i + j);
}
If the programming language uses static scoping and call by need parameter passing mechanism, the values printed by the above program are
A
115, 220
B
25, 220
C
25, 15
D
115, 105
2
GATE CSE 2003
MCQ (Single Correct Answer)
+1
-0.3
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 the function f best approximates
A
Xy
B
ex
C
$$\ln (1 + x)$$
D
Xx
3
GATE CSE 2003
MCQ (Single Correct Answer)
+2
-0.6
Consider the following class definitions in a hypothetical Object Oriented language that supports inheritance and uses dynamic binding. The language should not be assumed to be either Java or C++, though the syntax is similar.
Class P {
    void f(int i) {
           print(i);
          }
}

Class Q subclass of P {
       void f(int i) {
            print(2*i);
          }
}
Now consider the following program fragment:
Px = new Q();
Qy = new Q();
Pz = new Q();
x.f(1); ((P)y).f(1); z.f(1);
Here ((P)y) denotes a typecast of y to P. The output produced by executing the above program fragment will be
A
1 2 1
B
2 1 1
C
2 1 2
D
2 2 2
4
GATE CSE 2003
MCQ (Single Correct Answer)
+1
-0.3
Assume the following C variable declaration

int * A[10], B[10][10];

Of the following expressions

I. A[2]
II. A[2] [3]
III. B[1]
IV. B[2] [3]

Which will not give compile-time errors if used as left hand sides of assignment statements in a C program?
A
I, II, and IV only
B
II, III, and IV only
C
II and IV only
D
IV only
EXAM MAP
Medical
NEET
Graduate Aptitude Test in Engineering
GATE CSEGATE ECEGATE EEGATE MEGATE CEGATE PIGATE IN
CBSE
Class 12