s.no |
question |
Answer |
Learnings |
time |
1) |
the use of scope resolution operator? |
In C, the global version of the variable cannot be accessed from within the inner block. C++ resolves this problem by introducing a new operator :: called the scope resolution operator. It is used to uncover a hidden variable. |
Syntax:
variable name |
5min |
2) |
. What is the difference between normal function and a recursive function |
A recursive function is a function, which call it whereas a normal function does not.
Recursive function can’t be directly invoked by main function |
can’t be directly invoked by main function |
5min |
3) |
the importance of destructor. |
A destructor destroys the objects that have been created by a constructor upon exit from the program or block to release memory space for future use. It is a member function whose name is the same as the class name but is preceded by a tilde |
Syntax:
~classname(){ } |
5min |
4) |
modular programming.? |
It is a process of splitting a large program in to smaller modules to perform the operations fast and, which helps in easy error checking. Modules should be designed, implemented and documented with regard to their possible future use in other projects.
|
divided a program |
5min |
5) |
friend functions? |
C++ allows some common functions to be made friendly with any number of classes, thereby allowing the function to have access to the private data of thse classes. Such a function need not be a member of any of these classes. Such common functions are called friend functions.
|
function need not be a member of any of these classes |
5min |
6) |
What are the c++ operators that cannot be overloaded |
Size operator (sizeof)
Scope resolution operator (::)
Class member access operators(. , .*)
Conditional operator (?:)
|
c++ operators that cannot be overloaded |
5min |
7) |
virtual base class? |
When a class is declared as virtual c++ takes care to see that only copy of that class is inherited, regardless of how many inheritance paths exist between the virtual base class and a derived class |
|
5min |
8) |
the difference between base class and derived class? |
The biggest difference between the base class and the derived class is that the derived class contains the data members of both the base and its own data members. The other difference is based on the visibility modes of the data members |
difference between base class and derived class |
5min |
9) |
general format of class template |
The general format of a class template is:
template
|
class classname,
{
//………
//class member specification
//with anonymous type T
//wherever appropriate
//………
};
|
5min |
10) |
exception handling? |
The purpose of the exception handling mechanism is to provide a means to detect and report an “exceptional circumstance” so that appropriate action can be taken. |
exceptional circumstance |
5min |
11) |
List the kinds of exception. |
Exceptions are of two kinds namely
• Synchronous exceptions
• Asynchronous exceptions
|
Exceptions are of two kinds namely |
5min |
12) |
What are the errors in synchronous type exceptions |
Errors such as “out-of-range index” and “over-flow” belong to the synchronous type exceptions. |
“out-of-range index”
over-flow”
|
5min |
13) |
interface class |
interface class is an abstract class with public abstract methods all of which must be implemented in the inherited classes. |
public abstract methods |
5min |
14) |
the difference between Structure and Class? |
Structures are value type and Classes are reference type
Structures can not have constructors or destructors.
Classes can have both constructors and destructors.
Structures do not support Inheritance, while Classes support Inheritance.
|
Structure is a public access and class is a private access. |
5min |
14) |
Static class |
Static class is a class which can be used or accessed without creating an instance of the class. |
|
5min |
4) |
What are methods? |
Methods are the building blocks of a class, in which they are linked together to share and process data to produce the result.
Method is a block of code that contains a series of statements.
A method represents a behavior of a class. |
Methods are declared in a class or a structure by specifying the access level, the return value, the name of the method, and the method parameters |
5min |
5) |
constructors and destructors |
Constructors and destructors are special methods of every class.
Each class has its own constructor and destructor and are called automatically when the instance of a class is created or destroyed.
The constructor initializes all class members whenever you access the class and the destructor destroys them when the objects are not required anymore. |
|
5min |