Given the following pseudocode, what is the value of myGrade
after the call to the curveScore module?
Module main()
Declare Integer myGrade
Set myGrade = 82
Call curveScore(myGrade)
End Module
Module curveScore(Integer score)
Declare Integer newScore
Set newScore = score + 5
Display newScore
End Module
Group of answer choices :
A. 87
B. can not tell
C. 82
D. 5
Given the following pseudocode, what is the value of myGrade after the call to the curveScore...
What will the following pseudocode program display? Module main( ) Declare Integer x = 1 Declare Real y = 3.4 Display x, " ", y Call changeUs(x, y) Display x, " ", y End Module Module changeUs(Integer a, Real b) { Set a = 0 Set b = 0 Display a, " ", b }
Given the following pseudocode: Class Coordinate Private Real _x Private Real y Public Module set_x(Real value) Set _X = value End Module Public Module set_y(Real value) Set y = value End Module Public Function get_x() Return _X End Module Public Function get_y() Return y End Module Public Module add(Coordinate c) Set _X = _X + C.get_x) Set y = y + c.get_y() End Module End Class Module main() Declare Coordinate ci - New Coordinate() Declare Coordinate c2 - New Coordinate()...
1. What are the problems with the following pseudocode? Be careful here, this one is tricky! Module main() Number siblingAge = 12 Display “your “+siblingType+ “ has” yearsUntilAdult(siblingAge) Display “years until they are an adult” End Module Module yearsUntilAdult(Number inAge) Character siblingType = “sister” If inAge < 18 Then Display inAge - 18 Else Display 0 End If End Module A. yearsUntilAdult module call can not see variable siblingAge so siblingAge can not be used as input into the module...
In the pseudocode below: Function Integer perfect(Integer n) Declare Integer count = 0 Declare Integer sum = 0 While count < n Set count = count + 1 Set sum = sum + count End While Return sum End Function Function Integer perfect_sum(Integer n) Declare Integer count = 0 Declare Integer sum = 0 While count < n Set count = count + 1 Set sum = sum + perfect(count) End While Return sum End Function Module main() Display perfect_sum(5)...
Look at this partial class definition, and then answer questions a - b below: Class Book Private String title Private String author Private String publisher Private Integer copiesSold End Class Write a constructor for this class. The constructor should accept an argument for each of the fields. Write accessor and mutator methods for each field. Look at the following pseudocode class definitions: Class Plant Public Module message() Display "I'm a plant." End Module...
Write the pseudocode below as a working Python program. Take a screenshot of your code and output and paste into your answer document. User input of ‘y’ or ‘Y’ should cause the loop to continue. // Constant for the commission rate // Declare as a global variable Constant Real COMMISSION_RATE = 0.10 Module main() // Local variable Declare String keepGoing = "y" // Calculate as many commissions // as needed. While...
5. Select the problems with the following pseudocode. Be very careful again here and make sure you understand local variables and scope. You can start by tracing from the Main method. Module Main() Display “welcome to the csc-115 pizza shop!” Menu() Display “you ordered a “+ pizzaChoice+ “ pizza” End Module Module Menu() String pizzaChoice Display “please enter what kind of pizza you want: “ Input pizzaChoice Display “Are you sure? Please enter your pizza choice again” String pizzaChoice Input...
What is wrong with the following pseudocode? Declare Count As Integer Declare TheNumber As Integer Set TheNumber = 12 For (Count = 10; Count>TheNumber; Count--) Write TheNumber + Count End For A) The limit condition in a For loop cannot be a variable B) The loop will never be entered since the initial value of Count is less than the test condition C) The loop will never end since the test condition will never be met D) A counter must...
MULTIPLE ANSWERS: Consider the following pseudocode snippet: Declare String springClasses[5] = “csc115”, “mat295”, “phy200”, “eng200”, “the120” Declare Integer index = 0 Display “displaying all classes” For index = 0 To 5 Display springClasses[index] End For Where is the syntax error in the following pseudocode? (If you are not sure here is a hint: go back and read up on For loops carefully. When do they stop looping?) Infinite loop We initialize the array with the wrong datatype Array out of...
Please select the output: main declare X as integer, Y as integer set x=1 set y=2 call sub(x, y) write x write y End program Subprogram sub( integer Num1 as ref, Integer Mum2 as reference) declare x as integer set Num1 = 3 set Num2 = 4 set x= 5 write x end subprogram Please select one: 5/42, 5/34, 5/32, 5/24 What is the output of this...