Topical Information

Here are a few questions to help you clarify your understanding of good style in both coding and user interface design.

Question Set Information

Questions

  1. What is our only rule regarding indention?

    
            Indent one level between matched curly braces:
    
                |{
                | -->|~~~~~~~~
                |    |~~~~~~~~
                |    |~~~~~~~~
                |}
    
    
  2. Where are comments normally placed in relation to the code they describe?

    1. before the codeYES
    2. inside the codeNO
    3. after the codeNO
    4. to the left of the codeNO
    5. to the right of the codeYES
  3. C++ identifiers can contain ____.

    1. lettersYES
    2. hyphensNO
    3. underscoresYES
    4. digitsYES
    5. at-signsNO
  4. C++ identifiers must start with ____.

    1. lettersYES
    2. hyphensNO
    3. underscoresYES
    4. digitsNO
    5. at-signsNO
  5. It is frowned upon, however, for programmer's identifiers to start with ____.

    1. lettersNO
    2. hyphensNO
    3. underscoresYES
    4. digitsNO
    5. at-signsNO
  6. C++ identifiers can be up to an infinite number of characters long (a limit you'll not likely reach any day soon). (Although some compilers may limit the identifier's significant characters to a smaller number — like 32.)
  7.  
    TRUE FALSE  We like placing spacing around operators to lessen the cramped-ness of our code.
  8. We can place comments into our programs by using a    //    symbol before the comment. Such comments will continue until the end of the line. When we have a lot to say, however, we can use a block comment. These comments start with the    /*    symbol and continue until the compiler finds a    */    symbol.
  9. Normally comments (which precede their code) are themselves preceded by a blank line. Such spacing helps to visually separate the logical sections of a program for the programmer.
  10.  
    TRUE FALSE  Blank lines are used also in the output of a program to logically separate sections of the interface (input, output, etc.).
    TRUE FALSE  This makes it easier for the user to detect a change in the program's status.