CSC 156 Spring 2025 - Homework 8 (100 pts. total)
Assigned Mon Mar 31, due Mon Apr 7


BEFORE STARTING THIS ASSIGNMENT:
Before starting the exercises given below for each section, please make sure to read each section and check your understanding (by doing the participation exercises and those additional exercises with answers provided).

FOR ALL QUESTIONS IN THIS ASSIGNMENT:
Answer each question. *Make sure to justify your answer for all questions. Do NOT just state the answer.*

THE ASSIGNMENT:
  • [10 pts.] Question 1: Given the eight-bit binary number X = x7x6x5x4x3x2x1x0:
            a) What is the result of the bitwise operation X & !(1<<3)?         b) What was done to X by the bitwise operation in part (a)?
  • [10 pts.] Question 2: Given the eight-bit binary number X = x7x6x5x4x3x2x1x0:
            a) What is the result of the bitwise operation (X >> 5) & 1?         b) What was done to X by the bitwise operation in part (a)?
  • [20 pts.] Question 3: Given a 6-bit binary number B = b5b4b3b2b1b0, write a bitwise expression (in terms of x) that:
             a) gets the bit b4
             b) sets the bit b3 to 0
             c) sets the bit b2 to 1
             d) toggles the bit b1 to 1
  • [30 pts.] Section 4.4 Additional Exercises: #1b, 2b, 5b, 5d
  • [30 pts.] Question 4: Encrypt each word or phrase using the given encryption function and the scheme that associates each capital letter to a two-digit number in the range "00" through "27" where "A"=01, "B"=02, ..., "Z"=26, " "(blank space) = 27, and "."(period) = 00:
             a) "RED", encryption function f(x) = (x + 4) MOD 28
             b) "CSC", encryption function f(x) = (x + 14) MOD 28
             c) "QUIZ", encryption function f(x) = (x + 2) MOD 28
             d) "BLUE", encryption function f(x) = (4*x + 5) MOD 28



    Last Modified: 4/3/25