C# Programming


  1. public static void Main( )


    This is a... ?
    Method header
  2. public static void Main ( )

    What word above is the method's name?
    " Main "
  3. Console.WriteLine("Programming is great fun!");

    The group of characters inside of the quotation marks is called a... ?
    " string literal "
  4. Do class headers / method headers end with a semicolon " ; " ?
    No, class headers and method headers do not end with a semicolon because they are terminated with a body of code inside braces.
  5. What do these forward slashes " // " mean?
    Marks the beginning of a comment.

    • ex.)
    • Console.WriteLine("Hello Martha!"); //This line will display saying "Hello Martha!"
  6. What do these opening and closing parentheses " ( ) " mean?
    Used in a method header.

    • ex.)
    • public static void Main ( )
  7. What do these opening and closing braces " { } " mean?
    Enclose a group of statements, such as the contents of a class or a method.

    • ex.)
    • public static void Main ( )
    • {
    • Console.WriteLine("Hello Martha!");
    • }
  8. What do these quotation marks " " " " mean?
    Enclose a string of characters, such as a message that is printed on the screen.

    • ex.)
    • Console.WriteLine("Today is my birthday!");
  9. What does this semicolon " ; " do?
    Marks the end of a complete programming statement.
  10. What is the difference between "Write" and "WriteLine" ?
    The Write method does not advance the cursor to the next line after the message is displayed, the WriteLine method does.

    • ex.)
    • public static void Main ( )
    • {
    • Console.Write("These are our top sellers: \n");
    • Console.Write("Computer games \n");
    • Console.WriteLine("Coffee \n");
    • Console.Write("Aspirin \n");
    • }

    • Program Output:
    • These are our top sellers:
    • Computer games
    • Coffee

    **Notice it does not display Aspirin. This is because you used a WriteLine before it, which made it so it didn't advance to the next line in code.
  11. What does an escape sequence do and how do you display one?
    • An escape sequence allows you to control the way output is displayed by embedding comands within the string itself.
    • To use an escape sequence you start with a backslash character " \ " and then followed by one or more control characters.

    • ex.)
    • \n
  12. " \n "
    What does this escape character allow you to do?
    Newline - advances the cursor to the next line for subsequent printing.
Author
ASLeathe
ID
16401
Card Set
C# Programming
Description
Programming - C#
Updated