Question: When you write a program that stores a value in a variable, you are using which kind of storage
(A). temporary
(B). Permanent
(C). Both
(D). None of these
MCQs Answer:
(A). temporary
C++ Program that stores the temporary values in the variables of num and cube
1 2 3 4 5 6 7 8 9 10 |
#include <iostream> using namespace std; int main () { int num= 3; int cube; cube= num*num*num; cout <<"The cube is: " << cube << endl; return 0; } |
Output
The cube is: 27
Explanation
In this example when the program will execute, then the value of 3 will temporarily load on ram. Similarly, the value of variable cube 27 will also load on the main memory.
Example 2
The screenshot is showing the temporary storage of values in variables of X, Y nad temp.