This set of questions is about number conversions. Show your work.
- Convert the binary value 1010 0110 to decimal.
- Convert the hexadecimal value A9 to decimal.
- Convert the decimal value 143 to binary.
- Convert the decimal value 143 to hexadecimal.
Instructions: The next two problems ask you to read
a Pseudocode or App Inventor algorithm. Trace through each of them by
hand, keeping track of the variables, to determine the answer to the
questions.
- Suppose you have a global variables named X, Y and N.
What value would Y have after the following Pseudocode segment? Explain.
Set X to 33
Set N to 3
Set X to X / N
If X > 10 then do:
Set Y to "Hello"
else-do:
Set Y to "Ciao"
- Consider the App Inventor procedure on the right.
- Suppose the procedure was called 100 times. Approximately
how many times would you expect the app to say "You win!". Explain.
- Approximately how many times would you expect it to say "5". Explain.
Instructions: The next problem asks you to write a Pseudocode
algorithm. Model your answers after the Pseudocode algorithm in question 5.
- Suppose you have the global variables A, B,
and Smallest and you're trying to store the smaller of their two
values in Smallest. Write a Pseudocode if/else algorithm
that will set the variable Smallest to the smaller of A or B.
For example, if A = 3 and B = 4 then your algorithm should should set
Smallest to A's value (i.e., 3). If A = 4 and B = 1, then Smallest
should be set to B's value (i.e., 1). If you get the algorithm right,
the case when A=B will take care of itself.