Game Preview

C++ coding

  •  English    21     Public
    basics of C++ - revision for a test
  •   Study   Slideshow
  • What's wrong with this code?
    Missing a semicolon after endl
  •  15
  • What's wrong with this code?
    Missing a semicolon after endl
  •  15
  • What will this code output?
    The result of a / 2 is: 7
  •  15
  • What will this code output?
  •  15
  • Name two basic variable types in C++.
    string, int, float
  •  10
  • Which variable type would you use to store the following: a person's name
    string
  •  10
  • Which variable type would you use to store the following: a person's age
    int
  •  10
  • Which variable type would you use to store the following: a person's height in meters
    float
  •  10
  • True or false: A float variable can store whole numbers.
    True (though it is usually used for decimal values).
  •  10
  • Fill in the blank: In C++, the ________ keyword is used to declare a variable that stores text.
    string
  •  10
  • Fill in the blanks to make this code work:
    <iostream>, std, main
  •  10
  • If you want to store the number 3.14, which data type would you use?
    float
  •  10
  • True or False: You must declare a variable before you use it in C++.
    True.
  •  10
  • Complete the sentence: The main() function is the ________ point of a C++ program.
    starting
  •  10
  • What will happen if you forget the return 0; statement in main()?
    In most modern compilers, the program will still run, as it assumes return 0;, but it’s good practice to include it.
  •  20
  • Complete the sentence: The ______ keyword moves the output to the next line
    endl
  •  10