Home  Interview Questions  Certifications  Aptitude Questions  Tutorials  Placement Papers  Search  Resume  Soft Skills  Video  Forum  Blog

Android app on Google Play

Technical Interview Questions
Java Interview Questions
Unix Interview Questions
SQL Interview Questions
C# Interview Questions
C Interview Questions

Aptitude Interview Questions
C/C++ Aptitude Questions
C Aptitude Questions

C Tutorial
C++ Tutorial

Programming Source Codes
C/C++ Source Codes
C# Source Codes

Online Quiz
C Online Quiz
C++ Online Quiz

Soft Skills
Communication Skills
Leadership Skills




Download our Android App on Google Play Now and study on the Go!

C++ Interview Questions and Answers

What is a node class?
A node class is a class that,
* relies on the base class for services and implementation,
* provides a wider interface to the users than its base class,
* relies primarily on virtual functions in its public interface
* depends on all its direct and indirect base class
* can be understood only in the context of the base class
* can be used as base for further derivation
* can be used to create objects.
A node class is a class that has added new services or functionality beyond the services inherited from its base class.

What is a container class? What are the types of container classes?
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.

How do you write a function that can reverse a linked-list?

void reverselist(void)
head-<next = 0;
tail-<next = head;
node* pre = head;
node* cur = head-<next;
node* curnext = cur-<next;
head-<next = 0;
cur-<next = head;

for(; curnext!=0; )
cur-<next = pre;
pre = cur;
cur = curnext;
curnext = curnext-<next;

curnext-<next = cur;


node* reverselist(node* head)
if(0==head || 0==head->next)
//if head->next ==0 should return head instead of 0;
return 0;

node* prev = head;
node* curr = head->next;
node* next = curr->next;

for(; next!=0; )
curr->next = prev;
prev = curr;
curr = next;
next = next->next;
curr->next = prev;

head->next = 0;
head = curr;

return head;

What is polymorphism?
Polymorphism is the idea that a base class can be inherited by several classes. A base class pointer can point to its child class and a base class array can store different child class objects.

How do you find out if a linked-list has an end? (i.e. the list is not a cycle)
You can find out by using 2 pointers. One of them goes 2 nodes each time. The second one goes at 1 nodes each time. If there is a cycle, the one that goes 2 nodes each time will eventually meet the one that goes slower. If that is the case, then you will know the linked-list is a cycle.

Page Numbers :   1       2       3       4       5       6       7       8       9       10       11       12       13       14       15       16       17

Have a Question ? post your questions here. It will be answered as soon as possible.

Check Object Oriented Interview Questions for more Object Oriented Interview Questions with answers

Check Data Structure Interview Questions for more data structure interview questions with answers