0% found this document useful (0 votes)
113 views3 pages

CMP223 COAL Assignment 01 PDF

This document outlines an assignment with 17 problems related to computer arithmetic and floating point representation. It provides resources for video lectures, describes each problem and its point value. Problems cover topics like binary, decimal, octal conversion; signed and unsigned number representation; integer overflow and underflow; floating point representation standards; and programming in C/C++. Students must complete the problems by hand, scan their work, and submit a PDF to a Bitbucket repository by the deadline. Late submissions will not be accepted and cheating will result in zero points.

Uploaded by

Sadia Ch
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
113 views3 pages

CMP223 COAL Assignment 01 PDF

This document outlines an assignment with 17 problems related to computer arithmetic and floating point representation. It provides resources for video lectures, describes each problem and its point value. Problems cover topics like binary, decimal, octal conversion; signed and unsigned number representation; integer overflow and underflow; floating point representation standards; and programming in C/C++. Students must complete the problems by hand, scan their work, and submit a PDF to a Bitbucket repository by the deadline. Late submissions will not be accepted and cheating will result in zero points.

Uploaded by

Sadia Ch
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

​Assignment 01 Total Marks: 130

Resources:
Video Lecture # 06: ​https://www.youtube.com/watch?v=rb6vaNZf1p8
Video Lecture # 07: ​https://www.youtube.com/watch?v=4COgD6DM9a8

Problem 1: [5]
Convert ​41A7​16​ into their respective binary, decimal, and octal number, if this number is:
a) 2’s complement signed number
b) 1’s complement signed number
c) unsigned number
Also, do show the conversion steps.

Problem 2: [5]
Why do we need separate hardware for subtraction if using sign-magnitude encoding? And do we need
separate hardware for subtraction if using 1’s complement and 2’s complement encoding, explain your
answer in one paragraph.

Problem 3: [7]
Write down a C program that checks the minimum and maximum value that can be stored in signed and
unsigned data types like char, short, int, long, and long long. Does this have something to do with the h/w
and operating system (32 bit or 64 bit)?

Problem 4: [3]
What will be the range of number having 16 bits, if it is a:
a) 2’s complement signed number
b) 1’s complement signed number
c) unsigned number

Problem 5: [5]
By adding the following 2’s complement signed numbers, will overflow occur? If yes, then is it a positive
overflow or a negative overflow? Also, give the status of Carry flag (CF) and Overflow flag (OF). Do show
your work.
a) 0x86 + 0x84
b) 0x7E + 0x70
c) 0xF6 + 0x7E

Problem 6: [10]
Write down a C program that verifies what happens when a signed or unsigned variable of integer data type
overflows? How does C/C++ handle integer overflow in case of signed or unsigned? Also write down how
integer overflows are handled in various programming languages like Java, C#, Python, Javascript.

Muhammad Arif Butt, Ph.D. COAL Assignment # 01 Page ​1​ of ​3


Problem 7: [15]
Integer overflow and underflow vulnerabilities are considered the eighth most dangerous vulnerability in the
Common Weakness Enumeration (CWE) Top 25 List of 2019. These types of vulnerabilities are caused by
misuse of variable types like signed or unsigned int, char, etc, and can be exploited to bypass protections
against other types of vulnerabilities like buffer overflows. Write two pages on an explanation of, what is
integer overflow and underflow vulnerability with examples. And how hackers can exploit this vulnerability
for their malicious goals. And In the end, write a few lines on protection against integer overflow and
underflow vulnerabilities.

Problem 8: [10]
Write a one-page note on Unicode Standard. Mention some common encoding formats used by Unicode and
there at least three implementations. Also tell what Unicode encoding format is used by Windows, Linux,
and macOS.

Problem 9: [7]
What is the IEEE-754 standard for floating-point representation and why it was needed? Also, show
floating-point representation using IEEE-754 standard having:
a) 32 bits
b) 64 bits
c) 128 bits
d) 256 bits
And a precision of how many decimal digits did they give depending on their mantissa?

Problem 10: [7]


Why do IEEE-754 designers use biased exponent representation? And what will be the bias if 14 bits will be
used to store the exponent, which is used in 128 bits floating-point representation for Quadruple precision
Also tell the range of the exponent values?

Problem 11: [7]


Why is the exponent placed before mantissa in the IEEE-754 standard? And what are the advantages of
storing exponents in a biased format instead of 2’s complement?

Problem 12: [15]


Convert following decimal numbers to 32-bit IEEE-754 floating-point representation in Hex format. Show
your conversion steps.
a) 75.07539​10
b) -128.25508​10

Problem 13: [7]


Given the 32-bit IEEE-754 floating-point representation ​41A42B43​16 , find the decimal value. Show your
conversion steps.

Problem 14: [7]


Write down a C program that checks the minimum and maximum value that can be stored in data types like
float, double, long double. And Which data types in C/C++ support single precision, double precision, and
quadruple precision for floating-point numbers?

Muhammad Arif Butt, Ph.D. COAL Assignment # 01 Page ​2​ of ​3


Problem 15: [7]
Write down a C program that verifies as what happens when a variable of data type storing a floating-point
number, overflows and underflows? Also tell, What is floating point imprecision?

Problem 16: [3]


Show how to represent +/-0 and +/- infinity in the IEEE-754 format.

Problem 17: [10]


Add and Subtract the following floating-point numbers represented in IEEE-754. The answer should be in
the IEEE-754 floating-point representation in Hex format.
a) 01000010 00000000 01001100 01011001​ ​and 01000100 00110000 00000101 11010110

Submission Instructions:

● Solutions to all the parts must be your own hard work. DON'T let anyone copy your assignment. In
case of a copy both students will be awarded a ZERO may be some negative marks as well.

● ​You have to submit your assignment in HANDwritten form on plain A4 Sheets.

● Attach a cover sheet showing the assignment title, course and your personal information.

● Simply scan the answer sheets of your assignment, generate the pdf
document and push it on your Bitbucket repository. Deadline for submission
of Assignment 01 is​ Thursday, October 08, 2020 till 11:59pm​.
● The title of your assignment should be​ ​rollno_Assignment01​.
● Late submissions will NOT be accepted. So start doing the problems from today so that you can
submit your assignment in time.

For cheating policy please refer to Lecture 01, Slide #9

TIME IS JUST LIKE MONEY.


THE LESS WE HAVE IT;
THE MORE WISELY WE SPEND IT.
Manage your time and Good Luck

Muhammad Arif Butt, Ph.D. COAL Assignment # 01 Page ​3​ of ​3

You might also like