CIS 115 FINAL EXAM DeVry University

01 August, 2024 | 6 Min Read

CIS115 Final Exam 2 questions:

  1. What is the first step in software development?
    • Answer: Requirements gathering and analysis.
  2. What are named locations in a computer’s memory holding information required by a program?
    • Answer: Variables.
  3. What symbol in a flowchart would be used by a developer to represent the beginning or ending point?
    • Answer: Oval (also known as a terminator).
  4. Set name = ā€œBSCISā€ is a process. What data type would you expect the variable, name, to have?
    • Answer: String.
  5. You are using dollar amounts in an algorithm. What data type would you assign?
    • Answer: Float or Decimal.
  6. What tool is used by developers to design logic using specific shapes/symbols?
    • Answer: Flowchart.
  7. When a program evaluates mathematical expressions, which of the following operators (or mathematical operations) takes precedence?
    • Answer: Exponentiation (^).
  8. Which one of the following is a valid assignment statement in a program?
    • Answer: This depends on the options provided, but generally, an example would be x = 5.
  9. Evaluate (2 * 3) ^ 3.
    • Answer: 216. (First, 2 * 3 = 6, then 6 ^ 3 = 216).
  10. Review the partial pseudocode below. What is the correct math expression to complete the algorithm and total sales for both regions?
    • Answer: Set total = region1 + region2.
  11. What will be displayed when this algorithm executes?
    • Answer: “the IF path executes” (assuming x is within the range of 10 to 19).
  12. What value gets displayed for the variable X?
    • Answer: This depends on the specific values of A, B, and C. If B > 15 and one of the conditions for A or C is met, X would be set according to the appropriate branch.
  13. In the following pseudocode, what raise will an employee in Department 6 receive?
    • Answer: The employee will receive a raise of 7% (assuming that Department 6 is less than 6 but not less than 2).
  14. Which of the selection structures determine whether the user enters a number outside a range of 5 and 15?
    • Answer: An IF statement checking if the input is < 5 or > 15.
  15. What value gets displayed for the variable Z?
    • Answer: The value depends on the specific conditions given for balance, stateCode, and creditCode. If any of the conditions are true, Z will be set to one value; otherwise, it will be set to another.
  16. The statements executed within a loop are known collectively as the _____.
    • Answer: Loop body.
  17. Which of the following statements is false?
    • Answer: This depends on the provided statements, but an example might be a statement that misrepresents how a specific loop or control structure operates.
  18. A DO loop is considered what type of loop?
    • Answer: Post-test loop (the loop body is executed at least once).
  19. What happens when the loop control variable is not changed?
    • Answer: The loop becomes an infinite loop.
  20. How many times will the following loop be executed?
    • Answer: The loop will execute as long as num <= 5. If num starts at 1, it will run 5 times.
  21. What is another name for an array’s index?
    • Answer: Subscript.
  22. Suppose you have an array named number, and two of its elements are number(1) and number(4). You know that _____.
    • Answer: These refer to the second and fifth elements of the array, assuming zero-based indexing.
  23. Which one of the following correctly declares a zero-based array of four integers?
    • Answer: Example: int[] myArray = new int[4];.
  24. When processing the elements of an array, what control structure is used to move through each element within the array?
    • Answer: A loop, typically a for loop.
  25. What value will be stored in the array element sales(1)?
    • Answer: 1100, since arrays are zero-based and sales(1) would refer to the second element.
  26. A file contains _____.
    • Answer: Data that can be read, written, or manipulated by a program.
  27. What is automatically placed at the bottom of a file when the file is closed?
    • Answer: EOF (End of File) marker.
  28. Menu-driven programs need to give the user the option to _____.
    • Answer: Exit the program.
  29. What type of error occurs when a program will not execute because the rules of the language have been violated?
    • Answer: Syntax error.
  30. The first module is usually considered to be called the _____ module.
    • Answer: Main module.

Pseudocode and Logical Reasoning Questions:

  1. Pseudocode for determining the discount:
    • Pseudocode:mathematicaCopy codeBegin Prompt “Enter the total dollars purchased:” Input total If total > 100 Then Set discount = 0.10 Else Set discount = 0.05 EndIf Set totalDue = total - (total * discount) Display “Total amount due: " + totalDueEnd
  2. Pseudocode for calculating the average of three purchases:
    • Pseudocode:mathematicaCopy codeBegin Prompt “Enter first purchase amount:” Input purchase1 Prompt “Enter second purchase amount:” Input purchase2 Prompt “Enter third purchase amount:” Input purchase3 Set average = (purchase1 + purchase2 + purchase3) / 3 Display “The average amount spent is: " + averageEnd
  3. Correction for logic error in loop:
    • Pseudocode:javaCopy codeSet total = 0REPEAT Set total = total + 1UNTIL total = 4Display total
    • Explanation: The loop should increment total on each iteration and stop after four iterations.
  4. Pseudocode for determining the correct sales tax:
    • Pseudocode:mathematicaCopy codeBegin Declare Real salesTax Declare Integer countyCode Prompt “Enter the county code:” Input countyCode If countyCode <= 10 Then Set salesTax = 0.06 Else If countyCode <= 25 Then Set salesTax = 0.07 Else Set salesTax = 0.08 EndIf Display “The sales tax is: " + salesTaxEnd
  5. Pseudocode for 60-second countdown:
    • Pseudocode:mathematicaCopy codeBegin Declare Integer count Set count = 60 REPEAT Display “Countdown: " + count Set count = count - 1 UNTIL count = 0 Display “LIFT OFF!“End
  6. Pseudocode for mixing primary colors:
    • Pseudocode:mathematicaCopy codeBegin Declare String color1, color2, control1, control2 Prompt “Enter first primary color:” Input color1 Set control1 = “n” DOWHILE control1 = “n” If (color1 <> “yellow”) AND (color1 <> “red”) AND (color1 <> “blue”) Then Prompt “First primary color is invalid” Input color1 Else Set control1 = “y” EndIf ENDO
      Prompt “Enter second primary color:” Input color2 Set control2 = “n” DOWHILE control2 = “n” If (color2 <> “yellow”) AND (color2 <> “red”) AND (color2 <> “blue”) Then Prompt “Second primary color is invalid” Input color2 Else Set control2 = “y” EndIf ENDO
      If (color1 = “red”) AND (color2 = “blue”) OR (color1 = “blue”) AND (color2 = “red”) Then Display “Secondary color is: purple” ElseIf (color1 = “yellow”) AND (color2 = “blue”) OR (color1 = “blue”) AND (color2 = “yellow”) Then Display “Secondary color is: green” ElseIf (color1 = “red”) AND (color2 = “yellow”) OR (color1 = “yellow”) AND (color2 = “red”) Then Display “Secondary color is: orange” EndIfEnd
  7. Difference between a flowchart and pseudocode:
    • Answer: A flowchart is a visual representation of the flow of a program using shapes and arrows, while pseudocode is a textual representation of the logic in a program written in plain language. Neither is more important than the other; the choice depends on the developer’s preference and the complexity of the logic.
  8. Description of two control structures and use of operators:
    • Answer:
      • Sequential Control Structure: Executes statements in order, one after the other.
      • Selection Control Structure: Executes a block of code based on a condition using relational (==, <, >) and logical operators (AND, OR).

Related posts