Technical Questions asked in Genpact

  1. What happens when the following piece of code in file1.c, is compiled and executed?
    namespace
    {
    Class Temp
    {
    public:
    int GetVal()
    {
    return 100;
    }
    };
    } //end of namespace
    int main()
    {
    Temp oTempObj1; Cout< }
    1. Compile Error
    2. 100
    3. Runtime Error
    4. Compilation Error
    Answer:  Option B.
  2. Iterators are________________
    1. Generalised pointers in STL
    2. Container classes in STL
    3. Algorithms in STL
    4. Special Methods in STL
    Answer: Option  A.
Campus Placement ad
  1. Big O notation is defined for
    1. Time and Space Complexity
    2. Optimality
    3. Searching
    4. Sorting
    Answer: Option  A.
  2. The effectiveness of an algorithm is best stated in
    1. Best-case Time
    2. Average-case Time
    3. Worst-Case running time
    4. Industry-Standard Time
    Answer: Option  C.
  3. output of following program
    #include<stdio.h>
    int f1( int );
    void main()
    {
    int b=5;
    printf("%d,%d", f1(b),f1(b));
    }
    int f1(int b)
    {
    static int n=5;
    n++;
    return n;
    }
    1. 6,6
    2. 6,7
    3. 7,6
    4. 5,6
    Answer:  Option  C.
  4. int * ptr=(int *) realloc(NULL,100) is same as
    1. int *ptr=(int *) malloc(20)
    2. int *ptr=(int *) malloc(50)
    3. int *ptr=(int *) calloc(25,4)
    4. int *ptr=(int *) calloc(20,4)
    Answer: Option  C.
Campus Placement ad
Rate Us
Views:15258