Ask your own question, for FREE!
Mathematics 9 Online
jagr2713 (jagr2713):

If the following pseudocode were an actual program, what would it display? Declare Integer a = 5 Declare Integer b = 2 Declare Integer c = 3 Declare Integer result Set result = a + b * c Display result

OpenStudy (hijacktrolo):

would it not just display the mathmatic result that would be 21?

jagr2713 (jagr2713):

Is it a=5 b=2 c=3 result=0.0 result= a+b*c print=("Your number is ",result)

jagr2713 (jagr2713):

hmm am i over thinking this? @hijacktrolo

OpenStudy (hijacktrolo):

probably cause to me it looks like it should just say ("Your number is 21") is there any answer choices?

jagr2713 (jagr2713):

OHHH i didnt read it correct, it says "Display the result" in the question It would display 21

OpenStudy (hijacktrolo):

yup :D

jagr2713 (jagr2713):

Cause i was trying to do it in python lol. Can you help with one more?

OpenStudy (hijacktrolo):

i can try :)

jagr2713 (jagr2713):

Assume the variables result, w, x, y, and z are all integers, and that w = 5, x = 4, y = 8, and z = 2. What value will be stored in result in each of the followingstatements? a. Set result = x + y do i just set it to a. set result= 4+8=12 or set result=12 ?

OpenStudy (hijacktrolo):

yeah just set it to be set result=4+8=12

OpenStudy (hijacktrolo):

oh wait you should have just made it 4+8 and the set result would be 12

OpenStudy (hijacktrolo):

so interms it would be 12=4+8

jagr2713 (jagr2713):

x+y= int(12) Shouldnt the code be written like that

OpenStudy (hijacktrolo):

12 being the set result and and x=4 and 8=y you wouldn't need to put the =12 on the end of the equation because its at the front.

jagr2713 (jagr2713):

so how should it be written?

OpenStudy (hijacktrolo):

12=4+8

OpenStudy (hijacktrolo):

set results=x+y

jagr2713 (jagr2713):

OHH so we just put 12=4+8

OpenStudy (hijacktrolo):

yes

jagr2713 (jagr2713):

Oh can you help with the last one?

OpenStudy (hijacktrolo):

sure

jagr2713 (jagr2713):

If the following pseudocode were an actual program, why would it not display the output that the programmer expects? Declare String favoriteFood Display "What is the name of your favorite food?" Input favoriteFood Display "Your favorite food is " Display "favoriteFood"

jagr2713 (jagr2713):

Isn't it because of the last one?

OpenStudy (hijacktrolo):

yes and because the input says favorite food now if you were to change the to blueberries then it would display blueberries

jagr2713 (jagr2713):

So we just delete the last part?

OpenStudy (hijacktrolo):

no you would just change the input

jagr2713 (jagr2713):

??

OpenStudy (hijacktrolo):

the input is what is telling the program to show favoriteFood now if you were to change the word favoriteFood to blueberries then the display wont show favoriteFood but instead blueberries.

jagr2713 (jagr2713):

Oh, the question says "why wouldnt it show" i thought their was an error in there

OpenStudy (hijacktrolo):

change Input favoriteFood this to blueberies Display "Your favorite food is " Display "favoriteFood" and this will change to blueberries

OpenStudy (hijacktrolo):

the input is why its not showing :)

OpenStudy (hijacktrolo):

also can you help me with one question?

jagr2713 (jagr2713):

Yea, i but the input let the user "input" something so we have to set it to the favoriteFood

OpenStudy (hijacktrolo):

well its asking what the name of the food is but when you put favoriteFood in it will just display favoriteFood

OpenStudy (hijacktrolo):

you gotta change the favoriteFood display to blueberries

OpenStudy (hijacktrolo):

also the " <--- that is highlighted

OpenStudy (hijacktrolo):

i think you foregot to put a space in between

jagr2713 (jagr2713):

Hmm hold up

OpenStudy (hijacktrolo):

brb

jagr2713 (jagr2713):

k

OpenStudy (hijacktrolo):

back

jagr2713 (jagr2713):

Ok, when i run the code on raptor it worked. but when i put blueb

jagr2713 (jagr2713):

it doesnt work so when we put something different than the declaration we get an eror

OpenStudy (hijacktrolo):

try steak

jagr2713 (jagr2713):

Right? so the question says "why wouldn it work" thats if we change the declaration

OpenStudy (hijacktrolo):

wait what does the bottom display say if you type in raptor

jagr2713 (jagr2713):

No, raptor is the program

OpenStudy (hijacktrolo):

ok so if you put raptor in the input why do none of the displays say raptor?

jagr2713 (jagr2713):

No, raptor is a program

OpenStudy (hijacktrolo):

ok so when you put raptor in the input does it say "your favorite food is" "raptor" ?

OpenStudy (hijacktrolo):

i dont know sorry

jagr2713 (jagr2713):

i was thinking because of the quotes in the last line Declare String favoriteFood Display "What is the name of your favorite food?" Input favoriteFood Display "Your favorite food is " Display "favoriteFood"

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!