Visual C++ Question Bank / FAQs
This is a mock Exam for the VC++ programmers. It is created by Genesis InSoft Limited (admin@genesisinsoft.com) and may be freely
distributed so long as it is unmodified. Please email us if you have any corrections or
comments.
Question 1
Which of the following statements is correct?
- Windows is a callback programming model.
- In windows the end user controls the flow of program execution after the basic
initialization is done.
- Windows is event driven and is non-linear model.
- All of the above
Answer to Question 1
Question 2
Which of the following statements is correct?
- A windows application terminates only when there is WM_END message in message queue.
- A windows application terminates only when there is WM_QUIT message in message queue.
- A windows application terminates only when there is WM_CLOSE message in message queue.
- A windows application terminates only when there is WM_DESTROY message in message queue.
Answer to Question 2
Question 3
Which of the following statements is correct about EndPaint function?
- It marks the end of painting in the specified window.
- It is required for each call to BeginPaint function.
- It should be called only after painting is complete.
- All of the above.
Answer to Question 3
Question 4
Significance of GetMessage function is
- Convert WM_KEYDOWN message into WM_CHAR
- Terminate when the message in calling thread's message queue is WM_END
- Retrieve a message from the calling threads message queue and places it in the
specified structure
- Dispatch the message to the window procedure
Answer to Question 4
Question 5
The lparam of WM_TIMER procedure is
- Timer ID
- Pointer to an application-defined callback function that was passed to the SetTimer
function when the timer was installed
- Time Interval
- None of the above
Answer to Question 5
Question 6
For the following code segment, select the correct statement.
CBrush MyBrush(HS_CROSS, RGB(0, 255, 0));
dc.SelectObject(&MyBrush);
dc.Rectangle(100, 100, 300, 250);
- Draws a rectangle of width 200, height 150 whose interior is filled with cross hatch
style, green in color
- Draws a rectangle of width 200, height 150 and the interior is filled with solid green
color
- Draws a rectangle of width 200, height 250 whose interior is filled with cross hatch
style, green in color
- Draws a rectangle of width 200, height 150 whose interior is filled with cross hatch
style, green in color
Answer to Question 6
Question 7
What is the base class of CWinApp?
- CAPP
- CCmdTarget
- CWinThread
- CObject
Answer to Question 7
Question 8
Which of the following is correct with respect to Select object?
- It selects the object into the specified device context. The new object replaces the
previous object of the same type.
- It's return type is void.
- Information about the old object is not available for future use.
- It is used to select only pens and brushes into device context.
Answer to Question 8
Question 9
Which of the following is correct for DestroyWindow function?
- It destroys the specified window and terminates the application.
- It destroys the specified window and sends a WM_DESTROY message.
- It destroys modeless dialog boxes created by the CreateDialog function.
- Both B and C
Answer to Question 9
Question 10
To count the number of buttons on mouse, we use the following function
- GetSystemMetrics(SM_MOUSEPRESENT)
- GetSystemMetrics(SM_CMOUSEBUTTONS)
- GetFontMetrics()
- None of the above
Answer to Question 10
Question 11
To get information of the font we use the following statement?
- GetFontMetrics()
- GetTextMetrics()
- GetSystemMetrics(SM_FONTDATA)
- GetSystemMetrics(SM_FONTMETRICS)
Answer to Question 11
Question 12
The 3rd parameter of SetTimer function is?
- Time Interval
- Timer ID
- Long pointer to the function to be notified when the time-out value elapses
- Pointer to the OnTimer function
Answer to Question 12
Question 13
Given a child window control object, how do you get the ID of the
control?
- GetID function
- GetDlgItem
- GetChildWndID
- GetDlgCtrlID
Answer to Question 13
Question 14
Which of the following statements is correct if the user clicks child window scrollbar?
- OnVScroll method's 3rd argument is NULL
- OnVScroll method's 3rd argument is a pointer to the control
- OnVScroll method's 1st argument refers to the current position of thumb track
- OnVScroll method's 2nd argument specifies a scroll-bar code that indicates a scrolling
request by the user
Answer to Question 14
Question 15
When we execute the following code what does it result in, assuming rect is size of the
window?
DrawText(hdc, "Genesis", -1, &rect, DT_CENTER |
DT_VCENTER);
- Displays the last character of text "Genesis" in the center of the window
horizontally
- Displays the last character of text "Genesis" in the center of the window both
horizontally and vertically
- Displays the text "Genesis" in the center of the window both horizontally and
vertically
- Displays the text "Genesis" in the center of the window horizontally
Answer to Question 15
Question 16
When we execute the following code what does it result in?
TextOut(hdc, 100, 125, "Genesis InSoft", -1);
- Displays the text "Genesis InSoft" at logical x and y coordinates
- Displays the text "Genesis" at logical x and y coordinates
- Displays the text "Genesis" at device x and y coordinates
- No text is displayed
Answer to Question 16
Question 17
Which of the following is correct about resources?
- They are stored with a file extension .rs
- They are stored with a file extension .rc
- The resource file when compiled results in .res
- Both B and C
Answer to Question 17
Question 18
The mapping mode MM_TEXT relates to
- X increases horizontally right and Y increases vertically down
- Each unit is one twips
- X increases horizontally right and Y increases vertically up
- Each unit is one cm
Answer to Question 18
Question 19
Invalidate(TRUE) does what?
- The background is erased when the BeginPaint function is called.
- The background is erased when the EndPaint function is called.
- The background is not erased when the BeginPaint function is called.
- The background is not erased when the EndPaint function is called.
Answer to Question 19
Question 20
CWnd::InvalidateRect(&rect) does what?
- Erases "rect" area and its child windows if any
- Erases entire client area and its child windows if any
- Erases "rect" area and does not repaint its child windows if any
- Erases entire client area and does not repaint its child windows if any
Answer to Question 20
Answers
Answer 1 - D
Back to question 1
Answer 2 - B
Back to question 2
Answer 3 - D
Back to question 3
Answer 4 - C
Back to question 4
Answer 5 - B
Back to question 5
Answer 6 - A
Back to question 6
Answer 7 - C
Back to question 7
Answer 8 - A
Back to question 8
Answer 9 - D
Back to question 9
Answer 10 - B
Back to question 10
Answer 11 - B
Back to question 11
Answer 12 - C
Back to question 12
Answer 13 - D
Back to question 13
Answer 14 - B
Answer 15 - D
Back to question 15
Answer 16 - D
Back to question 16
Answer 17 - D
Answer 18 - A
Answer 19 - A
Back to question 19
Answer 20 - C
Back to question 20
|