December 22, 2018

Srikaanth

Amdocs Most Frequently Asked C++ Interview Questions Answers

What Is An Orthogonal Base Class In C++?

If two base classes have no overlapping methods or data they are said to be independent of, or orthogonal to each other. Orthogonal in the sense means that two classes operate in different dimensions and do not interfere with each other in any way. The same derived class may inherit such classes with no difficulty.

What Is A Container Class? What Are The Types Of Container Classes In C++?

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 In C++?

void reverselist(void)
{  if(head==0)
return;
if(head-<next==0)
return;
if(head-<next==tail)
{
head-<next = 0;
tail-<next =  head;
}  else
{
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;
}
}

What Is Polymorphism In C++?

Polymorphism in C++ 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.

How Can You Tell What Shell You Are Running On Unix System?

You can do the Echo $RANDOM. It will return a undefined variable if you are from the C-Shell, just a return prompt if you are from the Bourne shell, and a 5 digit random numbers if you are from the Korn shell. You could also do a ps -1 and look for the shell with the highest P(K).
Amdocs Most Frequently Asked C++ Interview Questions Answers
Amdocs Most Frequently Asked C++ Interview Questions Answers

What Is Boyce Codd Normal Form?

A relation schema R is in BCNF with respect to a set F of functional dependencies if for all functional dependencies in F+ of the form a->b, where a and b is a subset of R, at least one of the following holds

a->b is a trivial functional dependency (b is a subset of a).
a is a superkey for schema R.

What Is Pure Virtual Function?

A class is made abstract by declaring one or more of its virtual functions to be pure. A pure virtual function is one with an initializer of = 0 in its declaration.

Write A Struct Time Where Integer M, H, S Are Its Members

struct Time
{
int m;
int h;
int s;
};

How Do You Traverse A Btree In Backward In-order?

Process the node in the right subtree.
Process the root.
Process the node in the left subtree.

What Is The Two Main Roles Of Operating System?

As a resource manager.
As a virtual machine.

In The Derived Class, Which Data Member Of The Base Class Are Visible?

In the public and protected sections.

What Is The Difference Between Realloc() And Free()?

The free subroutine frees a block of memory previously allocated by the malloc subroutine. Undefined results occur if the Pointer parameter is not a valid pointer. If the Pointer parameter is a null value, no action will occur.

The realloc subroutine changes the size of the block of memory pointed to by the Pointer parameter to the number of bytes specified by the Size parameter and returns a new pointer to the block. The pointer specified by the Pointer parameter must have been created with the malloc, calloc, or realloc subroutines and not been deallocated with the free or realloc subroutines. Undefined results occur if the Pointer parameter is not a valid pointer.

What Is Function Overloading And Operator Overloading?

Function overloading: C++ enables several functions of the same name to be defined, as long as these functions have different sets of parameters (at least as far as their types are concerned). This capability is called function overloading. When an overloaded function is called, the C++ compiler selects the proper function by examining the number, types and order of the arguments in the call. Function overloading is commonly used to create several functions of the same name that perform similar tasks but on different data types.

Operator overloading allows existing C++ operators to be redefined so that they work on objects of user-defined classes. Overloaded operators are syntactic sugar for equivalent function calls. They form a pleasant facade that doesn't add anything fundamental to the language (but they can improve understandability and reduce maintenance costs).

What Is The Difference Between Declaration And Definition?

The declaration tells the compiler that at some later point we plan to present the definition of this declaration.
E.g.: void stars () //function declaration
The definition contains the actual implementation.

E.g.
void stars () // declarator
{
for(intj=10;j > =0;j—) //function body
cout«*;
cout« endl; }

What Are The Advantages Of Inheritance In C++?

It permits code reusability. Reusability saves time in program development. It encourages the reuse of proven and debugged high-quality software, thus reducing problem after a system becomes functional.

Subscribe to get more Posts :