1
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
2
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
3
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
4
GATE CSE 2003
MCQ (Single Correct Answer)
+1
-0.3
Consider the set $$\sum {^ * } $$ of all strings over the alphabet $$\,\sum { = \,\,\,\left\{ {0,\,\,\,1} \right\}.\sum {^ * } } $$ with the concatenation operator for strings
A
Does not from a group
B
Forms a non-commutative group
C
Does not have a right identity element
D
Forms a group if the empty string is removed from $${\sum {^ * } }$$
EXAM MAP
Medical
NEETAIIMS
Graduate Aptitude Test in Engineering
GATE CSEGATE ECEGATE EEGATE MEGATE CEGATE PIGATE IN
Civil Services
UPSC Civil Service
Defence
NDA
Staff Selection Commission
SSC CGL Tier I
CBSE
Class 12