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.
Which of the following is a correct prototype for WinMain function?
- int FAR PASCAL WinMain(HINSTANCE, HINSTANCE, LPSTR, int).
- void FAR PASCAL WinMain(HINSTANCE, HINSTANCE, LPSTR, int).
- FAR PASCAL WinMain(HINSTANCE, HINSTANCE, int, char**)
- None of the above
Answer to Question 1
Which is the first message generated when ShowWindow method is executed?
- WM_SIZE
- WM_PAINT
- WM_DRAW
- WM_CREATE
Answer to Question 2
What is the functionality of UpdateWindow method?
- Updates the client area of the specified window by sending a WM_PAINT message
to the message queue.
- Updates the client area by sending a WM_PAINT message directly to the window procedure
of the specified window, bypassing the application queue.
- Updates the client area of the specified window by using Paint method of CWindow
class.
- None of the above
Answer to Question 3
Which of the following is not a Device Context class?
- CWindowDC
- CClientDC
- CPaintDC
- CFrameDC
Answer to Question 4
When a key is pressed, which of the following message handler is invoked first?
- OnChar
- OnKeyDown
- OnKeyUp
- OnKeyPressed
Answer to Question 5
For the following code segment, select the correct statement.
CPen MyPen(PS_DASH, 3, RGB(255, 255, 0));
dc.SelectObject(&MyPen);
dc.LineTo(100, 100);
- Draws a 3 pixel width red dashed line.
- Draws a 3 pixel width yellow dashed line.
- Draws a 3 pixel width yellow dotted line.
- Draws a 1 pixel width yellow dashed line.
Answer to Question 6
Which of the following statements, creates a push button.
- m_btn.Create(" Ok ", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE, CRect(170,
10, 260, 35), this, ID_BTN_OK);
- m_btn.Create(" Ok ", CRect(170, 10, 260, 35), BS_PUSHBUTTON | WS_CHILD
| WS_VISIBLE, this, ID_BTN_OK);
- m_btn.Create(" Ok ", CRect(170, 10, 260, 35), BS_PUSHBUTTON | WS_CHILD
| WS_VISIBLE, ID_BTN_OK, this);
- None of the above
Answer to Question 7
What are the header files required for a simple windows application with basic child
window controls?
- afxwin.h and afxbasic.h
- afxwin.h and afxwindows.h
- afxbasic.h
- afxwin.h
Answer to Question 8
What is the return value from MessageBox function, when user clicks "Yes"
button?
- ID_YES
- IDYES
- ID_OK
- IDOK
Answer to Question 9
What is the message generated when user clicks close button at the right top of
a window's title bar?
- WM_CLOSE
- WM_DESTROY
- WM_QUIT
- None of the above
Answer to Question 10
What styles are included with LBS_STANDARD for a list box?
- LBS_HASSTRINGS, LBS_NOTIFY, LBS_SORT
- LBS_HASSTRINGS, LBS_MULTIPLESEL, LBS_SORT
- LBS_NOTIFY, LBS_SORT
- LBS_HASSTRINGS, LBS_SORT
Answer to Question 11
What is the use of the following statement?
myListBox.FindString(-1, "Hello");
- Searches entire list box contents, for the string "Hello".
- Searches the list box contents, for the string "Hello", in the reverse
direction, starting from the current selection index.
- Generates a compiler error.
- Generates a run-time error.
Answer to Question 12
Choose the correct statement with respect to messages for CScrollBar object?
1. SB_PAGE_LEFT and SB_PAGE_UP function the same way.
2. SB_LINE_RIGHT and SB_LINE_DOWN function the same way.
3. When user is dragging scroll box, message generated is SB_THUMBTRACK.
4. When user is dragging scroll box, message generated is SB_THUMBPOSITION.
- 1 and 2
- 1, 2 and 4
- 1, 2 and 3
- All of the above
Answer to Question 13
What are the ways of getting a handle to device context?
- Use GetDC function
- Use CreateDC function
- Use BeginPaint function
- Both A and C
Answer to Question 14
What is the base class of CDialog?
- CWnd
- CWindow
- CFrameWindow
- CModalDialog
Answer to Question 15
Select the correct sequence of method calls, when the user clicks Ok (IDOK)
button of a dialog box.
- UpdateData(FALSE), EndDialog
- UpdateData(TRUE), EndDialog
- EndDialog, UpdateData(FALSE)
- UpdateData(TRUE)
Answer to Question 16
If you have added the OK (IDOK) button in a modeless dialog box, and you want to
terminate dialog box when it is clicked, what approach you should follow?
- Override the OnOK member function and call the base-class OnOk() member function.
- Override the OnOK member function and call DestroyWindow from within it.
- Just override the OnOK member function.
- Do not override the OnOK member function.
Answer to Question 17
CSpinButtonCtrl is derived from
- CScrollBar
- CWnd
- CWindow
- None of the above
Answer to Question 18
How does a property page indicate property sheet, that its contents have been updated
and the button "Apply" should be activated.
- Invoke SetUpdated(TRUE)
- Invoke SetUpdated(FALSE)
- Invoke SetModified(FALSE)
- Invoke SetModified(TRUE)
Answer to Question 19
If the number of property pages are more, how do you set the property page to display
scrolling property sheets?
- EnableStackedTabs(TRUE)
- EnableStackedTabs(FALSE)
- It is the default behaviour
- EnableScroll(TRUE)
Answer to Question 20
Answers
Answer 1 - A
Back to question 1
Answer 2 - A
Back to question 2
Answer 3 - B
Back to question 3
Answer 4 - D
Back to question 4
Answer 5 - B
Back to question 5
Answer 6 - D
Back to question 6
Answer 7 - A
Back to question 7
Answer 8 - D
Back to question 8
Answer 9 - B
Back to question 9
Answer 10 - A
Back to question 10
Answer 11 - A
Back to question 11
Answer 12 - A
Back to question 12
Answer 13 - C
Back to question 13
Answer 14 - C
Back to question 14
Answer 15 - A
Back to question 15
Answer 16 - B
Back to question 16
Answer 17 - B
Back to question 17
Answer 18 - B
Back to question 18
Answer 19 - D
Back to question 19
Answer 20 - B
Back to question 20