FreeJobAlert.Com

Government Jobs | Results | Admit Cards

c++ interview questions and answers | Part4

If you would like to view All C++ language interview questions only, at one place, visit below link

All C++ Language Interview Questions

31. What problem does the namespace feature solve?
Ans: 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. This solution assumes that two library vendors don’t use the same namespace identifier, of course.

32. What is the use of ‘using’ declaration?
Ans: A using declaration makes it possible to use a name from a namespace

33. What is a template?
Ans: Templates allow us to create generic functions that admit any data type as parameters and return a value without having to overload the function with all the possible data types. Until certain point they fulfill the functionality of a macro. Its prototype is any of the two following ones:
template function_declaration;
template function_declaration;

34. Differentiate between a template class and class template?
Ans:
Template class:
A generic definition or a parameterized class not instantiated until the client provides the needed information. It’s jargon for plain templates.
Class template:
A class template specifies how individual classes can be constructed much like the way a class specifies how individual objects can be constructed. It’s jargon for plain classes.

35. What is the difference between a copy constructor and an overloaded assignment operator?
Ans: A copy constructor constructs a new object by using the content of the argument object. An overloaded assignment operator assigns the contents of an existing object to another existing object of the same class.

36. What is a virtual destructor?
Ans: The simple answer is that a virtual destructor is one that is declared with the virtual attribute.

37. What is an incomplete type?
Ans: Incomplete type refers to pointers in which there is non availability of the implementation of the referenced location or it points to some location whose value is not available for modification.
Example:
int *i=0×400 // i points to address 400
*i=0; //set the value of memory location pointed by i.
Incomplete types are otherwise called uninitialized pointers.

38. What do you mean by Stack unwinding?
Ans: It is a process during exception handling when the destructor is called for all local objects between the place where the exception was thrown and where it is caught.

39. What is a container class? What are the types of container classes?
Ans: A container class is a class that is used to hold objects in memory or external storage. A container class acts as a generic holder. A container class has a predefined behavior and a well-known interface. A container class is a supporting class whose purpose is to hide the topology used for maintaining the list of objects in memory. When a container class contains a group of mixed objects, the container is called a heterogeneous container; when the container is holding a group of objects that are all the same, the container is called a homogeneous container

40. Name some pure object oriented languages?
Ans: Smalltalk, Java, Eiffel, Sather.

Related Fresher Interview Questions

1. C Language Interview Questions
2. C++ Language Interview Questions
3. Data Structures Interview Questions
4. DBMS Interview Questions
5. Operating System Interview Questions
6. UNIX Interview Questions

Tags: aptitude question on c++, basic c++ interview questions, basic c++ interview questions and answers, basic c++ interview questions answers, c and c++ interview questions for freshers, c interview questions, c interview questions and answers, c interview questions and answers for freshers, c interview questions for freshers, c++ interview questions answers, c++ interview questions for experienced, cpp interview questions, cpp interview questions and answers, fresher interview questions, fresher interview questions and answers, fresher interview questions and answers on c and c++, fresher interview questions on c and c++, fresher interview questions with answers, interview question on c++, it fresher interview questions, it fresher interview questions and answers, objective question on c++, objective type question on c++, question on c++, questions for interview, technical question on c++, viva question on c++

Leave a Comment