C++ Questions

Q:

What does inheriatance allows you to do?

A) create a class B) access methods
C) create a hierarchy of classes D) None of the mentioned
 
Answer & Explanation Answer: C) create a hierarchy of classes

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: C++

1 3312
Q:

.What are Stacks? Give an example where they are useful.

Answer

A Stack is a linear structure in which insertions and deletions are always made at one end i.e the top - this is termed as last in, first out (LIFO). Stacks are useful when we need to check some syntex errors like missing parentheses. 

Report Error

View answer Workspace Report Error Discuss

Subject: C++

0 3274
Q:

What are virtual functions?

Answer

Polymorphism is also achieved in C++ using virtual functions. If a function with same name exists in base as well as parent class, then the pointer to the base class would call the functions associated only with the base class. However, if the function is made virtual and the base pointer is initialized with the address of the derived class, then the function in the child class would be called.

Report Error

View answer Workspace Report Error Discuss

Subject: C++

1 3230
Q:

Where does the exception are handled?

A) inside the program B) outside the regular code
C) both a & b D) none of these
 
Answer & Explanation Answer: B) outside the regular code

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: C++

1 3204
Q:

How many items are presented in the associate container?

A) 2 B) 3
C) 4 D) 5
 
Answer & Explanation Answer: D) 5

Explanation:

There are 5 items presented in the associate container. They are set, multiset, map, multimap and bitset.

Report Error

View Answer Report Error Discuss

Filed Under: C++

1 3180
Q:

What is a template?

A) A template is a formula for creating a generic class B) A template is used to manipulate the class
C) A template is used for creating the attributes D) none of the mentioned
 
Answer & Explanation Answer: A) A template is a formula for creating a generic class

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: C++

1 3163
Q:

Differentiate between realloc() and free().

Answer

- Free() - A block of memory previously allocated by the malloc subroutine is freed by free subroutine. Undefined results come out if the Pointer parameter is not a valid pointer. If the Pointer parameter is a null value, no action will take place.


- Realloc() - This 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 be created with the malloc, calloc, or realloc subroutines and should not be deallocated with the free or realloc subroutines. Undefined results show up if the Pointer parameter is not a valid pointer.

Report Error

View answer Workspace Report Error Discuss

Subject: C++

0 3125
Q:

What does the sequence adaptor provide?

A) Insertion B) Deletion
C) Interface to sequence container D) None of thse
 
Answer & Explanation Answer: C) Interface to sequence container

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: C++

1 3073