Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1 .Which of the following Bare Bones programs is self-terminating Assume X > 0 A

ID: 3826554 • Letter: 1

Question

1.Which of the following Bare Bones programs is self-terminating Assume X > 0

A. while X not 0:    

B. while X not 0:

decr X

C. decr X

while X not 0:

2: If c = x mod n then c is guaranteed to be in which of the following sets

a.{ 1, 2, 3, … n-1 }

b.{ 0, 1, 2, 3, …. n-1 }

c.{ -(n-1), -(n-2), -(n-3), … -2, -1 0 }

d.{ 1, 2, 3, …. n }

3. If xa mod n = c and xb mod n = d then xa+b mod equals

            A. c + d mod n

            B.   c*d mod n

            C. cd mod n

            D. None of the above

4. Using the private keys n = 133 and d = 5, decrypt the message 7

a. 7

b. 37

c. 49

d. None of the above

Explanation / Answer

1. Which of the following Bare Bones programs is self-terminating Assume X > 0
A. while X not 0:
   This runs in an infinite loop, if there is no loop control statement inside the loop.
B. while X not 0:
   decr X
   This will run the loop for a fixed number of times provided X is positive.
   So, this is what your answer is.
C. decr X
   while X not 0:
   This also does pretty similar to the previous option.
   So, this is also your answer choice.
          
2. If c = x mod n then c is guaranteed to be in which of the following sets.
   When x is divided by n, the remainder is what c is.
   The remainder will always be in the range 0 - n-1 in this case.
   So, the answer is:
   b. { 0, 1, 2, 3, …. n-1 }
3. If xa mod n = c and xb mod n = d then xa + b mod n equals:
   xa mod n = c. So c lies in the range {0, n-1}.
   xb mod n = d. So d also lies in the range {0, n-1}.
   Now, xa + b mod ???
   This is incomplete...
4. Using the private keys n = 133, and d = 5, decrypt the message 7.
n = 133 = 7 * 19.
d = 5.
P = 7^5 mod 133
= 16807 mod 133
= 49.
So, the answer is: c. 49.