Mindtree Fresher Recruitement C++ Test – December

1) Contrast and state the difference between visual c++ and ANSI c++?
Visual C++ deals with graphical user interface and is the most advanced IDE for creating complex applications. This is used to create real time applications.
ANSI C++ is the updated and advanced version than the earlier versions of C++. Libraries and functions are updated in ANSI C++ compared to the earlier versions.

2) State the difference between the structure for C and C++?
The main difference between the structure of C and C++ is, C struct can contain only data and C++ has access limitations and contains functions such as public, private, etc.www.hotwalkins.com

3) Define about template in C++ and instantiation?
The C++ feature that supports the definition of an object of undetermined type is called a template. Using a template allows the programmer to define the features of the class, while reserving the option of binding the type of the class to the class itself until a class of a particular type is actually needed. The creation of a class of a particular type is called instantiation.

4)
Define and explain about the classes in C++ comparing with C?
A C++ class builds on the concept of a structure. Whereas a C structure is a collection of named fields, a C++ class is a collection of named fields and methods that apply to objects of that class type. Additionally, the C++ language implements the concept of information hiding, restricting access to certain members of the class to methods of the class itself.

5) Explain about rational class?
Rational class contains two data members, numerator and denominator and seven method members, reduce, add, multiply, divide, equal, print, and set rational. The methods in the class Rational explicitly mention only one. This is because the class object for which they are invoked is an implicit parameter for each routine.

6) Explain about Templates in C++?
C++ templates are used to optimize code. They are very powerful as they help the program by providing various classes, functions and methods. There is also a disadvantage when we are using C++ templates, they tend to duplicate themselves and get installed which slows down the functioning of the program. This is avoided in Java.

7) Explain Encapsulation and differentiate with regards to C.
Encapsulation is an entirely new concept which is present in C++ but not in C. In Encapsulation you can restrict the access of the functions to Public, private and Protected which is not possible in C. It is a general practice among programmers to allow only partial functions which can help in designing to be public while the rest of the code is made into private or protected.

8) Explain multiple inheritances in C++?
Multiple inheritances in C++ are a controversial issue. In multiple inheritance a derived class or an unrelated class can obtain function of the base class. In this process it can obtain multiple inheritance. A derived class or unrelated class may obtain more than one base class. This can benefit as well as destroy the structure of the program.

9)
Explain about virtual member functions of C++?
Virtual member functions come into play when a function belonging to a derived class over rides a base class. This is possible only when there are many similarities in the number of parameters, function definition, object, etc. This increasingly becomes difficult to process during the run time. At this point of time virtual member functions comes to rescue. This overwhelming task is made easy by virtual functions tables.

10)
Explain the basic steps to parse a C++ source code?
The main difficulty to parse a C++ code lies in the complex definitions of C++ identifiers. They should also satisfy complex scoping rules for C++. Also they should define what type it is and to what type it belongs to. It should also satisfy the basic criteria of parsing source code.

Can you explain it better dude ?