Developing sharp software  
C++ and MFC Test - 25 questions
Please answer each of the questions to the best of your knowledge.  Although this may place you at a disadvantage,  we ask that you take this test without the aid of programming help materials such as MSDN.  We understand that you may not have worked with code that employs or deals with every question below, and we do not necessarily expect that you will answer every question.  Feel free to answer those that you are experienced with.  This will help give an indication of where your strengths lie and how you can help Acuit as a software engineer.

Name:

Email:

Phone:


No.

Question

1 What is the primary value in using virtual functions within C++?
They prevent the base class function from ever being called.
They allow you to provide unique behavior for derived classes.
Since they are "virtual" they sometimes don't really exist.
Internet technologies.
I don't know
2 Why would you use a CPtrArray instead of a CObArray in an MFC application?
  The objects you are storing are not derived from CObject.
Pointers use less memory than objects.
Pointers are faster to lookup than objects.
All of the above.
I don't know
3 In C++ what is the difference between a struct and a class?
There is no comparison.  Structs are used in C while classes are used in C++.
Classes use less memory since it is newer technology.
You cannot implement functions when you use a struct.
The default access specifier.
I don't know
4 What is the difference between a C++ pointer and a reference?
  A reference is the entire object while a pointer is only the address of it.
References are used only in Visual Basic.
The syntax used to access the object.
Pointers are simple address to the object while a reference uses the virtual table.
I don't know
5 What does a CWindowDC do?
Allows an HDC to draw on the client area of a window only.
Allows an HWND to draw on the non-client area of a window only.
Allows an HINSTANCE to draw on the client area and non-client area of a window only.
None of these.
I don't know
6 Can CRuntimeClass be used to verify that a CString pointer is the correct type?
  Only when it is derived from CObject.
Yes, always.
No
If the CString is instantiated using "new".
I don't know
7 Describe how you would subclass a dialog control with your own class in an MFC application.
Derive the class from CObject, and use call the Attach() function.
You must derive a class from an MFC Windows control and call SubclassDlgItem().
Create a new class with no derivation from any class and call SubclassDlgItem().
None of these.
I don't know
8 What does the term “default parameter” mean in C++?
  It means that MFC supplies default functionality that you get for "free".
A parameter that C++ automatically supplies a default value for.
Some MFC functions have all the parameters written for you by ClassWizard.
A parameter based on primitive C++ variable types.
I don't know
9 What MFC class could be used to manage a record in an ODBC database?
CRecordset
COBDCSet
CADORecord
CRecord
I don't know
10 Under what conditions is multiple inheritance not recommended?
  When one class contains an object of the same type that another is derived from.
When two or more classes contain the same virtual function names.
When a class contains more than one CObject derived class.
When more than one object is derived from CObject.
I don't know
11 What is the point in making a destructor "virtual"?
There is no value.
MFC uses it for memory leak detection.
It causes the derived class destructor to be called upon delete.
A derived class destructor is always called, it just changes to order of calling.
I don't know
12 Which statement is true of "pure virtual" functions?
  They force you to derive another class from the base class which contains the function.
They contain no code.
Neither of these
Both of these
I don't know
13 What is the base class for CWinApp?
CObject
CCmdTarget
CWinThread
All of these
I don't know
14 GetWindow() is a member of which MFC class?
  CDC
CWnd
CMenu
Two of the above
I don't know
15 Multiple inheritance is best described as?
A fun thing to debug.
Multiple derived classes in a long chain from the first base class.
A class used as a base class for more than one derived class.
A class derived from two or more base classes.
I don't know
16 If you subtract two CTime objects what do you get?
  long
CSize
CString
None of these
I don't know
17 When using printf(), what value is used with "%d"?
int
double
DWORD
date
I don't know
18 Why would you use a CMemFile?
  To easily load a file into memory for fast processing.
To share serialized objects with another process.
To prepare a file in memory before saving it on disk.
Because locking ranges is faster in memory than on disk.
I don't know
19 The following macros are used together:
throw_another and catch
thro_one_of and end_catch
try and and_catch
None of these
I don't know
20 Which return values are correct when comparing two strings?
  0 means the strings are not equal
TRUE means the strings are equal
-1 means the first string is alphabetically less than the second
All of these are true
I don't know
21 If a function takes a pointer to a pointer as a parameter, how would you return a new pointer?
lplpValue =  pWnd;
**lplpValue = pWnd;
&lplpValue = pWnd;
*lplpValue = pWnd;
Never done this
22 If the variable i = 5, what is the results of "i++ - 1"?
  7
6
5
4
I don't know
23 How many bytes does "++" advance the pointer LPWORD lpWord?
++ always advances a pointer by one byte.
++ always advances a pointer by 4 bytes.
By the size of LPWORD
None of these
I don't know
24 CCmdTarget is used for what?
  Drawing alignment targets of a specified size on a document window using an HDC.
Handling accelerator keys.
Making sure SPY++ can find your window with the "Find Window" target icon.
In OLE to send commands to an application in another process space.
I don't know
25 If two functions within the same class have the same name what happens?
Either one will be called depending on the parameters.
Nether function will be called.  This is dead code and a very difficult problem to debug.
Both functions will be called in order.  This is called multiple inheritance.
The base class function of the same name will be called.
I don't know, and I really hope I'm done with this test!

     When finished make sure you have filled in the user information above and press the Submit button below.
     Do not submit this test more than once until your answers have been checked and returned to you.
       Best of luck from Acuit Development - and don't forget to try our other tests!