Technical interview questions and answers are essential for a Windows Programming Interview because companies want to test your understanding of Windows API, event handling, message loops, memory management, threading, and GUI development. Windows programming is widely used in desktop applications and enterprise-level software, making it an important skill for developers applying for system-level programming roles. During technical rounds in companies like TCS, Wipro, Infosys, Cognizant, and Capgemini, candidates are often asked fundamental and practical questions about Windows architecture and coding techniques. This guide includes frequently asked Windows Programming interview questions with detailed explanations, making it easier for students and freshers to understand the concepts. These questions will help you improve your technical confidence and prepare better for placement tests and software development interviews.
Showing 10 of 31 questions
11. Name few functions that create Kernel Objects?
HANDLE CreateThread(…),HANDLE CreateFile(..),HANDLE CreateFileMapping(..)HANDLE CreateSemaphore(..)etcAll functions that create kernel objects return process-relative handles that can be used successfully by any and all threads that are running in the same process
12. What is handle?
Handle value is actually the index into the processs handle table that identifies where the kernel objects information is stored.
13. How the handle helps in manipulating the kernel objects?
Whenever you call a function that accepts a kernel object handle as an argument, you pass the value returned by one of the Create* functions. Internally, the function looks in your processs handle table to get the address of the kernel object you want to manipulate and then manipulates the objects data structure in a well-defined fashion.
14. What happens when the CloseHandle(handle) is called?
This function first checks the calling processs handle table to ensure that the index (handle) passed to it identifies an object that the process does in fact have access to. If the index is valid, the system gets the address of the kernel objects data structure and decrements the usage count member in the structure; if the count is zero, the kernel
15. What happens when the CloseHandle(handle) is called?
This function first checks the calling processs handle table to ensure that the index (handle) passed to it identifies an object that the process does in fact have access to. If the index is valid, the system gets the address of the kernel objects data structure and decrements the usage count member in the structure; if the count is zero, the kernel destroys the kernel object from memory.
16. You forget to call CloseHandle - will there be a memory leak?
Well, yes and no. It is possible for a process to leak resources (such as kernel objects) while the process runs. However, when the process terminates, the operating system ensures that any and all resources used by the process are freed—this is guaranteed. For kernel objects, the system performs the following actions: When your process terminates, the system automatically scans the processs handle table. If the table has any valid entries (objects that you didnt close before terminating), the
17. What is the need of process relative handles?
The most important reason was robustness. If kernel object handles were system-wide values, one process could easily obtain the handle to an object that another process was using and wreak havoc on that process. Another reason for process-relative handles is security. Kernel objects are protected with security, and a process must request permission to manipulate an object before attempting to manipulate it. The creator of the object can prevent an unauthorized user from touching the object simpl
18.
How the handles are handled in the child process?
The operating system creates the new child process but does not allow the child process to begin executing its code right away. Of course, the system creates a new, empty process handle table for the child process just as it would for any new process. But because you passed TRUE to CreateProcesss bInheritHandles parameter, the system does one more thing: it walks the parent processs handle table, and for each entry it finds that contains a valid inheritable handle, the system copies the entry
19. Why the entries in the parent process table and child table are same?
It means that the handle value that identifies a kernel object is identical in both the parent and the child processes
20. What about the usage count in the parent child process tables?
The system increments the usage count of the kernel object because two processes are now using the object. For the kernel object to be destroyed, both the parent process and the child process must either call CloseHandle on the object or terminate.