Posted By: leighsword | Feb 23rd, 2006 @ 11:09 PM
page 1 of 1
Comments: 10 | Views: 2210
leighsword
leighsword
LeighSword
1 Instructions
The purpose of the exercises in this test is to aid evaluation of the testee’s knowledge and experience in the field of software design and software engineering. Please provide all answers in English in one single document in electronic form (a PDF file is preferred). All source code provided in the answers must be in C++. If you find an exercise ambiguous describe the ambiguity and try to resolve it in a reasonable way so that you can complete the exercise. The testee is expected to do the test without help from anybody else, however using public information from books and other similar sources is allowed.
Take your time when doing the test. It is not a speed contest! We value high quality answers, not the time it took to answer.
2 Algorithms
Suppose you work with software for a set-top box product in a team of about ten software designers.
You receive a bug report from an important customer saying that things look bad on screen if they move the video window around repeatedly. The set-top box is capable of showing video in a window placed anywhere on screen, and further it has a software interface for blending video with graphics in two separate alpha windows. Each alpha window has a certain transparency level so that the video can be seen through the graphics.
You have a look in the source code and find the code for the TVideoMixer class, as it is reproduced in Appendix A. You are aware of the fact that the public interface of the TVideoMixer class is used extensively all over the set-top box source code, so you are reluctant to change that part.
Appendix A also includes the TAlphaPlane class and a main function to make it a complete executable program for illustrative purposes in this exercise, but you should consider the TVideoMixer class only.
The alpha plane holds a transparency value for each graphics pixel.
1. Describe what the code does.
2. Improve the code in TVideoMixer (refactor it) in various ways to make it easier to read and understand. You should not change the functionality at all, i.e. you should not solve the bug in your code. Provide your improved code for TVideoMixer and any additional code you may have introduced and write a motivation for all changes you make.
3. Describe the cause of the bug report and suggest a fix (code is not needed, describe it in words). If you find other bugs, suggest fixes for them as well.
3 Language Features
Describe your two favorite features in the C++ language and why you like them so much. Also describe the two features of the C++ language that you think are the most over-rated or the most misused, and why you think that is the case.
4 Concurrency
Consider the following scenario: A user interface process (GUI process) wants to display a movie on the screen. The movie is available on a video server in the network. The user interface process itself does not know how to communicate with the video server and render the video stream on screen, but there is a player service in the operating system it can use to perform these actions. The GUI process has a lot of user interaction to take care of, so having an operating system service taking care of all the movie stuff suits the GUI process nicely. The operating system hosting the player service and the GUI process does not have support for multithreaded processes.
GUI Process <-> Operating System Player Service <-> Video Server
The video server accepts the commands and emits the event messages listed in the following table
(C = Client and S = Video Server):
Direction Message Description
C->S OPEN <name> Open the movie with the provided name. The current position will be at the start of the movie.
C->S PLAY Play the open movie at normal speed from the current position.
C->S PAUSE Pause the open movie at the current position.
C->S FAST FORWARD Fast-forward (with picture) the open movie from the current position.
C->S REWIND Fast-rewind (with picture) the open movie from the current position.
C->S CLOSE Close the currently open movie.
S->C SUCCESS The operation completed successfully
S->C FAILURE The operation was not executed because of some error
S->C AT BEGINNING The movie has reached the beginning.
S->C AT END The movie has reached the end.
When the client has sent a message it has to wait for either a SUCCESS or FAILURE reply message from the server before sending a second message. Apart from the messages sent from the server to the client, the server may also indicate more severe problems by shutting down the network connection used for sending messages between the server and the client. For example, this will happen if the server shuts down (or unexpectedly crashes) for any reason, but it may also happen if the client sends illegal messages that the server cannot interpret. The actual transmission of the audio and video streams is performed on a separate channel.
The player service in the operating system provides the following C++ API to the client (i.e. the GUI process):
class TMovie
{
public:
class ICallback
{
public:
virtual void AtBeginning() = 0;
virtual void AtEnd() = 0;
}
TMovie(const char* name, int x, int y, int width, int height,
ICallback* callback);
~TMovie();
void Play();
void Pause();
void FastForward();
void Rewind();
};
This C++ API has a number of weaknesses. Describe as many of them as you can identify and suggest solutions to the problems.
Make the appropriate changes to the C++ API so that it becomes capable of communicating the relevant error conditions to the client.
5 Software Quality
The std::queue is a handy template class which is part of the Standard C++ Library. Write a simple program which runs a number of test cases on the std::queue template class. The program must print
“Success” if the std::queue class passes all test cases successfully, or “Failure” each time a test case fails.
The set of test cases should provide a level of test coverage you find reasonable in this particular case.
Please refer to [1] for documentation of an implementation of the queue template class.
6 Fault Handling
Assume you are about to design a class that reads a configuration file from disk and provides some functions that can be called by other classes to inquire the user settings that was provided in the configuration file. The public parts of the class could look something like this:
class TConfigurationFile
{
public:
TConfigurationFile(const char* filename);
~TConfigurationFile();
const char* GetValue(const char* name);
};
A number of fault conditions may arise when using this class. For example, the name argument to GetValue() could be zero. Describe them and how you would design the fault handling for each one of them in the class. Provide a convincing rationale for each choice.
JohnAskew
JohnAskew
9 girl in pink sweater
I loved University. Have fun.  [A][6]
DCMonkey
DCMonkey
Monkey see, monkey do, monkey will destroy you!

I think it might be the code for an emoticon from the old version of this forum; the one we had ***THREE YEARS AGO*** WHEN THIS THREAD STARTED AND ENDED!?!?1?!

lol, I was looking at this thread and was thinking wtf Smiley We need to do something about old threads, a simple alert whould be the simplest and most effective way

John, did you solve this problem ?? I could use some help on that one ... (like leighsword said: "Who is able to reply the highest quality answer?" ) ??

Is there a good quality solution to the desing ??

I see...but is there any quality solution to the problem mentioned by leighsword ?

page 1 of 1
Comments: 10 | Views: 2210
Microsoft Communities