In: Computer Science
1.) What type of data is stored in a pointer?
a. |
an integer |
|
b. |
a character |
|
c. |
A memory address |
|
d. |
None of the above |
2.) A stack in used to implement method calls in a program.
True or Flase?
1. Correct option: c. A Memory address
Pointer hold the address of a variable( can be of any type like integer, character, et .) that this pointer is pointing. Using this pointer, variable can be accessed.
2. Correct answer: True
Stack is used by a function which calls another function or itself. This is because, once the callee function gets completed, control has to return to the caller to the location where the caller function called the other function. Thus the address of the next instruction following the function call is placed in the stack. Once completing the called function, the return address is fetched from the stack and control is given to caller function.