When you declare a variable of a basic, primitive type, such as int x = 10;, the memory address where x is located holds the ____.

a.
location in memory of 10

b.
memory address of 10

c.
reference to 10

d.
value of 10

Respuesta :

Answer:

Answer is (d) value of 10

Explanation:

Usually when we write "int x=10;", a memory space is allocated for an integer variable with name x, and content 10.

Answer:

Option d is the correct answer for the above question.

Explanation:

In c,c++ or java programming language, when a user declares a variable then that means that a variable is used to take space in memory and When a user assigns the value on that variable then that value is stored on the location of variable in the memory and that variable addressed that value for compiler and memory.

The above question asked that if there are declaration and initialization of a variable then what is held by the variable in the memory. The answer is the value which stated by Option d, hence it is a correct option while other is not because--

  • Option 'a' states that the address holds the location of value but it holds the value.
  • Option b states that the address holds the memory location of value but it holds the value only.
  • Option c states that the address holds the reference value of a value but it holds the value only.