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

show all work. [12] 1. Show your work for each calculation: a. Convert the binar

ID: 3910476 • Letter: S

Question

show all work.

[12] 1. Show your work for each calculation: a. Convert the binary number 110100111100 to hexadecimal. (Do not convert the whole number to decimal in the middle.) Answer: b. Convert the binary number 1010011 to decimal. Answer: c. Convert the decimal number 91 to binary Answer: d. Add the binary numbers, producing a binary result. (Directly, no decimal conversion in middle.) 1001000011 1100111 Answer: [6] 2. What is printed by the following Python code? Answer: a=9 #1 #2 #3 #4 #5 #6 #7 #8 #9 e-a//b print(d, +c e) print (b, c) [6] 3. What is printed by the following Python code? Answer: for i in [2, 4, 6, 8]: #2 #3 #4 print (num

Explanation / Answer

(1)

   (a)   Given Binary number 110100111100
  
       Group them into 4 digits: 1101 0011 1100
      
       Converting to corresponding Hexadecimal values: D 3 C
      
       Hence (110100111100)2 = (D3C)16

  
   (b)   Given Binary number 1010011
      
       Decimal Conversion:
      
       From LSB to MSB
      
       => (2^0 * 1) + (2^1 * 1) + (2^2 * 0) + (2^3 * 0) + (2^4 * 1) + (2^5 * 0) + (2^6 * 1)
       => 1 + 2 + 0 + 0 + 16 + 0 + 64
       => 83
      
       Hence (1010011)2 = (83)10

      
   (c) Given decimal number 91:

       Binary: Using Division-remainder method,
      
       Division by 2    Quotient    Remainder    Bit #
           91/2            45            1       0
           45/2            22            1       1
           22/2            11            0       2
           11/2            5            1       3
           5/2            2            1       4
           2/2            1            0       5
           1/2            0            1       6
      
       Hence (91)10 = (1011011)2
      
      
   (d) Given: 1001000011 + 1100111

       Note that in the binary system:

       0 + 0 = 0
       0 + 1 = 1
       1 + 0 = 1
       1 + 1 = 0, carry over the 1, i.e. 10
          
       Hence:    1001000011 + 1100111 = 01010101010
      
      
(2)

   a = 9   #1 Nothing will print, Just assign value 9 to a
   b = 4   #2 Nothing will print, Just assign value 4 to b
   c = 5   #3 Nothing will print, Just assign value 5 to c
   d = a + 2*b #4 Nothing will print, Just assign value (9 + (2*4)) = 17 to b
   e = a//b + c #5 Nothing will print, Just assign value 7 to e
   print(d, e) #6 Prints (17, 7)
   b = b + 2 #7 Updates value of b to 6
   c = b*c #8 Updates value of c to 30
   print(b, c) #9 Prints (6, 30)
  
  
(3)
  
   Initially num is assigned with 0
  
   Iterating over each value in list [2, 4, 6, 8]
  
   Iteration 1: prints value 2 (0 + 2)
   Iteration 2: prints value 6 (2 + 4)
   Iteration 3: prints value 12 (6 + 6)
   Iteration 4: prints value 20 (12 + 8)
  
   Hence output is:
  
   2
   6
   12
   20

  
  
(4)
   Initially variables x and y are initialized with values 1, 1 respectively.
  
   While loop iterates till y value is less than 7
  
   Iteration 1: x = 1, y = 1 => Updates to x = 2, y = 3; Prints (2, 3)
   Iteration 2: x = 2, y = 3 => Updates to x = 3, y = 6; Prints (3, 6)
   Iteration 3: x = 3, y = 6 => Updates to x = 4, y = 10; Prints (4, 10)
  
   At y value 10, iteration stops...
  
   Final print statement print(x*y) prints 40