Wednesday, August 4, 2010

Visual C++ - Set 1-4

 

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

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

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

Question 4

Which of the following is not a Device Context class?

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

Question 5

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

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

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.

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

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

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

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

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

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.

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

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

Question 15

What is the base class of CDialog?

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

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)

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.

Question 18

CSpinButtonCtrl is derived from

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

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)

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)

 

Answers

Answer 1 - A

Answer 2 - A

Answer 3 - B

Answer 4 - D

Answer 5 - B

Answer 6 - D

Answer 7 - A

Answer 8 - D

Answer 9 - B

Answer 10 - A

Answer 11 - A

Answer 12 - A

Answer 13 - C

Answer 14 - C

Answer 15 - A

Answer 16 - B

Answer 17 - B

Answer 18 - B

Answer 19 - D

Answer 20 - B

No comments:

Post a Comment