Mark the following as true or false If false provide a 12 se

Mark the following as true or false. If false provide a 1-2 sentence explanation. In C++, pointer is a reserved word. In C++, pointer variables are declared using the word \"pointer\". The statement delete p; deallocates the pointer p. The statement delete p; deallocates the dynamic memory that is pointed to by p. Given the declaration: int list[10]; int *p; The statement: p = list; is valid in C++ Given the declaration: int *p; The statement: p = new int[50]; dynamically allocates an array of 50 components of type int and p contains he base address of the array. The address of operator (&) returns the address and the value of its operand. If p is a pointer variable, then the statement p = p * 2; is valid in C++;

Solution

(a)   Statement is False
  
   In C++, there is no keyword by name pointer. Keywords are used by language and they are not available for reuse.
  
-----------------------------------------------------------------------------------------------------------------------------

(b)   Statement is False
  
   In C++, pointer variables are declared using Asterisk operator(*).
  
   For eg: int *p; // Declares variable p of type integer pointer
  
------------------------------------------------------------------------------------------------------------------------------

(c) Statement is False

   Statement delete P; doesn\'t deallocates the pointer p, instead it deallocates the dynamic memory that is pointed to by p.

-------------------------------------------------------------------------------------------------------------------------------

(d) Statement is True
  
   Statement delete P; deallocates the dynamic memory that is pointed to by p.
  
------------------------------------------------------------------------------------------------------------------------------

(e)   Given statement is Valid in c++.

   list is a array of integer data type of size 10.
   p is a pointer variable.
  
   Statement p = list; makes the pointer variable p to point the starting address of array pointed by variable list.
  
-------------------------------------------------------------------------------------------------------------------------------

(f)   Given declaration is True.

   p is a pointer variable of integer data type.
  
   Statement p = new int[50]; dynamically allocates an array of 50 components of type int and p points to base address of array.
  
-------------------------------------------------------------------------------------------------------------------------------

(g)   Statement is False.

   Address of operator (&) only returns the address of the operand but not the value.
  
--------------------------------------------------------------------------------------------------------------------------------

(h)   Statement is False.

   Pointer is an address (Numeric value). Not all arithmetic operations are possible on pointers, only four arithmetic operators can be used on pointers: ++, --, +, and -
  
   So the statements like p = p + 2 or p = p - 2 are valid but p = p * 2 is not valid.

 Mark the following as true or false. If false provide a 1-2 sentence explanation. In C++, pointer is a reserved word. In C++, pointer variables are declared us
 Mark the following as true or false. If false provide a 1-2 sentence explanation. In C++, pointer is a reserved word. In C++, pointer variables are declared us

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site