3i Infotech Papers: Sample Questions 706 - 707 of 1245

Examrace Placement Series prepares you for the toughest placement exams to top companies.

Question number: 706

» Languages » C & C Plus Plus

Short Answer Question▾

Write in Short

What is dangling pointer?


  • Dangling pointer arises on using the address of an object after its lifetime is over.

  • This occurs in situations like returning addresses of the automatic variables from a function or using the address of the memory block after it is freed.

  • Dangling pointers arise during object destruction, when an object that has an incoming reference is deleted or deallocated, without modifying the value of the pointer, so that the pointer still points to the memory location of the deallocated memory.

Image of the dangling pointer

Image of the Dangling Pointer

Define the dangling pointers exploitation

Question number: 707

» Languages » C & C Plus Plus

Essay Question▾

Describe in Detail

What is a container class? What are the types of container classes?


  • A container class

    • Hold objects in memory or external storage.

    • Acts as a generic holder.

    • Has a predefined behavior and a well-known interface.

    • Supporting class for hiding the topology used for maintaining the list of objects in memory.

    • There are two type of container classes in c++, namely

    • 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.

Heterogeneous and homogeneous container

Heterogeneous and Homogeneous Container

Given the image is heterogeneous and homogeneous container classes