Question Bank For SDK
Question Bank For SDK
1. Just as the entry point to a C program is the function main(), the entry point to a Windows program is ________.
(WinMain() )
2. The three main Windows libraries are _______, __________ & ___________. (Kernel.32, User32, GDI32)
3. The size of Unicode character is ___ bits. (32)
4. CreateWindow() function sends the __________ message. (WM_CREATE)
5. UpdateWindow() function sends the __________ message. (WM_PAINT)
6. PostQuitMessage() function posts the __________ message. (WM_QUIT)
7. GetMessage() function retrieves a message from the _____________. (message queue)
8. GetMessage() returns_____, when it retrieve WM_QUIT message form the message queue. (0)
9. TranslateMessage() function is used for _______ translation. (Keyboard)
10. Window procedure function is a ____________ function. (CALLBACK)
11. TA program can call its own window procedure by using the _________ function. (SendMessage)
12. DispatchMessage() function passes the MSG structure back to __________. (Windows)
13. The very first message that a window procedure receives is ___________. (WM_CREATE)
14. RegisterClass() associates a window procedure to the __________. (window class)
15. Window messages are defined in both windows.h and __________ header files. (winuser.h)
16. Everything that happens to a window is relayed to the __________ in the form of message. (Window Procedure)
17. __________ API is used for subclassing. (SetWindowLong() )
18. __________ API is used for character translation of keystrokes. (TranslateMessage() )
19. Message __________ occurs when the user clicks an item on the menu bar or presses a menu key.
(WM_INITMENU)
20. __________ API is used to kill a modal dialog box. (EndDialog() )
21. _________, _________ and ___________ are windows resources defined in a .Res file. (Any three of these -
ICON / CURSOR / STRINGTABLE / DIALOG / MENU / BITMAP)
22. _________ API is used to set the text of an edit control. (SetWindowText() )
23. ________ and _________ are GDI objects. (Any two from Brush / Pen / Region / Font / Palette / Bitmap)
24. When there is no message in the queue, PeekMessage() function returns ____. (FALSE or 0)
25. System keystrokes are generated for keys typed in combination with the ____ key. (Alt)
26. System keystroke messages are _________ and ________. (WM_SYSKEYDOWN, WM_SYSKEYUP)
27. The virtual key code is stored in the _________ parameter of the WM_KEYDOWN message. (wParam)
28. The repeat count field is stored in the _________ parameter of the keystroke messages. (lParam)
29. _________ function is used for checking the type of information available in clipboard.
(IsClipboardFormatAvailable())
30. _________ function is used to open the clipboard. (OpenClipboard())
31. _________ function is used to clear the clipboard. (EmptyClipboard())
Page 1 of 1
ACTS National Resource Center, Pune
Question Bank –Win32 SDK (Solved)
32. There are only two messages to ask for user confirmation before ending a program. These are _________ and
_________ messages. (WM_CLOSE, WM_QUERYENDSESSION)
33. After processing WM_QUERYENDSESSION message, the system sends the _________ message with the wParam
parameter set to the results of the WM_QUERYENDSESSION message. (WM_ENDSESSION)
34. The complete prototype of the MessageBox() function is _____________________. (int WINAPI
MessageBox(HWND, LPCSTR, LPCSTR, UINT))
35. There are two type of bitmap in Windows. These are __________ and __________ bitmaps. (device-independent,
device-dependent)
36. Metafiles are to _________ graphics as bitmaps are to raster graphics. (Vector)
37. A metafile consists of a series of _________ records that corresponds to graphics functions calls. (Binary)
38. The filename extension for the enhanced metafile is _____. (.EMF)
39. The enhanced metafile is created by using the _________ function. (CreateEnhMetaFile())
40. The ____________ function is use to get rid of all memory resources required to maintain the metafile.
(DeleteEnhMetaFile())
41. The _________ function displays the picture stored in the given Windows-format metafile on the specified device.
(PlayMetaFile())
42. The process to get access to the individual records of a metafile is called metafile __________. (Enumeration)
43. The _________ function enumerates the records within an enhanced-format metafile by retrieving each record and
passing it to the specified callback function. (EnumEnhMetaFile())
44. The ________ and _________ functions are used to create a new thread of execution. (CreateWindow() and
_beginthread())
45. The function _beginthread() requires the __________ header file. (process.h)
46. The ________ function returns the thread identifier, which is used as a handle of the calling thread.
(GetCurrentThreadId())
47. To initialize a CRITICAL_SECTION data type’s object, the __________ function is used. (InitializeCriticalSection())
48. Instead of a critical section, a ________ object is used for coordinating threads within two different processes that
share a resource. (mutex)
49. To create a logical font, the ___________ and _________ functions are used. (CreateFont(), CreateFontIndirect())
50. The LOGFONT structure has ______ fields. (14)
51. The _________ function is used to open common dialog box. (ChooseFont)
Page 2 of 2
ACTS National Resource Center, Pune
Question Bank –Win32 SDK (Solved)
1. Windows.h is a master include file that includes other Windows header files. (True)
2. The Unicode character and a wide character are same. (False)
3. DispatchMessage() function passes the MSG structure back to Windows. (True)
4. Generally a program can call its own window procedure directly. (False)
5. Window procedure receives the WM_CREATE message after Windows completed the processing of CreateWindow()
function. (False)
6. BeginPaint() always erases the background of the client area even if it already erased. (False)
7. PostQuitMessage(0) directly closes the program. (False)
8. PostQuitMessage(0) inserts a WM_QUIT message in the program’s message queue. (True)
9. Only one window can be created based on a single window. (False)
10. The values of wParam and lParam are message-dependent. (True)
11. One window procedure cannot handle messages for multiple windows of the same window class. (False)
12. The queued messages are sent to a message queue and the nonqueued messages are posted to the window
procedure. (False)
13. WM_TIMER is a queued message. (True)
14. WM_QUIT is a nonqueued message. (False)
15. WM_COMMAND is a queued message. (False)
16. WPARAM in Win32 API is a form of long data type. (True)
17. LPARAM in Win32 API is a form of long data type. (True)
18. A window class can have multiple Window Procedures at a time. (False)
19. Rich Text control is a part of COMCTL32.DLL. (False)
20. PushButtons, Edit controls, Check Boxes are all windows. (True)
21. A menu attached to a window can be changed dynamically. (True)
22. PeekMessage() API may not be used to remove the messages from the message queue. (False)
23. SendMessage() is a blocking function. (True)
24. Timer messages are high priority messages. (False)
25. SendMessage(WM_QUIT) should be used to terminate a Windows application. (False)
26. Both the DeleteMenu() and RemoveMenu() functions are same. (False)
27. WM_TIMER messages are not asynchronous. (True)
28. WM_PAINT message has low priority. (True)
29. There can be multiple WM_PAINT messages in message queue. (False)
30. There cannot be multiple WM_TIMER messages in message queue. (True)
31. KillTimer() function cannot purge the pending WM_TIMER messages in message queue. (False)
32. One can not convert screen coordinate to client-area coordinates. (False)
Page 3 of 3
ACTS National Resource Center, Pune
Question Bank –Win32 SDK (Solved)
33. Windows directly places the keyboard messages into the application’s message queue, when a key is pressed and
released. (False)
34. Windows maintains a system message queue for the keyboard messages. (True)
35. GetMessage() function always returns control to a program regardless whether a message is present or not in the
message queue. (False)
36. Two applications using a same DLL can use the global variable defined in the DLL to shared data between them.
(False)
37. Every thread has its own private address space. (False)
38.Only RegisterClassEx function should be used to register a class whose attributes are stored in WNDCLASSEX
structure. (True)
39. Only CreateWindowEx function should be used to create window based on a window class registered using
RegisterClassEx function. (False)
40. Dialog box procedure must handle WM_PAINT message. (False)
41. Dialog box template for modal and modeless dialog box can be same. (True)
42. Once a menu is added to a window, it can’t be changed later. (False)
43. Metafiles are used for raster graphics. (False)
44. A metafile can be converted to a bitmap, without any loss of information. (False)
45. The default background mode is OPAQUE. (True)
46. In Windows only one program can have the clipboard open at any time. (True)
47. In Windows, to allocate memory for clipboard data, malloc() function can be used. (False)
48. The return type of the OpenClipboard() function is handle to clipboard. (False)
49. In Windows, one cannot store metafile in the clipboard. (False)
50. In Windows, a region cannot generate a WM_PAINT message. (False)
51. WM_COMMAND message is generated only by child window controls. (False)
52. DeleteEnhMetaFile() function delete the metafile from the hard disk. (False)
53. CreateMetaFile() function can be used to create enhanced metafile. (False)
54. One limitation with critical sections is that they can used for coordinating threads within a single process only. (True)
55. A dynamic-link library file can have any file extension. (True)
Page 4 of 4
ACTS National Resource Center, Pune
Question Bank –Win32 SDK (Solved)
A B
1. DispatchMessage() A. A Macro
2. MAKEINTRESOURCE() B. Windows NT
3. DestroyWindow() C. WndProc()
4. Security API D. Replacement for .INI files
5. Windows Registry E. Modeless Dialog Boxes
A B
a) List box 1) InterTask Communication
b) Metafile 2) System Global Class
c) Pen Plotter 3) Pseudo Device
d) Laser Printer 4) GDI Object
e) Region 5) Raster Output Device
f) Clipboard 6) Vector Output Device
Page 5 of 5
ACTS National Resource Center, Pune
Question Bank –Win32 SDK (Solved)
2. From the following, which is the message that dialog box processes?
a) WM_DESTROY b) WM_QUIT
c) WM_COMMAND d) WM_CLOSE
7. Which of the following is the correct declaration for Window Procedure WndProc?
a) LRESULT CALLBACK WndProc(HWND, UINT, LPARAM, WPARAM);
b) LRESULT CALLBACK WndProc(UINT, HWND, WPARAM, LPARAM);
c) LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
d) LRESULT far WndProc(HWND, UINT,WPARAM, LPARAM);
8. A child window control sends WM_COMMAND message to the parent window. The handle of child window control is
contained in the following message parameter.
a) wParam b) lParam
c) LOWORD (wParam) d) HIWORD (wParam)
9. The name of the system defined class for a check box control is-
a) CheckBox b) option
c) RadioButton d) button
10. In an MDI application, the responsibility of rearranging/ cascading document windows lies with
a) MDI Client b) MDI Frame Window
c) Main Window d) Child Window
11. This message is sent by the windows common controls (TreeView/ ListViews) to the parent window.
a) WM_COMMAND b) WM_COPY
c) WM_CREATE d) WM_NOTIFY
Page 6 of 6
ACTS National Resource Center, Pune
Question Bank –Win32 SDK (Solved)
13. While processing WM_PAINT message this GDI function can be used to get the handle of device context.
a) GetDC() b) GetWindowDC()
c) BeginPaint() d) CreateCompatibleDC()
16. Windows NT is
a) Non Preemptive b) Preemptive
c) Co-operative preemptive d) Multi Preemptive
17. Which of the following messages terminates the message loop in WinMain() ?
a) WM_DESTROY b) WM_CLOSE
c) WM_QUERYENDSESSION d) WM_QUIT
20. Which of the following message does a scroll bar to its parent window not send?
a) WM_VSCROLL b) WM_HSCROLL
c) WM_COMMAND d) WM_CTLCOLORSCROLLBAR
23. Which of the following header file is required for an application using a common dialog?
a) CommCtl32.h b) Commdlg.h
c) Comdlg.h d) Commctl.h
24. Which of the following structures has a field that gives the offset of the pixel bits from the beginning of a device
independent bitmap file?
a) BITMAPFILEHEADER b) BITMAPINFO
c) BITMAPINFOHEADER d) RGBQUAD
25. The virtual key code for the page down key is
a) VK_DOWN b) VK_PGDOWN
c) VK_NEXT d) VK_PAGE
26. Which of the following API can be used to get a pointer to a global memory block if it’s handle is available.
a) GlobalLock() b) GlobalAllock()
c) Both d) None
Page 7 of 7
ACTS National Resource Center, Pune
Question Bank –Win32 SDK (Solved)
27. Which of the following APIs can be used to get the HINSTANCE of the application?
a) GetModuleInstance() b) GetClassLong()
c) GetWindowLong() d) SetClassLong()
28. In an MDI application, sending the WM_MDICREATE message with the following structure as lParam to the MDI
Client window can create a document window.
a) MDICREATESTRUCT b) CLIENTCREATESTRUCT
c) CREATECLIENTSTRUCT d) CREATEMDISTRUCT
29. Which of the following structure is used with the APIs related to kernel objects?
a) SECURITY_DESCRIPTOR b) SECURITY_ATTRIBUTES
c) SECURITY_INFORMATION d) SECURITY_MESSAGE
30. Which state a thread acquires when it is created by CreateThread()?
a) Running b) Sleeping
c) Ready d) Blocked
31. When a DLL is unmapped from a process’s address space, the system calls the DLL’s DllMain function passing it
the following value as the fdwReason argument.
a) DLL_THREAD_ATTACH b) DLL_PROCESS_ATTACH
c) DLL_THREAD_DETACH d) DLL_PROCESS_DETACH
32. You can set the Viewport extent and Window extent in:
a) MM_ANISOTROPIC mapping mode
b) MM_ISOTROPIC mapping mode
c) In both the MM_ISOTROPIC and MM_ANISOTROPIC mapping modes
d) In none of these modes
37. Which is the first message that is send to a dialog box procedure ?
a) WM_INITDIALOG b) WM_NOTIFY
c) WM_COMMAND d) WM_CREATE
39. Which of the following is the correct prototype for DLL entry point function?
a) int WINAPI DllMain(HINSTANCE, DWORD, PVOID)
b) BOOL WINAPI DllMain(HINSTANCE, DWORD, PVOID)
c) int WINAPI DllMain(HINSTANCE, HINSTANCE, DWORD, PVOID)
d) int WINAPI DllMain(HINSTANCE, DWORD)
Page 8 of 8
ACTS National Resource Center, Pune
Question Bank –Win32 SDK (Solved)
42. Which message is used to remove all items from a list box?
a) LB_CLEAR b) LB_RESETALL
c) LB_CLEARCONTENT d) LB_RESETCONTENT
43. Which message is used to retrieve the number of items in a list box?
a) LB_COUNT b) LB_COUNTALL
c) LB_GETCONTENT d) LB_GETCOUNT
44. Which function is used to get the text of the edit box?
a) GetWindowMessage() b) GetWindowText()
c) GetText() d) GetWindowContent()
47. Which function can be used to add a menu item to a menu at runtime?
a) AddMenu() b) InsertMenu()
c) InsertMenuItem() d) ModifyMenu()
49. Which function is used to determine the number of buttons on the installed mouse?
a) GetSystemMetrics() b) GetSystemMouse()
c) GetMouseButtons() d) GetMouseInfo()
52. To get the handle of the system fonts, which function is used?
a) GetStockObject() b) GetFontHandle()
c) SelectObject() d) GetObjectHandle()
53. Which message should be processed by an application’s main window procedure?
a) WM_COMMAND b) WM_PAINT
c) WM_CREATE d) WM_DESTROY
Page 9 of 9
ACTS National Resource Center, Pune
Question Bank –Win32 SDK (Solved)
55. Which of the following message is not send to the window procedure?
a) WM_COMMAND b) WM_QUIT
c) WM_CLOSE d) WM_SETFOCUS
56. Which function returns an HDC that can be used to paint any where on the window?
a) BeginPaint() b) GetDC()
c) GetWindowDc() d) CreateIC()
57. Which functions should be called to get an HDC and free it while processing WM_PAINT message?
a) BeginPaint()......EndPaint() b) GetDC()..........ReleaseDc()
c) CreateDc().........DeleteDc() d) GetWindowDC()..........ReleaseDc()
58. Which function is used to change the current pen present in HDC?
a) SelectObject() b) CreatePen()
c) SelectPen() d) CreateObject()
60. Which is the message for which TranslateMessage() function generate WM_DEADCHAR message.
a) WM_KEYUP b) WM_KEYDOWN
c) WM_COMMAND d) WM_CHAR
61. Which is the first message that is generated for any mouse event?
a) WM_KEYUP b) WM_NCHITTEST
c) WM_COMMAND d) WM_MOUSEMOVE
64. Which message is send from a child control to parent window containing notification code?
a) WM_CLICKED b) WM_CHILD
c) WM_COMMAND d) WM_CREATE
65. Which child control never sends WM_COMMAND to its parent window?
a) listbox b) edit
c) static d) scrollbar
66. Which child control does not send WM_COMMAND message to its parent window by default?
a) listbox b) edit
c) static d) scrollbar
Page 10 of 10
ACTS National Resource Center, Pune
Question Bank –Win32 SDK (Solved)
68. Which function is used for checking the type of information available in clipboard?
a) GetClipboard() b) IsClipboardFormatAvailable
c) GetClipboardData() d) GetClipboardFormat()
70. Which identifier is used in the SetClipboardData(), to store metafile in the clipboard?
a) CF_TEXT b) CF_META
c) CF_METAFILE d) CF_METAFILEPIC
71. Which function is used to delete all the data stored in the clipboard?
a) CloseClipboard() b) EmptyClipboard()
c) DeleteClipboard() d) ClearClipboard()
72. Which function is used to determine all the formats stored in the clipboard?
a) SelectAllClipFormats() b) EnumClipboardFormats()
c) GetClipboardData() d) EnumClipFormats()
77. Which one is not a constant for the fourth argument of the MessageBox() function?
a) MB_YES b) MB_OK
c) MB_YESNO d) MB_OKCANCEL
Page 11 of 11
ACTS National Resource Center, Pune
Question Bank –Win32 SDK (Solved)
Page 12 of 12
ACTS National Resource Center, Pune
Question Bank –Win32 SDK (Solved)
42. Is it possible to have more WM_KEYDOWN messages than WM_KEYUP messages? When does such
situation occur?
43. Write an appropriate code snippet to demonstrate the use of InvalidateRect() in response to a
WM_CHAR message?
44. How do you get the status of SHIFT keys while processing a mouse message?
45. Name any 5 menu related messages.
46. What is subclassing? Write the steps and necessary APIs to subclass an edit class.
47. Write a code snippet that is required to bring a Color Dialog Box on screen.
48. In a small piece of code show the use of the API SetCursor().
49. Write the message loop for a program which uses a modeless dialog box.
50. Explain the use of the following APIs:
GetDlgItemText() GetDlgItemInt()
51. Explain the meaning of the following style flags related with a Window Class. CS_CLASSDC,
CS_PARENTDC, CS_OWNDC.
52. Explain with example the use of BitBlit() API.
53. How a logical font is created? Explain with appropriate APIs and Structures.
54. What are Meta files ?
55. Write a small piece of code to demonstrate the creation of a meta file.
56. Explain the following APIs.:
OpenClipboard() IsClipboardFormatAvailable()
57. Explain the following APIs.:
EmptyClipboard(), SetClipboardData(), SetClipboardViewer()
58. How these messages are used.
WM_COPY WM_PASTE
WM_PAINTCLIPBOARD WM_CHANGECBCHAIN
59. How UNICODE can be useful in bringing all the languages on computers?
60. A dynamic link library gives us better speed performance than a static link library. (T/F)Justify your
answer.
1. Write the steps involved in creating a DLL and then using it in a program. Put two functions
AddTwoNums() and MultiplyTwoNums() inside the DLL. Write the code snippets to create the DLL.
2. What do you understand by Entry/Exit function in a DLL? How they are used?
3. Explain with example code snippets, the use of following structures.
MDICREATESTRUCT CLIENTCREATESTRUCT
4. Write the messages generated in proper order when a key is pressed which indicates:
• System keystroke message
• Non-system keystroke message
5. What is meant by a CALLBACK function. Which functions should be declared as CALLBACK?
6. What is window subclassing ? Write the skeleton of the steps required in subclassing a window.
7. What is the significance of the value returned by the Window Procedure while handling WM_CREATE
message?
8. What are the values send in WPARAM and LPARAM with the following messages?
• WM_PAINT
• WM_CREATE
• WM_COMMAND
• WM_MOUSEMOVE
Page 13 of 13
ACTS National Resource Center, Pune
Question Bank –Win32 SDK (Solved)
13. Write the pseudo code for your own function MyTranslateMessage() that replaces system’s API
TranslateMessage().
14. A DllMain() function has this declaration :-
int CALLBACK DllMain(HINSTANCE hInstance, DWORD dwReason, PVOID pReserved)
What is contained in dwReason and how it can be used?
15. CenterHorz() is a user defined function to center a given string in a given row on the client area of a given
window. Its declaration is as follows -
void CenterHorz(HWND, int, char *);
Implement it.
16. Write the steps required to use accelerators in your application.
17. How can you utilise the idle time of your application? Which portion of your code will you alter to achieve
this? Write the portion of the code, which will undergo change. 18. Write in brief the steps required to
create a DLL.
19. Explain the purpose and use of the API CreateThread().
20. Explain with example the purpose and use of the following APIs/structures/messages:
a. SetDIBitsToDevice()
b. EnterCriticalSection()
c. WaitForMultipleObjects()
d. NMHDR
e. WM_RENDERFORMAT
Page 14 of 14