Skip to main content

Posts

Showing posts from September, 2011

C++/OOPS Interview Questions With Answers - Part XX.

Here, are some sample questions based on "C++/OOPS Programming language". Read it carefully as these questions will help you in cracking any interview. 96) What is a stack? The memory area that stores the return address of the functions, arguments passed to functions, and local variables of functions is called a stack. 97) What is meant by overflow in C++? If one tries to insert a node into a linked list, when there is no memory available, it is called ‘Overflow’. 98) What is an infix expression? An expression in which operators are placed in between the operands is called an infix expression. 99) What do you mean by static binding? Static binding or early binding is the process of selection of a particular function for a particular call at the compile time. 100) What do you mean by a node? A part of a linked list storing information of an element as well as having a pointer to the next node is called a node. ALSO READ: Frequently Asked C++

C++/OOPS Interview Questions With Answers - Part XIX.

Here, are some sample questions based on "C++/OOPS Programming language". Read it carefully as these questions will help you in cracking any interview. 91) State conditions under which binary search is applicable. For binary search, The list must be sorted. Lower bound and upper bound of the list must be known. 92) What is a linked list? A linked list is a collection of data elements , called nodes pointing to the next nodes by means of pointers. 93) Differentiate between functions read() and write(). The read() function lest one read a unit of information from a file and the write() function lets one write a unit of information to a file. 94) What is a null pointer? A pointer that does not point to any data object is called a null pointer , In C++, the null pointer can be represented by the constant 0. 95) What is a memory leak? A situation in which there lie so many orphaned memory-blocks that are still allocated but no pointers are referenc

C++/OOPS Interview Questions With Answers - Part XVIII.

Here, are some sample questions based on "C++/OOPS Programming language". Read it carefully as these questions will help you in cracking any interview. 86) Name the streams generally used for file operations. Ifstream, ofstream and fstream. 87) What do you mean by ‘this’ pointer? The ‘this’ pointer is an already created object pointer that points to currently calling object. 88) What is a data structure? A named group of data of different data types which can be processed as a single unit is referred to as a data structure. 89) List four major operations associated with linear data structures. Four major operations performed on data structures are searching, sorting, traversing and inserting. 90) What are trees in C++? Trees are non-linear data structures having a hierarchical relationship between various elements called nodes. Topmost node is called the root of the tree and the bottommost nodes are called leaves of the tree. ALSO READ: Fre

C++/OOPS Interview Questions With Answers - Part XVII.

Here, are some sample questions based on "C++/OOPS Programming language". Read it carefully as these questions will help you in cracking any interview. 81) What is a nested structure ? A nested structure is a structure having another structure as its member element. It finds a wide range of applications in C++ components like linked lists. 82) How are arrays and structures related to each other ? Arrays bring together a group of items of the same data type whereas structures bring together a group of related data items of any data type. 83) How are structures and classes related to each other ?                                              OR What is the difference between structure and class? Structure is actually a class in C++ declared with keyword struct. By default, all members are public in a structure, while on the other hand, all members are private by default in classes. 84) What is the difference between get and getline member functions ? T

C++/OOPS Interview Questions With Answers - Part XVI.

Here, are some sample questions based on "C++/OOPS Programming language". Read it carefully as these questions will help you in cracking any interview. 76) What do you mean by a static data member and a static member function? Answer: A static data member is a class data member common to all the objects of a class. A static member function is a member function that can access only the static data members. 77) What is modularity in C++? Answer: Modularity is the property of a system that has been decomposed into a set of cohesive and loosely coupled modules . In other words, modularity is the act of partitioning a program into individual components is called modularity. 78) What do you mean by data abstraction? Answer: Data abstraction is the act of representing essential features without including the background details. 79) What is a pointer? How will you define a pointer to an integer and a pointer to a character? Answer: A pointer is a variable whic

C++/OOPS Interview Questions With Answers - Part XV.

Here, are some sample questions based on "C++/OOPS Programming language". Read it carefully as these questions will help you in cracking any interview. 71) What is abstraction? Answer: Data abstraction refers to the act of representing essential features without including the background details or explanations. Data abstraction is an important characteristic of object oriented programming. 72) How is abstraction and encapsulation interrelated? Answer: Encapsulation wraps up data and functions under a single unit and ensures that only essential features get represented without representing the background details which is nothing but abstraction. Therefore, encapsulation is a way of implementing abstraction . 73) What is an adaptor class or Wrapper class? Answer: A wrapper class or an adaptor class refers to the method by which classes wrap their primitive values in a class and offers access to them through objects. A few of the primitive wrapper data types a

C++/OOPS Interview Questions With Answers - Part XIV.

Here, are some sample questions based on "C++/OOPS Programming language". Read it carefully as these questions will help you in cracking any interview. 66) What is meant by inheritance hierarchy ? Answer: The relationship between a base and derived class is referred to as a derivation or inheritance hierarchy . The derivation from multiple base classes is referred to as a derivation or inheritance graph. 67) Differentiate between multiple and multilevel inheritances ? Answer:  Multiple inheritance is the inheritance hierarchy wherein one derived class inherits from multiple base classes. Multilevel inheritance is the inheritance hierarchy wherein a subclass acts as a base class for other classes. 68) What is an ABC (`Abstract Base Class') ? Answer: A class serving only as a base class for other classes and no objects of which are created is known as an abstract base class. 69) What is a `virtual destructor' ? Answer: A virtual destructor is

C++/OOPS Interview Questions With Answers - Part XIII.

Here, are some sample questions based on "C++/OOPS Programming language". Read it carefully as these questions will help you in cracking any interview. 61) What is meant by a visibility mode? Answer: The public, private or protected specifier that controls the visibility and availability of a member in a class is called a visibility mode. 62) What's the difference between `public:', `private:', and `protected:' visibility modes? Answer: The differences between the `public:', `private:', and `protected:' visibility modes lie in the ways in which members and functions can be accessed within a class. In the publicly derived class , the public and protected members of the base class become public and protected members of the derived class. In the privately derived class , the public and protected members of the base class become private members of the derived class. In the protectedly derived class , the public and protected members

