T4Tutorials .PK

VU Past Papers CS410 – Midterm Most important Short Questions and Answers

Q2. Three main components of Microsoft Windows
Answer:

  1. Kernel
  2. GDI (Graphics Device Interface)
  3. User

Q3. Function to convert a message into character messages
Answer: Translate Message

Q4. If WS_CAPTION style is passed to Create Window, which style is included automatically?
Answer: WS_BORDER

Q5. WM_PAINT purpose
Answer: Informs the window procedure that the client area must be repainted.

Q6. Define PAINTSTRUCT structure
Answer: Holds information about the client area to paint, including:

Q7. Define a window according to Microsoft
Answer: A window is a graphical interface element in Microsoft Windows, allowing applications to display output and receive input. Introduced in Windows 1.0 in 1983.

Q8. Macro types with example
Answer:

Q9. CreateWindow structure and parameters
Answer: Used to create a window. Parameters include:

Q10. Virtual-key message
Answer: Identifies which key was pressed (device-independent). TranslateMessage converts it into a character message.

Q11. Typedef
Answer: Creates a synonym for a type (not a new type). Example: typedef int LENGTH;

Q12. Clipboard
Answer: Temporary storage for cut, copy, and paste operations. Managed by user32.dll. Cleared when Windows shuts down.

Q13. Responsibilities of GDI (2 main)
Answer:

Q14. System window classes for user vs system
Answer:

Q15. Selecting specific messages from message queue
Answer: Use GetMessage with message filters.

Q16. Conditions when WM_PAINT is sent
Answer:

Q17. SendMessage function
Answer: Sends a message to a window procedure and waits for it to process immediately. Used for communication between parent and child windows.

Q18. Two types of implicit type casting
Answer:

Q19. Superclassing/Subclassing
Answer: After implementing, always call the window procedure.

Q20. Types of brushes
Answer:

Q21. Variable pointer to constant data
Answer: Pointer can change, but the data it points to is constant. Example:
const char *ptr;

Q22. Multi-dimensional array declaration
Answer: Example: int provinces[50][500][1000];

Q23. Translate GetLastError() into string
Answer: Use GetLastError to retrieve extended error info.

Q24. Adding gradient to tab control
Answer: Use GradientFill in GDI or GDI+ for smooth background gradients.

Q25. Argument to macros
Answer: Macros can take arguments using #define with parentheses. Example:
#define min(X, Y) ((X)>(Y) ? (X):(Y))

Q26. Handling messages in subclassed window
Answer: Three options when message is received:

  1. Pass message to original procedure
  2. Modify message and pass it
  3. Do not pass the message

Q27. Steps to handle message generated by action
Answer: Use message loop, GetMessage, TranslateMessage, and DispatchMessage.

Q28. Program execution check (C++ code incomplete)
Answer: Code will not execute because of syntax errors (wrong void and const usage).

Q29. Multiplication program with macro
Answer: Use #define for multiplication of four integers. Example:
#define mul(a,b) (c=a*b)

Q30. Window components
Answer: Microsoft Windows consists of three components:

  1. Kernel
  2. GDI
  3. User
Exit mobile version