Top 21 Microsoft Visual C++ Interview Questions You Must Prepare 19.Mar.2024

This defines a template to parse certain regular expressions. It also defines several classes and functions to search text that is matching a regular expression object. There are many declarations, type definitions, template functions, and operator.

There are few differences:

  • All members of struct are public.
  • Default inheritance for struct is public, where as for class the default inheritance is private.

Utility function has several general templates and can be used in Standard template library. Some of them are tuple element Class which is used to wrap the type of pair element. Get function is used to get an element from the pair object. Tuple size class wraps the pair element count.

Some of the new features which are introduced to VC++ are a large set of new MFC classes which will certainly help in building modern user interfaces. TR1 is the major addition to the pack of VC++. This also has new user interface, adjustable panes, and support for Microsoft office ribbon, controls, dialog boxes and windows.

Stack based buffer over run protects the program from executing malicious code. Function epilogue code checks the returned cookie for similarity if there is a mismatch it stops executing the code. It also moves around the stack which makes the data corruption harder. These features are present in Visual C++ 20@It also mitigates various buffer over runs through memory decrease.

Multiple providers of libraries might use common global identifiers causing a name collision when an application tries to link with two or more such libraries. The namespace feature surrounds a library?s external declarations with a unique namespace that eliminates the potential for those collisions.

MFC uses the resource handle of the main application to load the resource template. If you have an exported function in a DLL, such as one that launches a dialog box in the DLL, this template is actually stored in the DLL module. You need to switch the module state for the correct handle to be used. You can do this by adding the following code to the beginning of the function:

AFX_MANAGE_STATE(AfxGetStaticModuleState( ));

This swaps the current module state with the state returned from AfxGetStaticModuleState until the end of the current scope.

Some of the important features of VC++ are as follows:

  1. Smart pointers
  2. New containers
  3. Expression parsing
  4. Polymorphic function wrappers
  5. Type traits and sophisticated random number generators.

Microsoft visual C++ helps programmers and developers to create windows and .NET based applications. This also helps in developing applications for web, windows based applications, solutions for thin and smart client based mobile devices. It is used for developing applications for windows API, .NET framework, etc.

If you want to provide a window to an application it is imperative to create a thread which can be done using CWinThread. A public member variable is used with CWinThread is m_pMainWnd. The main advantage which you can get when using this thread, it terminates the application without any hassles.

Tuple defines instances of objects in varying types. Declarations, template functions and functions are defines in tuples. In class there are three elements they are tuple class, tuple size Class and tuple element Class are defined in Visual C++.

This class helps to do the serialization and de-serialisation. storing of objects from and to disk storage. The CArchive class allows user to save a complex objects to the permanent storage (usually disk storage) binary format. This objects persists after those objects are deleted. Later you can load the objects from permanent storage, reconstituting them in memory. 

Unordered_map defines container template classes such as unordered map and unordered multimap template. Under declarations unordered map Class and unordered multimap class are defined. These classes store hash table.

A template function cannot be distributed in the obj form. This is because, fuction with which parameters the template function is going to be called is decided at the run time only. Therefore an obj form of a template function cannot be made by merely compiling it.

To display an output for a certain application programmers have to use InitApplication() method. InitApplication is a Boolean method. This function outputs a true if an application gets succeeded. If it did not succeed it displays a false command. Applications rely on this method to display a certain o/p.

These are the following situations where /GS compiler is not applied.

  1. When functions do not contain a buffer
  2. When optimizations is not enabled
  3. It is obvious when functions are defined to have a variable argument list it cannot create a static cookie.
  4. If functions are marked with a naked keyword such as (C++) etc a GS compiler cannot be created.

MFC has an extensive set of classes present in its library out of which CFrameWnd is one of those. This is a very important class and it is used frequently. User defined classes can be created by CFrameWnd. To create a windows frame CFrameWnd provides class

Regex_search function searches for a regular expression. A true function is returned only when the search in its operand sequence succeeds. It also defines the various capture groups in the regular expression. Some of the parameters are alloc, Elem, RXtraits, etc.

Frame describes about the borders, dimensions and location of the window. Two types of MFC applications are present which use a frame. Application using frames use a concept known as Document/View architecture. This architecture allows a certain program to be present in applications.

 A type predicate takes one or more arguments and it is a template. If a type predicate is true it is publicly derived directly or indirectly from true type def. In case it is false it is publicly derived from false type def.

The virtual function mechanism is used on the specific object that determines which virtual function to call. Since the static functions are not any way related to objects, they cannot be declared as virtual.