Wednesday, August 4, 2010

Visual C++ - Set 1-3

Question 1

Which of the following statements is correct?

  1. Windows is a callback programming model.
  2. In windows the end user controls the flow of program execution after the basic initialization is done.
  3. Windows is event driven and is non-linear model.
  4. All of the above

Question 2

Which of the following statements is correct?

  1. A windows application terminates only when there is WM_END message in message queue.
  2. A windows application terminates only when there is WM_QUIT message in message queue.
  3. A windows application terminates only when there is WM_CLOSE message in message queue.
  4. A windows application terminates only when there is WM_DESTROY message in message queue.

Question 3

Which of the following statements is correct about EndPaint function?

  1. It marks the end of painting in the specified window.
  2. It is required for each call to BeginPaint function.
  3. It should be called only after painting is complete.
  4. All of the above.

Question 4

Significance of GetMessage function is

  1. Convert WM_KEYDOWN message into WM_CHAR
  2. Terminate when the message in calling thread's message queue is WM_END
  3. Retrieve a message from the calling thread’s message queue and places it in the specified structure
  4. Dispatch the message to the window procedure

Question 5

The lparam of WM_TIMER procedure is

  1. Timer ID
  2. Pointer to an application-defined callback function that was passed to the SetTimer function when the timer was installed
  3. Time Interval
  4. None of the above

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

  1. Draws a rectangle of width 200, height 150 whose interior is filled with cross hatch style, green in color
  2. Draws a rectangle of width 200, height 150 and the interior is filled with solid green color
  3. Draws a rectangle of width 200, height 250 whose interior is filled with cross hatch style, green in color
  4. Draws a rectangle of width 200, height 150 whose interior is filled with cross hatch style, green in color

Question 7

What is the base class of CWinApp?

  1. CAPP
  2. CCmdTarget
  3. CWinThread
  4. CObject

Question 8

Which of the following is correct with respect to Select object?

  1. It selects the object into the specified device context. The new object replaces the previous object of the same type.
  2. It's return type is void.
  3. Information about the old object is not available for future use.
  4. It is used to select only pens and brushes into device context.

Question 9

Which of the following is correct for DestroyWindow function?

  1. It destroys the specified window and terminates the application.
  2. It destroys the specified window and sends a WM_DESTROY message.
  3. It destroys modeless dialog boxes created by the CreateDialog function.
  4. Both B and C

Question 10

To count the number of buttons on mouse, we use the following function

  1. GetSystemMetrics(SM_MOUSEPRESENT)
  2. GetSystemMetrics(SM_CMOUSEBUTTONS)
  3. GetFontMetrics()
  4. None of the above

Question 11

To get information of the font we use the following statement?

  1. GetFontMetrics()
  2. GetTextMetrics()
  3. GetSystemMetrics(SM_FONTDATA)
  4. GetSystemMetrics(SM_FONTMETRICS)

Question 12

The 3rd parameter of SetTimer function is?

  1. Time Interval
  2. Timer ID
  3. Long pointer to the function to be notified when the time-out value elapses
  4. Pointer to the OnTimer function

Question 13

Given a child window control object, how do you get the ID of the control?

  1. GetID function
  2. GetDlgItem
  3. GetChildWndID
  4. GetDlgCtrlID

Question 14

Which of the following statements is correct if the user clicks child window scrollbar?

  1. OnVScroll method's 3rd argument is NULL
  2. OnVScroll method's 3rd argument is a pointer to the control
  3. OnVScroll method's 1st argument refers to the current position of thumb track
  4. OnVScroll method's 2nd argument specifies a scroll-bar code that indicates a scrolling request by the user

Question 15

When we execute the following code what does it result in, assuming rect is size of the window?

  1. DrawText(hdc, "Genesis", -1, &rect, DT_CENTER | DT_VCENTER);
  2. Displays the last character of text "Genesis" in the center of the window horizontally
  3. Displays the last character of text "Genesis" in the center of the window both horizontally and vertically
  4. Displays the text "Genesis" in the center of the window both horizontally and vertically
  5. Displays the text "Genesis" in the center of the window horizontally

Question 16

When we execute the following code what does it result in?

TextOut(hdc, 100, 125, "Genesis InSoft", -1);

  1. Displays the text "Genesis InSoft" at logical x and y coordinates
  2. Displays the text "Genesis" at logical x and y coordinates
  3. Displays the text "Genesis" at device x and y coordinates
  4. No text is displayed

Question 17

Which of the following is correct about resources?

  1. They are stored with a file extension .rs
  2. They are stored with a file extension .rc
  3. The resource file when compiled results in .res
  4. Both B and C

Question 18

The mapping mode MM_TEXT relates to

  1. X increases horizontally right and Y increases vertically down
  2. Each unit is one twips
  3. X increases horizontally right and Y increases vertically up
  4. Each unit is one cm

Question 19

Invalidate(TRUE) does what?

  1. The background is erased when the BeginPaint function is called.
  2. The background is erased when the EndPaint function is called.
  3. The background is not erased when the BeginPaint function is called.
  4. The background is not erased when the EndPaint function is called.

Question 20

CWnd::InvalidateRect(&rect) does what?

  1. Erases "rect" area and its child windows if any
  2. Erases entire client area and its child windows if any
  3. Erases "rect" area and does not repaint its child windows if any
  4. Erases entire client area and does not repaint its child windows if any

 

Answers

Answer 1 - D

Answer 2 - B

Answer 3 - D

Answer 4 - C

Answer 5 - B

Answer 6 - A

Answer 7 - C

Answer 8 - A

Answer 9 - D

Answer 10 - B

Answer 11 - B

Answer 12 - C

Answer 13 - D

Answer 14 - B

Answer 15 - D

Answer 16 - D

Answer 17 - D

Answer 18 - A

Answer 19 - A

Answer 20 - C

No comments:

Post a Comment