C#

  1. What is a procedural language? Give an example.
    A language in which each procedure or method is performed in a very specific order.  The order of events is determined by the programmer. (C++)
  2. What is a console application?
    Applications that primarily use a keyboard and monitor without a graphical interface.
  3. What is an event driven language? Give an example.
    A language written for the Windows environment.  The order of events is determined by the operator (Visual Basic).
  4. What is a method?
    A group of instructions designed to accomplish a specific task.
  5. What are all Visual C# Console Applications composed of?
    A Class and Main Method.
  6. What is a class?
    Classes are containers for holding data and coding.
  7. What method contains the instructions that will direct our entire program?
    Main Method
  8. What does the term debug mean?
    Process of removing program errors.
  9. What is a variable?
    Storage locations in memory that can be changed.
  10. What is a constant?
    Storage locations in memory that cannot be changed.
  11. What is the term used to describe English-like statements that describe the logical steps necessary to solve a problem?
    Pseudocode
  12. What does the abbreviation IPO represent?
    Input, Process, Output
  13. Entering data from the keyboard is placed under which column on the IPO Worksheet?
    Input column
  14. What is a prompt?
    Message displayed to the operator.
  15. Prompting for data from the keyboard is placed under which column on the IPO Worksheet?
    Output column
  16. What programming structure specifies the order of tasks?
    Sequence structure
  17. How do you indicate a comment in a Visual C# program?
    //
  18. What is the term used to describe the general format of a statement and the information required?
    Syntax
  19. What are keywords?
    Words in  C# that have special meaning.
  20. What class includes the Keyboard and Monitor?
    Console
  21. How do you write the statement to use the system namespace?
    using System;
  22. How do you write the statement to define a class named Hello?
    class Hello
  23. What is a static method?
    A method that is not used with an object.
  24. How do you write the statement to declare a static method named Main with no parameters that does not return a single value?
    static void Main()
  25. What characters are used to begin and end a block of statements?
    • {  left brace
    • }  right brace
  26. How do you define a variable that is used to store your age as a whole number?
    int ageInteger;
  27. What data type is used to store a group of characters?
    string
  28. What characters are allowed in a C# name?
    A-Z, a-z, 0-9 Underscore(_)
  29. When using the naming convention rules for names, what should the last word of the variable name specify?
    data type
  30. How do you display the word "Hello" on the standard output device and move to the next line?
    Console.WriteLine("Hello");
  31. How do you display the prompt "Enter First Name:" on the standard output device and remain on the same line?
    Console.Write("Enter First Name:");
  32. How do you write the statement to store the value, input from the keyboard, to the variable ageString?
    ageString=Console.Readline();
  33. What is concatenation?
    Process of attaching one string to another.
  34. How would you write the variable lastNameString, followed by a comma and space, followed by the variable firstNameString to the monitor?
    Console.WriteLine(lastNameString +","+firstNameString);
  35. What is a syntax error?
    Invalid C# statement.
  36. What is a logic error?
    When program does not execute correctly.
  37. Calculations are placed under which column on the IPO Worksheet?
    Process column
  38. How would you write the statement to define a variable to store your Weight as a decimal number?
    decimal weightDecimal;
  39. How would you write the statement to define a variable to store your Middle Initial as a character?
    char middleInitialChar;
  40. What character ends a C# statement?
    ;   (semicolon)
  41. What method is used to convert a string to a numeric value?
    Parse
  42. How do you write the statement to convert your weight entered from the keyboard to the variable weightDecimal?
    weightDecimal=decimal.Parse(Console.ReadLine());
  43. What is the output of:
    32/4 + 2 + 3 * 4 - 8%4
    22
  44. What is type casting?
    Temporary conversion of a value from one data type to another.
  45. How do you code the statement to calculate the average age (ageDecimal) of 3 students with ages of 21, 23, and 28 to decimal accuracy?
    ageDecimal=(21+23+28)/3M;

    or 

    ageDecimal=(21+23+28)/(decimal)3;
  46. How do you code the statement to calculate a golfer's Average (avgDecimal) in decimals by dividing the golfer's Total (totalInteger) by 4?
    avgDecimal=(decimal)totalInteger/4; 

    or

    avgDecimal=totalInteger/4M;
  47. What method is used to format a string for display purposes?
    To String
  48. How do you display the golfer's average score (avgDecimal) to 1 decimal to the standard output device?
    Console.WriteLine(avgDecimal.ToString("N1"));
  49. What is a standard method?
    Method that returns zero or more values when completed.
  50. What method returns a single value through the name of the method?
    Value returning method
  51. What is an argument list?
    Used to send data (input) and receive values (output) when calling methods.
  52. How do you call a standard method?
    By specifying its name and argument list as a single statement.
  53. How do you call a value returning method?
    By specifying its name and argument list on a statement where the returned value will be used.
  54. What is an input argument?
    Data sent (input) to the called method.
  55. What is an output argument?
    Value received (output) from the called method when completed.
  56. What is a parameter list?
    Defines what data is needed and what values are returned by the method when completed.
  57. What are Input Parameters?
    Define what data is needed by the method to perform its tasks when called.
  58. What are Output Parameters?
    Define what values are returned to the calling method when completed.
  59. What general information is specified on the standard method header?
    Name of the method and the parameter list.
  60. What general information is specified on the value returning method header?
    The name of the method, parameter list. and return data type.
  61. What type of parameter is generally not specified on a value returning method header?
    Output parameters
  62. How is the value returned from a value returning method?
    Returns a single value through the name of the method.
  63. What is appended or on the end to the Begin pseudocode task indicating that this method is a value returning method?
    Return Type
  64. What is the last pseudocode task before the end statement in a value returning method?
    Return Value
  65. How do you code the method heading named InputExamScores that returns 3 integer scores for exam1Integer, exam2Integer, and exam3Integer?
    static void InputExamScores(out int exam1Integer, out int exam2Integer, out int exam3Integer)
  66. How do you code the statement to input the variable weightInteger from the keyboard using the TryParse method?
    int.TryParse(Console.ReadLine(),out weightInteger);
  67. How do you code the value returning method header named Average with an integer input parameter named totalInteger that returns a decimal value?
    static decimal Average(int totalInteger)
  68. How do you return the decimal variable averageDecimal from a value returning method?
    return averageDecimal
  69. How do you call the method named InputExamScores that returns 3 integer scores for exam1Integer, exam2Integer, and exam3Integer?
    InputExamScores(out exam1Integer, out exam2Integer, out exam3Integer);
  70. How do you call the value returning method Average with an integer input argument named totalInteger that returns a decimal value assigned to avgDecimal?
    avgDecimal=Average(totalInteger);
  71. What is a constant?
    A value that does not change during the execution of the program.
  72. What type of constant can be referenced by any method in the class?
    Class Constant
  73. What type of constant can only be referenced in the method where it was defined?
    Local Constant
  74. What single pseudocode word begins all loop structures?
    Do
  75. What type of loop structure is used to repeat a group of statements zero or more times?
    Pre-Test Loop Structure
  76. What type of loop structure is used to repeat a group of statements one or more times?
    Post-Test Loop Structure
  77. What are the six pseudocode relational operators?
    =, Not=, >, <, >=, <=
  78. What are the three pseudocode logical operators?
    AND, OR, NOT
  79. What pseudocode logical operator requires only one condition be evaluated as true?
    OR
  80. What pseudocode logical operator requires all conditions be evaluated as true?
    AND
  81. How do you code a constant Maximum with a value of 300, and a constant GPA with a value of 3.5?
    • const int MAXIMUM_Integer=300;
    • const decimal GPA_Decimal=3.5M;
  82. Can a C# statement be continued on several lines? How?
    Yes, by placing a secmicolon (;) at the end of the last line.
  83. What are the six Visual C# relational operators?
    • ==  (Equal)
    • !=   (Not Equal)
    • >    (Greater than)
    • <    (Less than)
    • >=  (Greater than or equal)
    • <=  (Less than or equal)
  84. What are the three Visual C# logical operators?
    • &&   AND
    • ||     OR
    • !      NOT
  85. How do you code the while condition to loop while the variable numberInteger is less than 50 or greater than 100?
    while (numberInteger<=50 || numberInteger>=100)
  86. What is an infinite loop?
    Loop that doesn't stop
  87. How do you stop an infinite loop?
    CTRL + BREAK
  88. What method is used to convert a string to uppercase?
    ToUpper
  89. How do you code the statement to capitalize a string variable named initialString input from the keyboard?
    initialString=Console.ReadLine().ToUpper();
  90. How do you code the while condition to loop while the variable codeString is not equal to "A" and not equal to "R"?
    while(codestring!="A" && codeString!="R")
  91. What Visual C# statement begins all Post-Test Loop Structures?
    do statement
  92. How do you code the last statement in a Post-Test loop structure to loop while codeString is Not="M" AND Not="F"?
    }while(codeString!="M" && codeString!="F");
  93. What word begins all pseudocode selection structures?
    IF
  94. What word ends all pseudocode selection structures?
    END IF
  95. What word is used to identify the "false" actions when you have two selections?
    Else
  96. What words are used in selection structures to test other conditions if you have three or more selections?
    Else IF . . . Else
  97. How do you write the pseudocode structure to Display "Go to the Beach" when the temperature is greater than 80 or Display "Go Shopping" when the temperature is less than or equal to 80?
    • IF Temperature>80
    •     Display "Go to the Beach"
    • Else
    •     Display "Go Shopping"
    • END IF
  98. How do you write the pseudocode structure to Display "Above Par", "Par", or "Below Par" when a Golf Score is greater than 70, equal to 70, or less than 70?
    • IF Score>70
    •     Display "Above Par"
    • Else IF Score=70
    •     Display "Par"
    • Else
    •     Display "Below Par"
    • END IF
  99. How do you write the pseudocode structure to Display "Freshman" when Code=1, "Sophomore" when Code=2, "Junior" when Code=3, or "Senior" when Code=4?
    • IF Code =1
    •     Display "Freshman"
    • Else IF Code=2
    •     Display "Sophomore"
    • Else IF Code=3
    •     Display "Junior"
    • Else
    •     Display "Senior"
    • END IF
  100. How do you write the pseudocode structure to display "Lower Division" when the Code is "1" or "2"; otherwise display "Upper Division"?
    • IF Code="1" or "2"
    •     Display "Lower Division"
    • Else
    •     Display "Upper Division"
    • END IF
  101. How do you code the structure to display "Go to the Beach" when the temperature is greater than 80 or Display "Go Shopping" when the temperature is less than or equal to 80? Assume temperature is an integer)
    • if (temperatureInteger>80)Console.WriteLine("Go to the Beach");
    • else
    •     Console.WriteLine("Go Shopping");
  102. How do you code the structure to display "Above Par", "Par", or "Below Par" when an integer Golf Score is greater than 70, equal to 70, or less than 70?
    • if(scoreInteger>70)
    •     Console.WriteLine("Above Par");
    • Else if(scoreInteger==70)
    •     Console.WriteLine("Par");
    • Else
    •     Console.WriteLine("Below Par")
  103. How do you code the statement to assign the variable codeString the letter X?
    codeString="X";
Author
MMadden
ID
240706
Card Set
C#
Description
Exam Review Questions
Updated