C++/OOPS Interview Questions With Answers - Part XII.

Here, are some sample questions based on "C++/OOPS Programming language". Read it carefully as these questions will help you in cracking any interview. 56) Define free store ? Answer:It is a pool of unallocated heap memory given to a program that is used by the program for dynamic allocation during execution. 57) What do you mean by a self referential structure? Answer:A structure having a member element that refers to the structure itself is called a self-referential structure. 58) What is inheritance? What the types of inheritance? Answer: Inheritance is the capability of one class to inherit properties from another class. The class from which properties are inherited is called a base class and the class inheriting properties is called the derived class. 59) What are the different types of inheritances? Answer: Inheritances are of many types namely single inheritance, multiple inheritance, multilevel inheritance, hierarchical inheritance and hybrid

C++/OOPS Interview Questions With Answers - Part XI.

Here, are some sample questions based on "C++/OOPS Programming language". Read it carefully as these questions will help you in cracking any interview. 51) What if I forget the `[ ]' when `deleteing array allocated via `new X[n]'? Answer: Basically, it is the duty of the programmer, and not the compiler, to get the connection between the ‘new X[n]’ and the ‘[]’. If the programmer fails in this, the compiler will not generate a runtime error or compile-time error but will result in a heap corruption. Otherwise, the program will die. 52) What are free store operators? Answer: Operators that facilitate dynamic memory allocation, i.e., allocation new and de-allocation delete operators are called free store operators. 53) What do you mean by free storage list or AVAIL list? Answer: A list keeping account of available free memory is called an AVAIL list or free storage list. 54) What is meant by static memory allocation? Answer: When the amount of mem

C++/OOPS Interview Questions With Answers - Part X.

Here, are some sample questions based on "C++/OOPS Programming language". Read it carefully as these questions will help you in cracking any interview. 46) Do ‘friends’ violate encapsulation? Answer: The friend lessens the value of encapsulation of separate classes in object oriented programming. Hence, too many external functions or friend functions are not advisable for use in object oriented programs. 47) What are some advantages/disadvantages of using friends? Answer: The major advantage of the friend function is that it allows a great degree of freedom in the interface design option. This function is useful when a class needs to hide certain components from the users and use it elsewhere. Friend function efficiently keeps the data details private and secure from the outside-class area. The major disadvantage of friend function is that it requires an extra line of code while using dynamic binding. 48) What do you mean by the friend function and friend

C++/OOPS Interview Questions With Answers - Part IX.

Here, are some sample questions based on "C++/OOPS Programming language". Read it carefully as these questions will help you in cracking any interview. 41) How is operator overloading implemented successfully in C++? Answer: In C++, operator overloading follows the same procedure of functioning as function overloading. The implementation of operator overloading depends upon the situation where the operator is used. For example, the ‘-‘sign, when used with a number, like -20, is read by the compiler to be a negative number. At the same time, when the ‘-‘ sign is associated with two numbers, like 8-5, then the compiler identifies it to be the subtraction operation. 42) What is abstract class? Answer:  Abstract class is a class that defines an interface, but does not necessarily provide implementations for all its member functions. No objects of an abstract class exist, i.e, it cannot be instantiated. 43) What is concrete class? Answer: A concrete class is a

C++/OOPS Interview Questions With Answers - Part VIII.

Here, are some sample questions based on "C++/OOPS Programming language". Read it carefully as these questions will help you in cracking any interview. 36) What is a copy constructor? Answer: A constructor that initializes an object using values of another object passed to it as parameter is called copy constructor . It creates the copy of the passed object. The format of declaration is: classname (classname &) 37) What is a default constructor? What is its role? Answer: A default constructor is the one that takes no arguments . It is automatically invoked when an object is created without providing any initial values. In case, the programmer has not defined a default constructor, the compiler automatically generates it. 38) What is meant by constructor overloading? Answer: Constructor overloading refers to a class having multiple constructor definitions, each having a different signature. 39) What is operator overloading? Answer: Operator overl

C++/OOPS Interview Questions With Answers - Part VII.

Here, are some sample questions based on "C++/OOPS Programming language". Read it carefully as these questions will help you in cracking any interview. 31) What is a constructor? Why would I ever use one? Answer: A constructor is a member function with the same name as that of its class. Constructors are automatically invoked when an object of the same class is created. The constructor has the same name as that of the class. A constructor is used often to initialize the objects of that class type with a legal initial value. 32) What are destructors really for? Why would I ever use them? Answer: A destructor is a member function with the same name as that of its class but is preceded by a tilde (~). Destructors are really for the purpose of de-initializing an object before it goes out of scope. 33) Is a default constructor equivalent to a constructor having default arguments? Answer: Yes, a default constructors is equivalent to a constructor having default