Recent Feedback
1)Suppose w, x, y and z are integer variables and initialized as follows:w = 2; x = 3; y = 4; z = 5;In a block of C/C++/Java code, the following statements are executed. What is the value of w after these statements are executed? { x = z + y; y = 2 * x - y; w= x + w / 2 - z }2)With x = 5 and y = 8 and z = 5, what is the value of the variable z after the execution of thefollowing pseudo-code: If ((x = 10)) Then z = z + 1 Else z = z – 1 End If3)Let X = 3 and Y = 6. Indicate by entering T or F whether the expression is TRUE or FALSE NOT(X > 3) AND NOT(Y < X)4)Write pseudocode to print the numbers 3, 6, 9, 12, 15, 18 and 21 using a for-loop5) ) Using pseudocode declare a Real number named temperature6)Using pseudocode declare a variable to store the Julian day (1-366) named JDay.This is only 6 questions out of 100 on my review sheet for my mid term! Please help as I am soo stuck on these! Thanks
Optional Information: Level/Year: SeniorSubject: Computer Programming Already Tried: Everything! Professor is not available until the weekend to get the answer key.
1) Suppose w, x, y and z are integer variables and initialized as follows: w = 2; x = 3; y = 4; z = 5; In a block of C/C++/Java code, the following statements are executed. What is the value of w after these statements are executed? { x = z + y; y = 2 * x - y; w= x + w / 2 - z } Satement 1: x = z + yx = 5 + 4 = 9Statement 2: y = 2 * x - yRemember that x was set to 9 in Statement 1y = 2 * 9 - 4 = 14Statement 3: After w = x + w/2 - z is executedw = 9 + 2/2 - 5 = 5w = 5 is the final answer2)With x = 5 and y = 8 and z = 5, what is the value of the variable z after the execution of the following pseudo-code: If ((x <= 20) && (y >= 10)) Then z = z + 1 Else z = z – 1 End If The first statement checks if x is less than or equal to 20 AND if y is greater than or equal to 10. The first condition evaluates to true, but the second condition evaluates to false since y is less than 10. Therefore, the entire if statement evaluates to false, and the statement after the Else is executed.z = z - 1 = 5 - 1 = 4z = 4 is the final answer3)Let X = 3 and Y = 6. Indicate by entering T or F whether the expression is TRUE or FALSE NOT(X > 3) AND NOT(Y < X) Let's break it down into parts:(X > 3) = FALSENOT (X > 3) = TRUE(Y < X) = (6 < 3) = FALSENOT(Y < X) = TRUEPutting the two togetherNOT(X > 3) AND NOT(Y < X) = TRUE AND TRUE = TRUETRUE is the final answer4) Write pseudocode to print the numbers 3, 6, 9, 12, 15, 18 and 21 using a for-loop This problem can be approached from several different angles:The first possibility is that we loop from 3 to 21 and add 3 to the loop counter each time we printFor LoopCounter = 3; LoopCounter <= 21; LoopCounter = LoopCounter + 3 Print LoopCounterNext---OR we can loop from 1 to 21, and only print out the numbers that are evenly divisible by 3---For LoopCounter = 1 to 21 If (LoopCounter MOD 3) = 0 Then Print LoopCounter End IfNext LoopCounter5) Using pseudocode declare a Real number named temperature Final Answer: Declare temperature as Realor this could be: Declare temperature as Floatit just depends on which way you learned in class. Real is pseudocode, Float is what most real programming languages use.6) Using pseudocode declare a variable to store the Julian day (1-366) named JDay. Declare JDay as Integer
Experience: 7 yrs. of professional programming experience. BS and MS in Computer Science.