Set - 3

Question 6 :

Why do we Use a Multidimensional Array?

Answer :

A multidimensional array can be useful to organize subgroups of data within an array. In addition to organizing data stored in elements of an array, a multidimensional array can store memory addresses of data in a pointer array and an array of pointers.

Multidimensional arrays are used to store information in a matrix form.
e.g. a railway timetable, schedule cannot be stored as a single dimensional array.
One can use a 3-D array for storing height, width and length of each room on each floor of a building.


Question 7 :

How do you assign an address to an element of a pointer array ?

Answer :

We can assign a memory address to an element of a pointer array by using the address operator, which is the ampersand (&), in an assignment statement such as ptemployee[0] = &projects[2];


Question 8 :

Run Time Memory Allocation is known as ?

Answer :

Allocating memory at runtime is called a dynamically allocating memory. In this, you dynamically allocate memory by using the new operator when declaring the array, for example : int grades[] = new int[10];


Question 9 :

What method is used to place a value onto the top of a stack?

Answer :

push() method, Push is the direction that data is being added to the stack. push() member method places a value onto the top of a stack.


Question 10 :

What method removes the value from the top of a stack?

Answer :

The pop() member method removes the value from the top of a stack, which is then returned by the pop() member method to the statement that calls the pop() member method.