C++ Interview questions Part 12

C++ interview question:What is cloning? 
Answer:An object can carry out copying in two ways i.e. it can set itself to be a copy of another object, or it can return a copy of itself. The latter process is called cloning.

C++ interview question:Describe the main characteristics of static functions.
Answer:The main characteristics of static functions include,
Ø It is without the a this pointer,
Ø It can't directly access the non-static members of its class
Ø It can't be declared const, volatile or virtual.
Ø It doesn't need to be invoked through an object of its class, although for convenience, it may.

C++ interview question:Will the inline function be compiled as the inline function always?Justify.  

Answer:An inline function is a request and not a command. Hence it won't be compiled as an inline function always.
Explanation:  
Inline-expansion could fail if the inline function contains loops, the address of an inline function is used, or an inline function is called in a complex expression. The rules for inlining are compiler dependent.

C++ interview question:Define a way other than using the keyword inline to make a function inline.
Answer:The function must be defined inside the class.

C++ interview question:How can a '::' operator be used as unary operator?
Answer:The scope operator can be used to refer to members of the global namespace. Because the global namespace doesn’t have a name, the notation :: member-name refers to a member of the global namespace. This can be useful for referring to members of global namespace whose names have been hidden by names declared in nested local scope. Unless we specify to the compiler in which namespace to search for a declaration, the compiler simple searches the current scope, and any scopes in which the current scope is nested, to find the declaration for the name.

C++ interview question:What is placement new?
Answer:When you want to call a constructor directly, you use the placement new. Sometimes you have some raw memory that's already been allocated, and you need to construct an object in the memory you have. Operator new's special version placement new allows you to do it.

class Widget
{  
public :
Widget(int widgetsize);  
Widget* Construct_widget_int_buffer(void *buffer,int widgetsize)
{
return new(buffer) Widget(widgetsize);
}
};
This function returns a pointer to a Widget object that's constructed within the buffer passed to the function. Such a function might be useful for applications using shared memory or memory-mapped I/O, because objects in such applications must be placed at specific addresses or in memory allocated by special routines.


C++ interview question:What do you mean by analysis and design?
Answer:
Analysis:
Basically, it is the process of determining what needs to be done before how it should be done. In order to accomplish this, the developer refers the existing systems and documents. So, simply it is an art of discovery.
Design:
It is the process of adopting/choosing the one among the many, which best accomplishes the users needs. So, simply, it is compromising mechanism.


C++ interview question:What are the steps involved in designing?
Answer:Before getting into the design the designer should go through the SRS prepared by the System Analyst.
The main tasks of design are Architectural Design and Detailed Design.
In Architectural Design we find what are the main modules in the problem domain.
In Detailed Design we find what should be done within each module.


C++ interview question:What are the main underlying concepts of object orientation?
Answer:Objects, messages, class, inheritance and polymorphism are the main concepts of object orientation.


C++ interview question:What do u meant by "SBI" of an object?
Answer:SBI stands for State, Behavior and Identity. Since every object has the above three.
Ø State:
It is just a value to the attribute of an object at a particular time.
Ø Behaviour:
It describes the actions and their reactions of that object.
Ø Identity
An object has an identity that characterizes its own existence. The identity makes it possible to distinguish any object in an unambiguous way, and independently from its state.


C++ interview question:Differentiate persistent & non-persistent objects?
Answer:Persistent refers to an object's ability to transcend time or space. A persistent object stores/saves its state in a permanent storage system with out losing the information represented by the object.
A non-persistent object is said to be transient or ephemeral. By default objects are considered as non-persistent.


C++ interview question:What do you meant by active and passive objects?
Answer:Active objects are one which instigate an interaction which owns a thread and they are responsible for handling control to other objects. In simple words it can be referred as client.        Passive objects are one, which passively waits for the message to be processed. It waits for another object that requires its services. In simple words it can be referred as server.


C++ interview Question:What is meant by software development method?
Answer:Software development method describes how to model and build software systems in a reliable and reproducible way. To put it simple, methods that are used to represent ones' thinking using graphical notations.

Read more...

  © Blogger templates The Professional Template by Ourblogtemplates.com 2008

Back to TOP