Languages-C & C Plus Plus [3i Infotech Placement]: Sample Questions 182 - 185 of 354

Glide to success with Doorsteptutor material for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 182

C & C Plus Plus
Edit

Write in Short

Short Answer▾

In C ++ there is only virtual destructor, no constructors. Why?

Explanation

  • Constructors are invoked at the time of object creation.
  • V-table for virtual function mechanism is not initialised properly during the constructor invocation and hence there is no possibility if virtual constructors
  • Destructors can virtual.
  • V-table is properly initialised at the time of object creation.
  • V-table is available for the destructors.

Question 183

C & C Plus Plus
Edit

Write in Short

Short Answer▾

How can we read/write structures from/to data files?

Explanation

  • Programs can write a structure using fwrite () and a corresponding fread () invocation will read them back in.
  • Data files are ⚹ not ⚹ portable.
  • Pointers in structure will write address values most likely to be in valid when read back.

Question 184

C & C Plus Plus
Edit

Describe in Detail

Essay▾

What is cloning?

Explanation

  • An object carries copying in two ways
    • Set itself to be a copy of another object
    • Return a copy of itself- this is called cloning.
  • Cloning makes an exact copy of an object.
Given the Image is Cloning Example

Question 185

C & C Plus Plus
Edit

Describe in Detail

Essay▾

What do you mean by binding of data and functions?

Explanation

  • Data binding is the process of binding the data objects used by the program with the actual physical memory.
  • Two types of binding.
  • Early binding
    • The process of binding the data objects and the physical memory at compile time.
    • The memory is allocated to the data object when the application is loaded into the memory for execution.
  • Late binding
    • The process of associating memory to the objects at run-time, when these objects are dynamically created.
    • Minimal memory is bound to these objects as these are pointers.
Two Types of Binding

Developed by: