C++ Questions

Q:

What is namespace?

Answer

The C++ language provides a single global namespace.Namespaces allow to group entities like classes, objects and functions under a name.

Report Error

View answer Workspace Report Error Discuss

Subject: C++

0 2915
Q:

Which is best for coding the standard libary for c++?

A) no trailing underscores on names B) complex objects are returned by value
C) have a member-swap() D) All of the mentioned
 
Answer & Explanation Answer: D) All of the mentioned

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: C++

1 2904
Q:

What are the operators available in dynamic memory allocation?

A) new B) delete
C) compare D) both a & b
 
Answer & Explanation Answer: D) both a & b

Explanation:

new and delete operators are mainly used to allocate and deallocate
during runtime.

Report Error

View Answer Report Error Discuss

Filed Under: C++

1 2807
Q:

What do you mean by late binding?

Answer

Late binding refers to function calls that are not resolved until run time. Virtual functions are used to achieve late binding. When access is via a base pointer or reference, the virtual function actually called is determined by the type of object pointed to by the pointer.

Report Error

View answer Workspace Report Error Discuss

Subject: C++

0 2801
Q:

What is C++

Answer

C++ is created by Bjarne Stroustrup of AT&T Bell Labs as an extension of C, C++ is an object-oriented computer language used in the development of enterprise and commercial applications. Microsoft’s Visual C++ became the premier language of choice among developers and programmers.

Report Error

View answer Workspace Report Error Discuss

Subject: C++

0 2790
Q:

What do you mean by stack unwinding?

Answer

Stack unwinding is a process of calling all destructors for all automatic objects constructed at run time when an exception is thrown. Destructors are called between the places where the exception was thrown and where it is caught.

Report Error

View answer Workspace Report Error Discuss

Subject: C++

0 2788
Q:

Explain one-definition rule (ODR).

Answer

According to one-definition rule, C++ constructs must be identically defined in every compilation unit they are used in. 


As per ODR, two definitions contained in different source files are called to be identically defined if they token-for-token identical. The tokens should have same meaning in both source files. 


Identically defined doesn’t mean character-by-character equivalence. Two definitions can have different whitespace or comments and yet be identical.

Report Error

View answer Workspace Report Error Discuss

Subject: C++

0 2751
Q:

What is copy constructor?

Answer


Copy constructor is a constructor function with the same name as the class and used to make deep copy of objects.

Report Error

View answer Workspace Report Error Discuss

Subject: C++

0 2692