Advanced C++ Programming Interview Questions and Answers - 3

Question: 11

Write a short note on enumerated data type.

Enumerated data type helps users in creating a list of identifiers, also called as symbolic numeric constants of the type int.

Syntax : enum data type identifier ( value 1, value 2,….value n).

Question: 12

What are the rules for framing variable name?

Variable names may contain letters, numbers and underscore character(_).

Question: 13

What is the minimum and maximum address value for 640 kb memory size?

A memory size of 640 Kb will have addresses commencing from NULL and goes upto 655 359.

Question: 14

What is the use of the modifier unsigned?

When the modifier unsigned is used the integer data type will store only positive values, the sign bit is also used to store data.

Therefore the range to store data goes upto 2<sup>16</sub>, hence the maximum value will be 65535. The modifier alters the base data type to yield new data type.

Question: 15

Explain deep copy and a shallow copy?

Deep copy – It involves using the contents of one object to create another instance of the same class. Here, the two objects may contain the same information but the target object will have its own buffers and resources. The destructor of either object will not affect the remaining object.

Shallow copy – It involves the contents of one object into another instance of the same class. This creates a mirror image. The two objects share the same externally contained contents of the other object to be unpredictable. This happens because of the straight copying of references and pointers.

Related Questions