Genesis Insoft The name you can TRUST
twitterlogo facebooklogo
Home  |  Contact Us |  Careers
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 is a correct prototype for WinMain function?

  1. int FAR PASCAL WinMain(HINSTANCE, HINSTANCE, LPSTR, int).
  2. void FAR PASCAL WinMain(HINSTANCE, HINSTANCE, LPSTR, int).
  3. FAR PASCAL WinMain(HINSTANCE, HINSTANCE, int, char**)
  4. None of the above

Answer to Question 1

Question 2

Which is the first message generated when ShowWindow method is executed?

  1. WM_SIZE
  2. WM_PAINT
  3. WM_DRAW
  4. WM_CREATE

Answer to Question 2

Question 3

What is the functionality of UpdateWindow method?

  1. Updates the client area of the specified window by sending a WM_PAINT message to the message queue.
  2. Updates the client area by sending a WM_PAINT message directly to the window procedure of the specified window, bypassing the application queue.
  3. Updates the client area of the specified window by using Paint method of CWindow class.
  4. None of the above

Answer to Question 3

Question 4

Which of the following is not a Device Context class?

  1. CWindowDC
  2. CClientDC
  3. CPaintDC
  4. CFrameDC

Answer to Question 4

Question 5

When a key is pressed, which of the following message handler is invoked first?

  1. OnChar
  2. OnKeyDown
  3. OnKeyUp
  4. OnKeyPressed

Answer to Question 5

Question 6

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);

  1. Draws a 3 pixel width red dashed line.
  2. Draws a 3 pixel width yellow dashed line.
  3. Draws a 3 pixel width yellow dotted line.
  4. Draws a 1 pixel width yellow dashed line.

Answer to Question 6

Question 7

Which of the following statements, creates a push button.

  1. m_btn.Create(" Ok ", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE, CRect(170, 10, 260, 35), this, ID_BTN_OK);
  2. m_btn.Create(" Ok ", CRect(170, 10, 260, 35), BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE, this, ID_BTN_OK);
  3. m_btn.Create(" Ok ", CRect(170, 10, 260, 35), BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE, ID_BTN_OK, this);
  4. None of the above

Answer to Question 7

Question 8

What are the header files required for a simple windows application with basic child window controls?

  1. afxwin.h and afxbasic.h
  2. afxwin.h and afxwindows.h
  3. afxbasic.h
  4. afxwin.h

Answer to Question 8

Question 9

What is the return value from MessageBox function, when user clicks "Yes" button?

  1. ID_YES
  2. IDYES
  3. ID_OK
  4. IDOK

Answer to Question 9

Question 10

What is the message generated when user clicks close button at the right top of a window's title bar?

  1. WM_CLOSE
  2. WM_DESTROY
  3. WM_QUIT
  4. None of the above

Answer to Question 10

Question 11

What styles are included with LBS_STANDARD for a list box?

  1. LBS_HASSTRINGS, LBS_NOTIFY, LBS_SORT
  2. LBS_HASSTRINGS, LBS_MULTIPLESEL, LBS_SORT
  3. LBS_NOTIFY, LBS_SORT
  4. LBS_HASSTRINGS, LBS_SORT

Answer to Question 11

Question 12

What is the use of the following statement?

myListBox.FindString(-1, "Hello");

  1. Searches entire list box contents, for the string "Hello".
  2. Searches the list box contents, for the string "Hello", in the reverse direction, starting from the current selection index.
  3. Generates a compiler error.
  4. Generates a run-time error.

Answer to Question 12

Question 13

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. 1 and 2
  2. 1, 2 and 4
  3. 1, 2 and 3
  4. All of the above

Answer to Question 13

Question 14

What are the ways of getting a handle to device context?

  1. Use GetDC function
  2. Use CreateDC function
  3. Use BeginPaint function
  4. Both A and C

Answer to Question 14

Question 15

What is the base class of CDialog?

  1. CWnd
  2. CWindow
  3. CFrameWindow
  4. CModalDialog

Answer to Question 15

Question 16

Select the correct sequence of method calls, when the user clicks Ok (IDOK) button of a dialog box.

  1. UpdateData(FALSE), EndDialog
  2. UpdateData(TRUE), EndDialog
  3. EndDialog, UpdateData(FALSE)
  4. UpdateData(TRUE)

Answer to Question 16

Question 17

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?

  1. Override the OnOK member function and call the base-class OnOk() member function.
  2. Override the OnOK member function and call DestroyWindow from within it.
  3. Just override the OnOK member function.
  4. Do not override the OnOK member function.

Answer to Question 17

Question 18

CSpinButtonCtrl is derived from

  1. CScrollBar
  2. CWnd
  3. CWindow
  4. None of the above

Answer to Question 18

Question 19

How does a property page indicate property sheet, that its contents have been updated and the button "Apply" should be activated.

  1. Invoke SetUpdated(TRUE)
  2. Invoke SetUpdated(FALSE)
  3. Invoke SetModified(FALSE)
  4. Invoke SetModified(TRUE)

Answer to Question 19

Question 20

If the number of property pages are more, how do you set the property page to display scrolling property sheets?

  1. EnableStackedTabs(TRUE)
  2. EnableStackedTabs(FALSE)
  3. It is the default behaviour
  4. 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

Copyright © 2000 to 2011 Genesis InSoft Limited. All Rights Reserved.