Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

13. How much memory is reserved for the following variables in MS Visual C++? do

ID: 3826509 • Letter: 1

Question

13. How much memory is reserved for the following variables

         in MS Visual C++?

             double x;

             int k, *k_ptr;

             double *x_ptr;

      A. 10

      B. 16

      C. 20

      D. 24

14. What is the purpose of the sizeof operator in C++?

      A. There is no sizeof operator in C++.

      B. To return the total number of bytes of the program.

      C. To report if the system has enough memory for the data variables.

      D. To report the number of bytes of storage reserved for a given variable or datatype.

15. What is the purpose of the rangeof operator in C++?

      A. There is no rangeof operator in C++.

      B. To report the range of values for a given datatype.

      C.To tell the program if a value is out of range.

      D. There is no rangeof operator in C++, but there is a RangeOf function in <cmath>.

17. What is the purpose of the reverse operator in C++?

      A. There is no reverse operator in C++.

      B. To return the hexadecimal address of a variable.

      C. To report the system backup rate.

      D. To allow the variables to be switched during program execution.

18. When the address of a data variable is passed to a function,

      what type of call is used?

      A. Call by reference

      B. Call by value

      C. Call by indirection

      D. Both A and C

21. Which is the best example of a naming convention for a pointer?

      A. pVar

      B. pointer_to_var

      C. *pVar

      D. Conventions are a waste of time.

24. Given the code:

         int number, *ptr_num = &number;

        what is wrong with the assignment: ptr_num = 3 ?

      A. You can’t assign an int to a pointer.

      B. ptr_num is not defined.

      C. The number variable must be assigned an address.

      D. Nothing is wrong.

Explanation / Answer

13. How much memory is reserved for the following variables
in MS Visual C++?
double x;
int k, *k_ptr;
double *x_ptr;
A. 10
B. 16
C. 20
D. 24
  
Answer:D.24 ,as int variables occupy 4 bytes and double variables occupy 8 bytes.

14. What is the purpose of the sizeof operator in C++?
A. There is no sizeof operator in C++.
B. To return the total number of bytes of the program.
C. To report if the system has enough memory for the data variables.
D. To report the number of bytes of storage reserved for a given variable or datatype.

Answer: B. To return the total number of bytes of the program.

15. What is the purpose of the rangeof operator in C++?
A. There is no rangeof operator in C++.
B. To report the range of values for a given datatype.
C.To tell the program if a value is out of range.
D. There is no rangeof operator in C++, but there is a RangeOf function in <cmath>.

Answer:A. There is no rangeof operator in C++.

17. What is the purpose of the reverse operator in C++?
A. There is no reverse operator in C++.
B. To return the hexadecimal address of a variable.
C. To report the system backup rate.
D. To allow the variables to be switched during program execution.

Answer:A. There is no reverse operator in C++.

18. When the address of a data variable is passed to a function,
what type of call is used?
A. Call by reference
B. Call by value
C. Call by indirection
D. Both A and C

Answer: A. Call by reference

21. Which is the best example of a naming convention for a pointer?
A. pVar
B. pointer_to_var
C. *pVar
D. Conventions are a waste of time.

Answer: C. *pVar

24. Given the code:
int number, *ptr_num = &number;
what is wrong with the assignment: ptr_num = 3 ?
A. You can’t assign an int to a pointer.
B. ptr_num is not defined.
C. The number variable must be assigned an address.
D. Nothing is wrong.

Answer: A. You can’t assign an int to a pointer.

Note:Please do ask in case of any doubt,thanks!!   
      

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote