Assignment instructions
Question
Leap year algorithm
a) Trace the algorithm starting with the input 2564.
b) Document the pseudo-code that you would need to add to the algorithm after step 4 to output the number of days in February of the input year. Make sure that you describe the changes in detail and add a comment to each line of pseuo-code.
2. Everything stored on a computer is expressed as a sequence of bits (0s and 1s). However, different types of data (for example, characters and numbers) may be represented by the same sequence of bits. Hence, depending on requirements computers can be custom designed for specific roles. For example, a simple computer controller does not need the same precision as a super computer used for weather calculation. Hence, the number of bits used to store numbers can be significantly different. In this question, we will consider a 12-bit computer controller based on the following specifications.
a) What is the largest positive floating point (or real) number that is represent able using the 12-bits on this computer.
b) Find the value of the 12-bits required to represent the signed integer: −15 on this computer.
c) Find the value of the 12-bits required to represent the floating point number 10.01 on this computer.
d) Is the number stored in Question 2(c) exact? If not, what is the actual number 1 mark stored?
e) Find the actual bit pattern required to store the word below.
The remaining parts of Question 2(f—i) refer to the following 24-bits:
0101 0011 1111 1101 0111 1101
f) Represent these 24-bits as a hexadecimal number.
g) What characters according to Table 1 are represented by these 24-bits?
h) What pair of signed integers is represented by these 24-bits?
i) What pair of floating point numbers could be represented by these 24-bits?
j) This computer controller also supports 24-bit (i.e., double precision ) floating point (real) numbers using the method outlined in Grossman (2009), except in this case of double precision floats all 24-bits are used to store a single number, with 8-bits of these 24-bits being used to store the characteristic. Using this information answer the following:
i) What is the smallest positive floating point (real) number that can be represented using double precision on this computer?
ii) What will be the state of the 24-bits, if 10.01 is stored as a double precision floating point number on this computer? Is it exact?
A complex farm machine is controlled by two sensors x and y. Each sensor only has two states 0 and 1. The following logic rule controls if the machine runs:
(x ∧ y) ∨ (¬x ∧ y) ∨ (¬x∧ ¬y)
That is, the machine will run when the above logic rule (Equation 1) returns 1 (i.e., True).
a) Construct a truth table for each of the following logic expressions.
i) x ∧ y
ii) ¬x ∧ y
iii) ¬x ∧ ¬y
b) Combining the results from Question 3a create a truth table for the rule in Equation 1 which controls the farm machine. Hence, determine the state of the sensors when the farm machine is running.
In computers, colours are created by blending different combinations of red, green and blue (RGB). The RGB combination required to represent a colour on a computer is stored in 24-bits. These 24-bits are divided in 3 × 8-bits, which store a specific shade of red, green or blue. As 8-bits are used for each colour, colours can store 256 shades of red, green or blue. Hence, some 16 million colours (2 24 or 2563 ) can be represented on must modern computers in a single image.
These colours are normally specified as three two-digit hexadecimal numbers in html, photoshop, gimp etc. These 6 digits represent the state of the 24-bits. For example, Brown is specified as ????62929 to indicate the proportions of red, green and blue required. Hence, the bit pattern:
1010 0110 0010 1001 0010 1001,
will be interpreted as “Brown”. For grey shades the three proportions will always be equal. Moreover ff indicates that the colour is fully saturated. Hence, white corresponds toffffff or the bit pattern:
1111 1111 1111 1111 1111 1111;
Black 000000 which is represented by the bits:
0000 0000 0000 0000 0000 0000;
fully saturated red is ff0000 or the bit pattern:
1111 1111 0000 0000 0000 0000;
fully saturated green is 00ff00 which is represented by the 24-bits:
0000 0000 1111 1111 0000 0000,
and fully saturated blue is 0000ff which has the bit pattern:
0000 0000 0000 0000 1111 1111.
a) Convert the RGB values for the colours below to their equivalent 24-bit patterns
b) Convert the 24-bits representing the colours below to their equivalent hexadecimal values
On computers, images are broken up in several million pixels. The colour for each pixel is stored in 24-bits. These can be either stored in row or column order. For example, consider the image below consisting of 2 × 3 pixels, with the hexadecimal representation of each pixels 24-bit pattern shown.
The 144-bits required to store the image can be stored in bits as: FFA07A FFD700 FFA07A FFA07A FFA07A FFA07A (row order), or
FFA07A FFA07A FFD700 FFA07A FFA07A FFA07A (column order). Hence, to recreate an image you need to know the total number of pixels, the storage order and one other dimension of the image.
i) The following 216 bits, store a 3 × 3 pixel image in column order. 00FF00 00FF00 00FF00 FFFFFF 00FF00 FFFFFF FFFFFF 00FF00 FFFFFF. Sketch the image represented by this bit pattern.
ii) How many bits are required to store an 8k UHD image (7680 × 4320) image in 24-bit RGB colours? How many whole 8k images can you store in an 8GB (GigaByte) drive.
BEN02 Planning and Presenting a Micro-Enterprise Idea BTEC Level 1/2
Read MoreBTEC Unit 35: Engineering Services Delivery Plan for Sector-Specific Organizations | HND Level 5 Assignment 2
Read MoreTQUK Level 3 Administering Medication and Monitoring Effects in Adult Care Assignment
Read MoreUnit 10: 3D Modelling and Assembly Drawing for Vice – Engineering Design Portfolio BTEC Level 3
Read MoreWhy is it important that you correlate the appropriate information of the patient when they arrive for their appointment?
Read MoreNCFE Level 3 Roles and Responsibilities in Health And Social Care
Read MoreMP3395 Turbocharger Performance Evaluation and System Analysis CW2 Assessment, AY2024-25
Read MoreKey Research Policies and Funding Models at University of Strathclyde
Read MoreCIPD Level 5 Associate Diploma Key Assessment Questions
Read MoreLaw Assignment Questions Critical Legal Analysis & Solutions
Read More