Technical Questions asked in Sapient

  1. It is mandatory to define type of a function in the calling program:
    1. if the function returns an integer
    2. if the function returns a non-integer value
    3. if the function is not defined in the same file
    4. if the function returns any value
    Answer:  Option B.
    Explanation: By default function return type is integer type in C.
  2. A member function defined within the class definition, rather than simply declared there taken to be an _________ member function
    1. static
    2. inline
    3. constant
    4. overloaded
    Answer: Option  B.

Complete Test Series for Wipro
Bag your Dream Job Today Comprehensive Online Tests Inclusive Prep for All Placement Exams Acquire Essential Domain Skills

  1. 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?
    1. a = 4, c = 6
    2. a = 3, c = 8
    3. a = 3, c = 6
    4. a = 4, c = 8
    Answer: Option  D.
  2. Use of virtual function is involved with ________
    1. Overloading
    2. Dynamic binding
    3. Overriding
    4. Static binding
    Answer: Option  B.
  3. Which of the following class access protected and private members of other class?
    1. Friend class
    2. Virtual class
    3. Main class
    4. None of these
    Answer:  Option  A.
    There is more coupling between classes.
  4. Evalute:
    x=++y + y++ if y = 20 initially
    1. 21
    2. 19
    3. 20
    4. Undefinded
    Answer:  Option  D.
    when variable is being modified more than once then the expression is undefined as different compiler will give different results.

Complete Campus Placement Training Course
Video Lectures Online Tests E-Books & Assignments

Rate Us
Views:10648