Sapient – Test Pattern

SAPIENT Technical Questions

  1. It is mandatory to define type of a function in the calling program:
    • if the function returns an integer
    • if the function returns a non-integer value
    • if the function is not defined in the same file
    • if the function returns any value


  2. A member function defined within the class definition, rather than simply declared there taken to be an _________ member function
    • static
    • inline
    • constant
    • overloaded

  3. Consider the following program fragment main ( )
    {
    int a,b,c;
    b = 2;
    a = 2*(b++);
    c = 2*(++b);
    }
    Which one of the given answers is correct?
    • a = 4, c = 6
    • a = 3, c = 8
    • a = 3, c = 6
    • a = 4, c = 8
  4. Use of virtual function is involved with ________
    • Overloading
    • Dynamic binding
    • Overriding
    • Static binding

  5. Which of the following class access protected and private members of other class?
    • Friend class
    • Virtual class
    • Main class
    • None of these

  6. Evalute:
    x=++y + y++ if y = 20 initially
    • 21
    • 19
    • 20
    • Undefined