Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1: Consider the following pseudocode fragment and answer corresponding questions. (For each question, you should clearly show steps about how you get the answer.)

    

1: Consider the following pseudocode fragment and answer corresponding questions. (For each question, you should clearly show steps about how you get the answer.) count := 0 For i = 1 to 6 For j =i+2 to 9 count: i j + count b) c) d) End-for End-for a) For the iteration of the outer loop where i = 4, how many times does the inner loop iterate? (5 Points) How many times has the variable "count" increased? (5 Points) Suppose i = 5, what is the value of "count" after the execution of inner loop? (5 Points) What is the final value of "count" after the execution of this nested loop? (5 Points) Question 2: (20 Points) Compute the value of the following questions. (For each question, you should clearly show steps about how you get the answer.) a) (-99) div 10 (5 Points) b) (-328) mod 9 (5 Points) c) Suppose n mod 5 = 3, find all possible values of n. (5 Points) d) [(45 mod 7) + (62 mod 7)] mod 7 (5 Points) Question 3: (20 Points) Question 4: Give the prime factorization for each number in non-decreasing order and find the greatest common divisor (gcd) and least common multiple (lcm). (For each question, you should clearly show steps about how you get the answer.) a) 56 (4 Points) b) 90 (4 Points) c) 470 (4 Points) d) ged(48, 84) (4 Points) e) lcm(132, 176) (4 Points) Question 4: (20 Points) Convert a text message to a number or a number to a text message using a specific scheme. The scheme associates each lowercase letter to a 2-digit number in the range 01 through 26 ("a"=01, "b"=02,..., "z"=26) and the blank character to 27. (For each question, you should clearly show steps about how you get the answer.) a) 19200118 (4 Points) b) 1618091305 (4 Points) c) 80116160914051919 (4 Points) d) real madrid (4 Points) e) never give up (4 Points)

Step by Step Solution

3.46 Rating (156 Votes )

There are 3 Steps involved in it

Step: 1

Steps Step 1 of 2 a When the outer loop is executed with i 3 the inner loop iterates 6 times Explana... 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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions

Question

7.6 Describe the major psychological models of depression.

Answered: 1 week ago