Mindtree Fresher Recruitement C++ Test – January

1) Explain about different problems which C++ faces today.
The main problem which C++ faces today is because of its large feature set. It is almost similar to C language because of which much of the criticism faced by C++. It doesn’t have language features to create multi threaded software. Also this language is unruly compared to modern languages such as Java which has both object oriented and procedural programming.

2) Explain about name spaces?
Namespaces help you to group classes, functions, etc under one name which helps you to access it at later stage. To access these name spaces we can use scope operator. During name space naming there arises difficulty when a function uses the same name which causes redefinition errors.

3) Explain about exceptions and its relation to handlers?
This function is used for exceptional circumstances and this is made possible by handlers. This exception handler is placed in the code which throws exception and error. This exception throws error when the condition is not satisfied. This handler is placed in a try block in which throw function is present. After the try block a catch function is placed through which exception handlers are declared.

4) Explain about static_cast?
Static cast is very helpful for conversions from pointers to related class and also from derived class to base class. This static_cast is also helpful to convert base class to derived class. Static_cast makes sure that atleast classes and objects are completed. This has its disadvantages such as programmer should ensure that the object specified is being moved to its destination.

5) Explain about reinterpret_cast?
Reinterpret_cast is platform specific. The code generated for reinterpret_cast is generated for the platform which makes it not useful for inter operability. This transfers pointers, irrespective of classes. This forms a image of the specific class and also pointer pointed or the pointer itself is not checked. This can lead doors to security lapses.

6) Explain about explicit conversion within C++ and its supportability?
This explicit conversion is required where there is different interpretation on value. There are two different types of explicit conversion such as c like casting and functional. This explicit conversion can be applied indiscriminately on the code which significantly increases errors during run time.

7) Explain about implicit conversion in relation to C++?
Implicit conversion does not require any operator for performing its function. It automatically performs when a value is copied to the code. The only exception being, it should be compatible. This allows conversions between bool to numerical types, pointer conversions, and etc. significant runtime errors get reduced with this implicit conversion because it accepts values which are compatible.

8) Explain about the class string stream?
This string stream class is defined by a standard header file . This class provides flexibility in converting a string based object to stream. This is useful in extraction and insertion of numerical, strings, characters, etc. This is useful to extract a specific numerical from a string. This also aids in insertion.

9) What exactly a data structure performs in C++?
A data structure is a collection of data elements under one name. These data elements are collectively known as members and they can have variable lengths and types. Structure_name and object_name are two important types defined in C++. Structure types are defined by structure_name and object_name contains valid identifiers.

10) I am getting an error at runtime for an oversized array but it never shows it as a fault during debugging?
In C++ it is very correct syntactically to declare over sized array. It also never shows you any error during compilation but it shows error during run time. The answer lies in pointers. This problem can be mitigated if we can manually specify the memory location by using a reference operator. Automatically pointers assign the variable to a certain location and when it tries to extract during extraction it fails thus creating error.

Can you explain it better dude ?