Skip to main content

Section 2.6 Summary & Reading Questions

  1. All variables must be declared before use in C++.
  2. C++ has typical built-in numeric types: int is for integers and float and double are used for floating point depending on the number of digits desired.
  3. C++ has the Boolean type bool that holds true or false.
  4. The character data type char holds a single character which is encased in single quotes.
  5. Pointers are a type of variable that stores a memory address. To declare a pointer, an * is used before the variable name that is supposed to store the location.

Reading Questions Reading Questions

1.

If I want to use the char type in C++, what set of symbols must be used?
  • ’ ’
  • Good job!
  • " "
  • No, double quotes are only used for string.
  • ’ ’ or " " may be used
  • No. Only one set of symbols may be used.
  • It depends upon the implementation.
  • No. The implementation is consistent.
  • none of the above
  • One of the above is indeed correct.

2.

A/an is used to store a memory address in C++?

3.

How may one reference a variable’s memory address in C++?
  • using ``&``
  • Right! ``&`` is the "address-of" operator, used to reference an address.
  • using ``*``
  • No. ``int *p;`` defines a pointer to an integer, and ``*p`` would dereference that pointer, i.e. retrieve the data that p points to.
  • using ``id``
  • No. This is used in Python.
  • It depends upon the implementation.
  • No. Try again.
  • none of the above
  • One of the above is indeed correct.

4.

You have attempted 1 of 4 activities on this page.