Question

1. What are the problems with the following pseudocode? Be careful here, this one is tricky!...

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 call

B. yearsUntilAdult would have displayed wrong value(logical error)

C. scope of siblingType variable is restricted to within yearsUntilAge so main() can not display the value of it

D. yearsUntilAdult module requires different datatype as an argument than what is used in method call within main

There can be multiple answers!

0 0
Add a comment Improve this question Transcribed image text
Answer #1

An swer

B. yearsUntilAdult would have displayed wrong value(logical error)
C. scope of siblingType variable is restricted to within yearsUntilAge so main() can not display the value of it
Add a comment
Know the answer?
Add Answer to:
1. What are the problems with the following pseudocode? Be careful here, this one is tricky!...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT