CP4P_NumberSystems_Activity_Answers 4

docx

School

Seneca College *

*We aren’t endorsed by this school

Course

101

Subject

Mechanical Engineering

Date

Feb 20, 2024

Type

docx

Pages

5

Uploaded by CaptainLobsterPerson1059

Report
WORD TABLE OF CONTENT &BIB Assignment 3 ABSTRACT Assignment 3 due date 4th February 2024 joaminu@myseneca.ca CPR101
Number Systems Activity Computer Principles for Programmers TABLE OF CONTENT Exercise one of two-integer overflow…………………………………………………………………………2 Exercise two of two-Numbering systems and conversions……………………………3 FALL 2023 WEEK 4 1 of 5
Number Systems Activity Computer Principles for Programmers AMINU JIM OLUWAFERANMI 131301236 joaminu@myseneca.ca @mySeneca.ca good day prof here is my work There are many notes in the instructions to help you earn marks for the questions below. Exercise One of Two integer overflow (80 points) 1. (5 points) Using your student number as the number of seconds , how many days will it take until that value is reached? (to two decimal places) 1519.69 2. (20 points) Using your student number as the number of seconds , how much time would that represent? 4.16 1519.69 36472.57 2188353.9 3 131301236 YEARS DAYS HOURS MINUTES SECONDS 3. (5 points) What are the maximum and minimum values that can be stored in a short 16- bit signed integer? 16-bit signed integer maximum = 32767 … minimum = −32768. 4. (5 points) Give examples of two short 16-bit signed integers that when added together would cause overflow. 17000 + 16000 are two positive values causing overflow when added together. -17000 + -16000 are two negative values causing overflow when added together. Binary Search Bug 5) (10 points) What is potentially wrong with the (low + high) / 2 calculation to find the middle point? Under what conditions would the calculation go wrong? This calucation leads to an overflow which leads to inaccuracy of results FALL 2023 WEEK 4 2 of 5
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Number Systems Activity Computer Principles for Programmers 6) (10 points) REWRITE the mid calculation to prevent overflow from mid = (low + high) / 2; to mid = low + (high-low) / 2 ; 7) (25 points) Write a 250+ word “reflection”(similar to a workshop in your programming class) describing the steps you used to develop and test your solution to the calculation bug. The initial calculation formular mid = (low + high) / 2 is noted to be inaccurate as it causes overflow the correct formular which is mid = low + (high-low) / 2 increases accuracy and reduces the possibility of having a over flow underflow. When the formular was used for different testing senerios like using big positive integers and negative integers there was a more accurate representation of the final result hence reducing overflow and underflow. Exercise Two of Two Numbering Systems and Conversions (20 points) 8) (5 points ) Fill in this chart as per the column headings Red decimal Green decimal Blue decimal Hex triplet 192 255 238 COFFEE 126 164 112 #7EA470 186 187 30 BABB1E 208 13 30 D00D1E 15 245 231 #0FF5E7 9) (15 points) Fill in this chart as per the column headings Hex triplet Red decimal Green decimal Blue decimal Change each row's Font or Shading colour to match the RGB value #3A26F2 58 38 242 Font or Shading colour matches RGB #844D42 132 77 66 Font or Shading colour matches RGB #094353 9 67 83 Font or Shading colour matches RGB FALL 2023 WEEK 4 3 of 5
Number Systems Activity Computer Principles for Programmers #7D6CB7 125 108 183 Font or Shading colour matches RGB FALL 2023 WEEK 4 4 of 5