Microsoft Latest Campus Placement Papers 2011 & Solutions

Ankita Katdare

Ankita Katdare

@abrakadabra Oct 26, 2024
A friend forwarded me these Microsoft placement papers. Some have solutions, some don't. If you have difficulty solving them. Ask it here.

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • ISHAN TOPRE

    ISHAN TOPRE

    @ishan-nohePN Oct 22, 2011

    Hey, It is really surprising that these companies are coming to us. I could't believe that initially. What do you think could be the job profile offered by these people?
  • pinki_seetu

    pinki_seetu

    @pinki-seetu-vqLhsl Oct 26, 2013

    hello any one tell me how to solve this problem


    You have to design a desktop manager. There are n windows that can be open at the same time. For each window we are storing the 2 opposite corner coordinates and the z-index of the window. In case of overlapping windows, the window with a higher z-index comes above the second, and the window on the top has the highest z-index. Whenever a window needs to be brought onto the top, its z-index is allotted as max(z-index)+1.
    Design data structure to present the above problem and to implement the following operations:
    1. Hit testing: You click at a point (x,y), choose all the windows in which this point lies and return the top most windows amongst the selected windows. Very frequent and critical.
    2. Raise the window. Very frequent and critical
    3. Resize the top window Frequent operation.
    4. Add a new window. Infrequent operation
    5. Remove a window. Infrequent operation
    Write the complexity of implementing operation a-e. Also explain the algo for operations a and b.

    this is microsoft question
  • rahul69

    rahul69

    @rahul69-97fAOs Oct 26, 2013

    pinki_seetu
    hello any one tell me how to solve this problem


    You have to design a desktop manager. There are n windows that can be open at the same time. For each window we are storing the 2 opposite corner coordinates and the z-index of the window. In case of overlapping windows, the window with a higher z-index comes above the second, and the window on the top has the highest z-index. Whenever a window needs to be brought onto the top, its z-index is allotted as max(z-index)+1.
    Design data structure to present the above problem and to implement the following operations:
    1. Hit testing: You click at a point (x,y), choose all the windows in which this point lies and return the top most windows amongst the selected windows. Very frequent and critical.
    2. Raise the window. Very frequent and critical
    3. Resize the top window Frequent operation.
    4. Add a new window. Infrequent operation
    5. Remove a window. Infrequent operation
    Write the complexity of implementing operation a-e. Also explain the algo for operations a and b.

    this is microsoft question
    I am giving u directions, so that u can solve this question yourself 😒
    The question is pretty straightforward.😀 The first thing u have to do is to decide upon the data structure for the given problem, for example u could use an array of objects as the data structure, but then, u also have to consider about the time complexity etc. and then decide which data structure is best.
    Then u have to implement all operations one by one,
    Those operations which are frequent and critical, should have less execution time and proper exception handling. The procedure u need to do is given in question itself,
    After implementing operations u need to write complexity, so do explain time as well as space complexity of different operations that u do implement.
    😀.