Find Interview Questions for Top Companies
Ques:- How to convert a CString variable to char* or LPTSTR?
Asked In :-
Right Answer:
To convert a `CString` variable to `char*`, you can use the `CStringA` class:

```cpp
CString str = _T("Your CString");
CStringA strA(str);
char* charPtr = strA.GetBuffer();
```

To convert a `CString` variable to `LPTSTR`, you can use:

```cpp
CString str = _T("Your CString");
LPTSTR lptstr = str.GetBuffer();
```

Remember to call `ReleaseBuffer()` after using the buffer if you modify it.
Ques:- How can i communicate with two systems one is located some place another is located 100km how from the current systems which protocala i have to use
Asked In :-
Right Answer:
To communicate between two systems located 100 km apart, you can use TCP/IP over Ethernet or Wi-Fi. For long-distance communication, consider using protocols like HTTP/HTTPS for web services or MQTT for lightweight messaging.
Ques:- Does the application have more than one object? If Yes,Briefly explain.
Asked In :- ibp, commerce pundit, egh, dream11,
Right Answer:
Yes, the application can have more than one object. Each object can represent different entities or components within the application, allowing for modular design and better organization of code. For example, in a graphical application, you might have objects for windows, buttons, and menus, each handling its own behavior and properties.
Ques:- How many time DLLMain gets called?
Asked In :-
Right Answer:
DLLMain can be called multiple times during the lifetime of a DLL, specifically when the DLL is loaded or unloaded, and when threads are created or destroyed.
Ques:- Difference between Cclint DC & Cpaint Dc
Asked In :-
Right Answer:
CClientDC is used for drawing on a window's client area, while CPaintDC is specifically used for painting during the WM_PAINT message to ensure proper handling of the painting process.
Ques:- How many types of messages are there
Asked In :-
Right Answer:
There are two main types of messages in VC++: **Windows Messages** and **User-Defined Messages**.
Ques:- What is the difference between the SDI and MDI
Asked In :- webhelp, partnerhero,
Right Answer:
SDI (Single Document Interface) allows only one document to be open in a window at a time, while MDI (Multiple Document Interface) allows multiple documents to be opened within a single parent window.
Ques:- What is Thread ?(VC++)What is the difference between Cmutex and Csemaphone?
Asked In :-
Right Answer:
A thread is a lightweight process that allows multiple tasks to run concurrently within a single application.

The difference between CMutex and CSemaphore is:
- CMutex (Critical Section Mutex) is used to ensure that only one thread can access a resource at a time, providing mutual exclusion.
- CSemaphore allows a specified number of threads to access a resource concurrently, controlling access based on a count.
Ques:- General purpose classes in MFC
Asked In :-
Right Answer:
General purpose classes in MFC (Microsoft Foundation Classes) include:

1. **CObject** - Base class for all MFC classes.
2. **CWinApp** - Represents the application.
3. **CWnd** - Base class for all window classes.
4. **CDialog** - Base class for dialog boxes.
5. **CView** - Base class for views in the document/view architecture.
6. **CDocument** - Base class for documents in the document/view architecture.
7. **CFile** - Provides file handling capabilities.
8. **CArchive** - Supports serialization for saving and loading objects.

These classes provide essential functionality for building Windows applications.
Ques:- What is the updated verssion in vc++
Asked In :-
Right Answer:
The latest version of Visual C++ is part of Visual Studio 2022.
Ques:- What are some differences between a form view and a dialog box?
Asked In :-
Right Answer:
A form view is typically a larger interface that allows users to input and display data, often containing multiple fields and controls, while a dialog box is a smaller, temporary window that prompts the user for input or provides information, usually requiring user interaction before returning to the main interface.
Ques:- How to convert the content of buffer into lower case character.
Asked In :-
Right Answer:
You can convert the content of a buffer to lowercase in VC++ using the `tolower` function in a loop. Here’s a simple example:

```cpp
#include <cctype> // for tolower
#include <cstring> // for strlen

void convertToLower(char* buffer) {
for (size_t i = 0; i < strlen(buffer); ++i) {
buffer[i] = tolower(buffer[i]);
}
}
```
Ques:- How can I call a function, given its name as a string?
Asked In :-
Right Answer:
In VC++, you can use a function pointer to call a function by its name as a string. First, create a mapping of string names to function pointers, then use the string to look up the corresponding function pointer and call it. Here's a simple example:

