Maths
Student ID number: Pages: 8 Questions: 6 UNIVERSITY OF TASMANIA KIT103 Computational Science KMA155 Discrete Mathematics Test 3, 2020 Time required: 50 minutes Submit by: 1500 AEDT (with no penalty) 1700 AEDT (with penalty; see MyLO) Instructions: Answer ALL SIX (6) questions. Each question 1–6 is worth 8 marks. Prepare your answers using any of the following three options: 1. Write on your own paper, putting your student ID and test number at the top, then for each question clearly write the question number, followed by your answer. Use as many pages as you require. When done, digitise your work into a single PDF. 2. Annotate this PDF in the spaces provided using a tablet and stylus. Write your student ID on the test’s front page. 3. Print this PDF and write your answers in the spaces provided, then digitise your work into a single PDF. Write your student ID on the test’s front page. If writing directly on the test paper note there is additional writing space at the end. When done, submit your single PDF of answers to the Test 2 assignment folder on MyLO before its closing time. Whatever option you choose, write in blue or black only. 2 KIT103 and KMA155 — Test 3, 2020 Question 1 Convert x to base b, giving full details of your analysis, when: a x = 111102, b = 10 b x = 5110, b = 2 c x = 31127, b = 10 d x = 444410, b = 5. continued. . . KIT103 and KMA155 — Test 3, 2020 3 Question 2 Linux file permissions can be modified by a command (chmod) that accepts a three-digit octal number as one of its inputs. The octal number encodes three bitsets of permissions (read, write, and execute) according to the following pattern: digit digit digit user group others r w x r w x r w x a Translate the permissions 4628 into binary. b Given the permissions 4628, can the file’s user write to the file? Explain with reference to your answer to part (a). c The user wants herself to be able to read, write and execute a file, her group to be able to read and execute it, and for all others to only be able to read it. What octal number represents this set of permissions? Briefly explain your reasoning with reference to the equivalent binary representation of that number. continued. . . 4 KIT103 and KMA155 — Test 3, 2020 Question 3 Count the number of integers in the set S = {1, ..., 123} that are not divisible by 2, 3, or 5. Quote an appropriate counting rule, and give full details of your analysis. continued. . . KIT103 and KMA155 — Test 3, 2020 5 Question 4 This question concerns generating permutations and combinations in Python. In each part you may assume that any required functions from the itertools or scipy modules have already been imported. a A password manager can generate a random password from a set of allowed characters. Assuming the set of allowed characters is stored in the variable permitted, write a set comprehension to generate all possible randomised passwords of length 20. Note that passwords are strings of text. b Phil works in an upmarket bar making cocktails (mixtures of alcholic drinks). The bar has 40 different spirits that can be mixed. Assuming a cocktail is a mixture of four different spirits, the names of which are stored in the variable spirits, write a set comprehension to generate all possible cocktails Phil could make. (You can ignore that such cocktails would be very unhealthy!) c Because of different alcohol content and viscosity (thickness), spirits can be layered when making a cocktail. This can affect the visual appearance but also taste of the cocktail. Assuming the same set of 40 spirits as in part (b), write a set comprehension to generate the possible orders in which four spirits can be added to a cocktail. continued. . . 6 KIT103 and KMA155 — Test 3, 2020 Question 5 Suppose that the adjacency matrix A for a network of nodes 1, 2, 3, 4, 5, 6 is such that A = 0 1 0 1 0 1 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 1 1 0 0 1 1 1 1 0 1 0 0 0 0 0 , A 2 = 1 0 1 1 1 0 0 1 0 0 0 0 0 0 1 0 0 0 0 1 1 2 2 0 0 2 2 2 2 0 0 1 0 1 0 1 , A3 = 0 3 1 3 2 1 0 0 1 0 0 0 0 1 0 0 0 0 0 3 3 4 4 0 0 4 4 4 4 0 1 0 1 1 1 0 , A 4 = 1 3 5 5 5 0 0 1 0 0 0 0 0 0 1 0 0 0 0 7 7 8 8 0 0 8 8 8 8 0 0 3 1 3 2 1 , A5 = 0 11 8 11 10 1 0 0 1 0 0 0 0 1 0 0 0 0 0 15 15 16 16 0 0 16 16 16 16 0 1 3 5 5 5 0 , A 6 = 1 18 21 21 21 0 0 1 0 0 0 0 0 0 1 0 0 0 0 31 31 32 32 0 0 32 32 32 32 0 0 11 8 11 10 1 . a Evaluate the minimum number of steps s(i, j) needed to get from i to j, for all nodes i and j, and state the result in a table. b List all nodes connected with 1. c List all nodes connected with 2. continued. . . KIT103 and KMA155 — Test 3, 2020 7 Question 6 Let A = [ 4 3 0 0 3 1 ] , B = −2 3−2 4 1 −2 , C = [ 1 −2 1 0 ] , D = 1 13 −1 0 2 . a Compute the following matrices, showing any necessary working i 3A ii B−D iii BC iv AT (here T denotes transpose) b List all pairs of different matrices (from A, B, C, D) which cannot be multiplied, clearly stating the order of the operation that is not permitted e.g. XY. Continue your answer on the next page if required. continued. . . 8 KIT103 and KMA155 — Test 3, 2020 Additional writing space if annotating the PDF or writing on a hard copy