## MAT3323 Assignment 3 Semester 3, 4236 Weight: 42% Total marks: 52 Due date: Friday 6 April, 4236 45:77 AEST Submission • The assignment will be electronically submitted via StudyDesk. • You are to submit your assignment as a Portable Document Format (PDF/A) file. Word files will not be accepted by the system. Instructions on how to save a Word 4232 document in PDF/A format are included on page 7. • Hand-written and scanned assignments are perfectly acceptable, as long as they are submitted as a PDF file. You just need to ensure that the resulting scanned assignment is clearly legible. • If you choose to typeset your assignment you must ensure that all mathematical notation etc. follow standard mathematical conventions. The Learning Centre has some quick tip guides to typing Mathematics in Word (if you really need to typeset your assignment!). • If you have trouble submitting your assignment etc., please contact the examiner (mat3323@www.sci.usq.edu.au.) or via phone ASAP. Assignment instructions • Show full working for each question. Give the marker every opportunity to see how you obtained your answers. Your mathematical reasoning is just as important as the final answer. Australian Eastern Standard Time MAT3323 S3 4236 Question 3 [38 marks] Everything stored on a computer is expressed as a string of bits. However, different types of data (for example, characters and numbers) may be represented by the same string of bits. For this question, we assume that text characters (or symbols) are stored in :-bits. Table 3 maps the 34: ASCII characters to a hexadecimal value representing the state of these : bits. For example, from Table 3 the character ‘A’ has the hexadecimal value 41. Converting this hexadecimal value to binary gives the state of the :-bits (01000001) storing the character ‘A’. In this computer, numbers are stored in 34-bits. We will also assume that for a floating point (real) number, 8 of these bits are reserved for the mantissa (or significand) with 2k−1 − 1 as the exponent bias (where k is the number of bits for the characteristic). For example, the string of 46-bits 001101100011100100110101 in our computer might represent the three characters ‘8;7’ (i.e. 3×:-bits) or two numbers (2×34-bits), which will be different depending on whether the numbers are stored as integers (i.e. 867 and −1739 if integers) or as floating point numbers (0.13671875 and −0.00040435791015625 if floating point). More precisely, any floating point number between 0.13671875 and 0.140625 will have the same 34-bit pattern, in this not very accurate scheme. Similarly, any floating point number between −0.00040435791015625 and −0.0004119873046875 will also have the same 34-bit pattern. i) Find the computer representation for the negative integer −1215. ii) Find the computer representation for the negative floating point number −1215. iii) Is the number stored in Question 3(ii) exact? If not what is the actual number stored? iv) Find the bit pattern required to store the five characters ‘-3437’. The remaining parts of Question 3(v–ix) refer to the following 46-bits: 010100100110010101110010 v) Represent this string as a hexadecimal number. vi) What characters are represented by these 46-bits? vii) What pair of integers is represented by these 46-bits? viii) What pair of floating point numbers could be represented by these 46-bits? ix) What is the range of the floating point numbers could be represented by each of the two 34-bit patterns. 4 Due date: Friday 6 April, 4236 S3 4236 MAT3323 Question 4 [8 marks] In computers, colours are created by blending different combinations of red, green and blue. These colours are normally specified as three twodigit hexadecimal numbers in html, photoshop, gimp etc. For example, Brown is specified as A62929 to indicate the proportions of red, green and blue required. For grey shades the three proportions will always be equal. Moreover FF indicates that the colour is fully saturated. Hence, white corresponds to FFFFFF and Black 000000; while red is FF0000, green is 00FF00, and blue is 0000FF. This colour system is called RGB. Other applications, such as Sci/Matlab require the RGB colours to be specified in terms of the fraction of each colour required. In this case, the colour is specified by three numbers between 0 and 1, with 1 representing full colour saturation. White in this system is (1, 1, 1), and Black is (0, 0, 0). Brown in this system is given as (0.65, 0.16, 0.16); while red is (1, 0, 0); green is (0, 1, 0) and blue is (0, 0, 1). This representation is referred as the RGB colour fraction. Given that different systems are used in different applications, it is important to be able to convert between the two representations. The largest number that can be represented by a two-digit hexadecimal number is FF so we know that there are 478 possible shades of RGB that can be represented, each with a maximum value of 477. Hence, to convert the hexadecimal colour representation to a colour fraction, the following has to be done: 3. Convert each hexadecimal colour number to its decimal equivalent. 4. Divide each decimal by 255. 5. Record each fraction as the colour fraction required for that colour. Converting from a colour fraction to the hexadecimal version is the reverse of the above. To illustrate, let us consider Brown. Its shade of red is A616 . As its hexadecimal value corresponds to 166. Hence, the fraction amount of red required is: 166 255 0.65. Similarly for green the decimal equivalent of 2916 is 41. Therefore, the green colour fraction is: 41 255 0.16. The blue colour fraction for Brown is also 0.16. i) Convert the RGB values for the colours below to their equivalent RGB colour fractions. Round your answers to two decimal places. Colour name Colour Hexadecimal Rosy Brown BC8F8F Dark Khaki BDB76B Firebrick B22222 Due date: Friday 6 April, 4236 5 MAT3323 S3 4236 ii) Convert the colour fractions for the colours below to their equivalent hexadecimal values. Colour name Colour Colour fraction Deep Pink (1.000, 0.0784, 0.576) Royal Blue (0.255, 0.411, 0.882) Lime (2.4,2.:,2.4) Question 5 [: marks] i) a) Write pseudocode for an iterative algorithm which takes as its input a list of numbers and returns a list of numbers. The algorithm leaves the first number alone, but multiples each of the remaining numbers in the list by the number immediately proceeding it in the list. For example: if the input list is [5, 4,−1, 2] than the algorithm would return [5, 20,−4,−2]. b) Trace your pseudocode for Question 5(a) using [5, 4,−1, 2] as the input list. ii) Consider the following algorithm. 3. Input y be a non-fractional number in base 8. 4. s 0. 5. for i = 1 to n the number of digits in y. 5.3. s s + 8i−1 × i’th digit of y from the right 6. end for 7. output s a) Trace the algorithm starting with the input y = 1703. b) What changes would need to be made to the algorthm to convert hexadecimal to decimal? Document these changes using pseudocode. Table 3: Hexadecimal map giving the value of the : bits used to store any of the 34: standard ASCII (American Standard Code for Information Interchange) characters in our computer. 2 3 4 5 6 7 8 9 : ; A B C D E F 234 ! ” # $ % & ’ ( ) ? + , – . / 5 2 3 4 5 6 7 8 9 : ; : ; < = > ? 6 @ A B C D E F G H I J K L M N O 7 P Q R S T U V W X Y Z [ \ ] ^ _ 8 ‘ a b c d e f g h i j k l m n o 9 p q r s t u v w x y z { | } END OF ASSIGNMENT QUESTIONS 6 Due date: Friday 6 April, 4236 S3 4236 MAT3323 Steps required to produce a PDF/A file from Microsoft Word 4232. 3. Save the document as a .docx file. 4. Go to the File menu and select Save As. 5. You should now see the dialog box in Figure 3. In this dialog make sure the Save as type is PDF, as shown in Figure 3. Figure 3: Word 4232 Save As dialog with the Save as type: PDF circled. 6. Select Options from the Save As dialog box shown in Figure 3. A new window outlining extended options will appear as shown in Figure 4. Make sure that ISO 3;227-3 compliant (PDF/A) is selected as shown in Figure 4. Once completed click OK. Figure 4: Word 4232 extend PDF options with the ISO 3;227-3 compliant (PDF/A) check box highlighted. 7. Save the file with an appropriate filename. If it is your final assignment submission make sure you include your student number and course code in the file name. Due date: Friday 6 April, 4236 7

info@checkyourstudy.com