```cpp
#include <iostream>
#include <string>
#include <map>

void myFunction() {
std::cout << "Function called!" << std::endl;
}

int main() {
std::map<std::string, void(*)()> functionMap;
functionMap["myFunction"] = &myFunction;

std::string functionName = "myFunction";
if (functionMap.find(functionName) != functionMap.end()) {
functionMap[functionName](); // Call the function
}

return 0;
}
```
Ques:- How we can read an Image in VC++?How we can find out theintensities of the pixels of an image and dimension of theimage?
Asked In :-
Right Answer:
To read an image in VC++, you can use the GDI+ library. Here’s a simple example:

1. Initialize GDI+.
2. Load the image using `Gdiplus::Image`.
3. Get the dimensions using `GetWidth()` and `GetHeight()`.
4. Access pixel intensities using `Gdiplus::Bitmap` and `GetPixel()`.

Here’s a code snippet:

```cpp
#include <windows.h>
#include <gdiplus.h>
using namespace Gdiplus;

void ReadImage(const wchar_t* filename) {
GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);

Image image(filename);
UINT width = image.GetWidth();
UINT height = image.GetHeight();

Bitmap bitmap(&image);
Color color;
for (UINT y = 0;
Ques:- Is it possible to display a window .without using windowclass
Asked In :-
Right Answer:
Yes, it is possible to display a window without using a window class by using the `CreateWindowEx` function with a predefined window class such as `WC_DIALOG` or `WC_STATIC`.
Ques:- How to Killi an Object Prematurely..
Asked In :-
Right Answer:
To kill an object prematurely in VC++, you can use the `delete` operator to deallocate the memory associated with the object. If the object is allocated on the heap, ensure that you call `delete` on the pointer to that object. If the object is allocated on the stack, it will be destroyed automatically when it goes out of scope.
Ques:- Name some important features of VC++?
Right Answer:
Some important features of VC++ include:

1. Object-oriented programming support
2. Integrated development environment (IDE) with MFC (Microsoft Foundation Classes)
3. Support for COM (Component Object Model) and ActiveX
4. Extensive libraries and frameworks
5. Debugging and profiling tools
6. Compatibility with Windows API
7. Support for multithreading and parallel programming
8. Code optimization and performance enhancements


Visual C++ (VC++) is a powerful and comprehensive development environment provided by Microsoft for the C++ programming language. It is a cornerstone of the Visual Studio suite and is specifically optimized to create high-performance, native applications for the Windows platform. While C++ is a general-purpose, cross-platform language, Visual C++ provides a complete and integrated toolchain that makes it the preferred choice for developers who require deep control over system resources and performance.

The VC++ environment is much more than just a compiler; it is an Integrated Development Environment (IDE) that offers a robust set of tools for every stage of the development process. This includes a sophisticated code editor with features like IntelliSense (for intelligent code completion), a powerful debugger for identifying and fixing errors, and profiling tools to analyze and optimize application performance. It also supports various Microsoft-specific libraries and frameworks, such as the Microsoft Foundation Classes (MFC) for building desktop applications and the Win32 API for direct interaction with the Windows operating system.

The primary strength of Visual C++ lies in its ability to generate highly optimized machine code, which is essential for applications where speed and efficiency are paramount. This makes it the go-to solution for a wide range of professional applications, including:

  • Video Games: The high performance and low-level control of VC++ are ideal for developing game engines and graphics-intensive software.
  • System-Level Programming: It is used for creating operating system components, device drivers, and other system-critical software.
  • High-Performance Computing: Applications in areas like financial modeling, scientific simulations, and high-frequency trading rely on VC++ for its raw speed.

In recent years, Visual C++ has expanded its capabilities to support cross-platform development, allowing developers to use the same powerful toolchain to build applications for Linux and other operating systems. In summary, Visual C++ combines the power and flexibility of the C++ language with a suite of professional-grade tools, making it an indispensable resource for building high-performance, native, and complex software.

AmbitionBox Logo

What makes Takluu valuable for interview preparation?

1 Lakh+
Companies
6 Lakh+
Interview Questions
50K+
Job Profiles
20K+
Users