Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please show all steps. Question a: 1100011, Question b: 3152, but I don't understand why. (4) This question assumes familiarity with modular arithmetic discussed in

Please show all steps. Question a: 1100011, Question b: 3152, but I don't understand why.

image text in transcribed

(4) This question assumes familiarity with modular arithmetic discussed in Unit 2 . In the pseudo-code below, Line 7 performs string addition (concatenation), for example: "a" + "b" = "ab". Even if the addends look like numbers, it will still do string addition: "2" + "3" = "23". Answer the questions below. a. What is the output of the algorithm when x=99 and b=2 ? b. What is the output of the algorithm when x=1642 and b=8 ? \begin{tabular}{l} Algorithm 4 \\ \hline 1: procedure Expand (x,b) \\ 2: Input: integers x and b \\ 3: Output: outVal, x written in base b \\ 4: \\ 5: outVal = an empty string \\ 6: while (x>0) do \\ 7: outVal = string (x mod b)+ outVal \\ 8:x=x div b \\ 9: return(outVal) \end{tabular}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

3. List ways to manage relationship dynamics

Answered: 1 week ago