Technical Questions asked in Microsoft

  1. What is the output of the following code snippet?
    using namespace std;
    void test (int x)
    if (x > 0)
    throw x;
    throw 'x';
    catch (int x)
    cout<<"integer:"< }
    catch(char x)
    cout << "character:" << x< }
    int main()
    test (10);
    test (0);
    1. integer:10
    2. integer:10 character:x
    3. character:x
    4. compilation error occurred
    Answer: Option  B.
cognizant article ad
  1. Analyse the following code snippet :
    Class Temp
    char m_acEmpName[25];
    char* GetFirstChar()
    return this->m_acEmpName;
    int main(int argc, char ** argv)
    Temp oTempObject; cout< }
    1. Displays the first character of the string
    2. Displays the complete string Hello
    3. Error
    4. Displays the last character of the string
    Answer: Option  B .
  2. Assume that the Point class is existing with the following snippet in the header file
    class Point
    Point(); Pont(int, int); int GetX();
    int GetY();
    void SetX(int);
    void SetY(int);
    If the objects of Point are created as Point oPointOne, oPointTwo(2,3); Which of the following statements are correct?
    (i) The statement oPointOne.SetX(20);
    Will compile and run successfully.
    (ii) The statement oPointOne.SetX(20).SetY(30);
    Will compile successfully but will give a run time error.
    1. Only (i) is correct
    2. Both (i) and (ii) are correct
    3. Both (i) and (ii) are incorrect
    4. Only (ii) is correct
    Answer: Option  A .
  3. What is the function of application programs in the DBMS approach?
    1. To store data
    2. To process functions
    3. to access control
    4. all of the above
    Answer: Option B.
  4. What is the complexity of this algorithm?
    Algorithm Sum(a,n)
    s := 0.0;
    for i := 1 to n do s := s + a [i];
    return s;
    1. log2n
    2. O(n)
    3. O(n logn)
    4. O(kn)
    Answer: Option B.
  5. Which of the following is not a characteristic of modern DBMS?
    1. Real world entity
    2. More redundancy
    3. Isolation of data and applications
    4. Consistency
    Answer: Option B.
Campus Placement ad
Rate Us