Microsoft – Test Pattern

MICROSOFT Technical Questions

  1. What is the output of the following code snippet?
    #include <iostream>
    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);
    • integer:10
    • integer:10 character:x
    • character:x
    • compilation error occurred

  2. 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< }
    • Displays the first character of the string
    • Displays the complete string Hello
    • Error
    • Displays the last character of the string

  3. 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.
    • Only (i) is correct
    • Both (i) and (ii) are correct
    • Both (i) and (ii) are incorrect
    • Only (ii) is correct
  4. What is the function of application programs in the DBMS approach?
    • To store data
    • To process functions
    • to access control
    • all of the above

  5. 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;
    • log2n
    • O(n)
    • O(n logn)
    • O(kn)

  6. Which of the following is not a characteristic of modern DBMS?
    • Real world entity
    • More redundancy
    • Isolation of data and applications
    • Consistency