C++ Questions

Q:

List out the areas in which data structures are applied extensively?

Answer

Compiler Design,


 Operating System,


 Database Management System,


Statistical analysis package,


Numerical Analysis,


 Graphics,


 Artificial Intelligence,


 Simulation

Report Error

View answer Workspace Report Error Discuss

Subject: C++

4 4015
Q:

A binary tree with 7 nodes will have how many null branches?

A) 6 B) 7
C) 8 D) 5
 
Answer & Explanation Answer: C) 8

Explanation:

A binary tree with n nodes has exactly n+1 null nodes

Report Error

View Answer Report Error Discuss

Filed Under: C++

1 3886
Q:

What do you mean by friend function in C++ ?

Answer

Friends can be either functions or other classes. The class grants friends unlimited access privileges.

* The declaration of the function should be preceded by the keyword 'friend'.
* The function definition will not use the keyword or the scope operator '::'.


Thus, a friend function is an ordinary function or a member of another class.

Report Error

View answer Workspace Report Error Discuss

15 3842
Q:

When should we use container classes instead of arrays?

Answer

It is advisable to use container classes of the STL so that you don’t have to go through the pain of writing the entire code for handling collisions, making sure its working well, testing it repeatedly with an overhead of time consumption.


Suppose you have some data that has values associated with strings and its fields consist of grades> in this situation you can directly use hash table instead of having it created by yourself.

Report Error

View answer Workspace Report Error Discuss

Subject: C++

7 3760
Q:

What is meant by template specialization?

A) It will have certain data types to be fixed. B) It will make certain data types to be dynamic.
C) Certain data types are invalid D) None of the mentioned
 
Answer & Explanation Answer: A) It will have certain data types to be fixed.

Explanation:

In the template specialization, it will make the template to be specific for some data types.

Report Error

View Answer Report Error Discuss

Filed Under: C++

1 3701
Q:

How many types of constructor are there in C++?

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

Explanation:

There are three types of constructor in C++. They are Default constructor, Parameterized constructor, Copy constructor.

Report Error

View Answer Report Error Discuss

Filed Under: C++

1 3698
Q:

What is meant by exception specification?

A) A function is limited to throwing only a specified list of exceptions. B) A catch can catch all types of exceptions.
C) A function can throw any type of exceptions. D) none of the mentioned
 
Answer & Explanation Answer: A) A function is limited to throwing only a specified list of exceptions.

Explanation:

C++ provides a mechanism to ensure that a given function is limited to throwing only a specified list of exceptions. It is called as exception specification.

Report Error

View Answer Report Error Discuss

Filed Under: C++

0 3693
Q:

What is the scope resolution operator?

Answer

Scope resolution operator allows a program to reference an identifier in the global scope that is hidden by another identifier with the same name in the local scope.

Report Error

View answer Workspace Report Error Discuss

Subject: C++

1 3676