COMPUTER SCIENCE TRIPOS

Similar documents
COMPUTER SCIENCE TRIPOS

COMPUTER SCIENCE TRIPOS

COMPUTER SCIENCE TRIPOS

Lecture 6: Manipulation of Algebraic Functions, Boolean Algebra, Karnaugh Maps

COMPUTER SCIENCE TRIPOS

XI STANDARD [ COMPUTER SCIENCE ] 5 MARKS STUDY MATERIAL.

Fundamentals of Digital Design

Boolean Algebra, Gates and Circuits

Systems I: Computer Organization and Architecture

Philadelphia University Student Name: Student Number:

Sets. We discuss an informal (naive) set theory as needed in Computer Science. It was introduced by G. Cantor in the second half of the nineteenth

UNIVERSITY OF BOLTON SCHOOL OF ENGINEERING BENG (HONS) ELECTRICAL & ELECTRONICS ENGINEERING EXAMINATION SEMESTER /2017

University of Minnesota Department of Electrical and Computer Engineering

Computer organization

Reg. No. Question Paper Code : B.E./B.Tech. DEGREE EXAMINATION, NOVEMBER/DECEMBER Second Semester. Computer Science and Engineering

Principles of Computer Architecture. Appendix B: Reduction of Digital Logic. Chapter Contents

ECE 545 Digital System Design with VHDL Lecture 1. Digital Logic Refresher Part A Combinational Logic Building Blocks

Sample Marking Scheme

University of Guelph School of Engineering ENG 2410 Digital Design Fall There are 7 questions, answer all questions.

INF2270 Spring Philipp Häfliger. Lecture 8: Superscalar CPUs, Course Summary/Repetition (1/2)

Digital Logic: Boolean Algebra and Gates. Textbook Chapter 3

Boolean Algebra and Digital Logic 2009, University of Colombo School of Computing

ECE/CS 250 Computer Architecture

ECE 250 / CPS 250 Computer Architecture. Basics of Logic Design Boolean Algebra, Logic Gates

Philadelphia University Student Name: Student Number:

CS/COE1541: Introduction to Computer Architecture. Logic Design Review. Sangyeun Cho. Computer Science Department University of Pittsburgh

Faculty of Engineering. FINAL EXAMINATION FALL 2008 (December2008) ANSWER KEY

Lecture 2 Review on Digital Logic (Part 1)

Number System conversions


Quiz 2 Room 10 Evans Hall, 2:10pm Tuesday April 2 (Open Katz only, Calculators OK, 1hr 20mins)

UNIT 5 KARNAUGH MAPS Spring 2011

Digital Logic. CS211 Computer Architecture. l Topics. l Transistors (Design & Types) l Logic Gates. l Combinational Circuits.

Boolean Algebra. Digital Logic Appendix A. Boolean Algebra Other operations. Boolean Algebra. Postulates, Identities in Boolean Algebra

Boolean Algebra. Digital Logic Appendix A. Postulates, Identities in Boolean Algebra How can I manipulate expressions?

ECE 2300 Digital Logic & Computer Organization

Midterm Examination # 1 Wednesday, February 25, Duration of examination: 75 minutes

CS/COE0447: Computer Organization

Schedule. ECEN 301 Discussion #25 Final Review 1. Date Day Class No. 1 Dec Mon 25 Final Review. Title Chapters HW Due date. Lab Due date.

ENEL Digital Circuit Design. Final Examination

LOGIC GATES. Basic Experiment and Design of Electronics. Ho Kyung Kim, Ph.D.

E&CE 223 Digital Circuits & Systems. Lecture Transparencies (Boolean Algebra & Logic Gates) M. Sachdev

CMPT-150-e1: Introduction to Computer Design Final Exam

University of Toronto Faculty of Applied Science and Engineering Final Examination

Lecture 6: Gate Level Minimization Syed M. Mahmud, Ph.D ECE Department Wayne State University

DE58/DC58 LOGIC DESIGN DEC 2014

Class Website:

Propositional Logic. Logical Expressions. Logic Minimization. CNF and DNF. Algebraic Laws for Logical Expressions CSC 173

Digital Logic Appendix A

CSCI 2200 Foundations of Computer Science Spring 2018 Quiz 3 (May 2, 2018) SOLUTIONS

Number System. Decimal to binary Binary to Decimal Binary to octal Binary to hexadecimal Hexadecimal to binary Octal to binary

Combinational Logic. Mantıksal Tasarım BBM231. section instructor: Ufuk Çelikcan

(Boolean Algebra, combinational circuits) (Binary Codes and -arithmetics)

COMBINATIONAL LOGIC FUNCTIONS

CS470: Computer Architecture. AMD Quad Core

Logic design? Transistor as a switch. Layered design approach. CS/COE1541: Introduction to Computer Architecture. Logic Design Review.

CPSC 121 Sample Final Examination December 2013

UNIVERSITY OF WISCONSIN MADISON

CS/COE0447: Computer Organization

UNIVERSITI TENAGA NASIONAL. College of Information Technology

Contents. Chapter 3 Combinational Circuits Page 1 of 36

1 Boolean Algebra Simplification

We are here. Assembly Language. Processors Arithmetic Logic Units. Finite State Machines. Circuits Gates. Transistors

Written exam for IE1204/5 Digital Design with solutions Thursday 29/

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING CS6201 DIGITAL PRINCIPLES AND SYSTEM DESIGN

CPE/EE 422/522. Chapter 1 - Review of Logic Design Fundamentals. Dr. Rhonda Kay Gaede UAH. 1.1 Combinational Logic

Quiz 2 Solutions Room 10 Evans Hall, 2:10pm Tuesday April 2 (Open Katz only, Calculators OK, 1hr 20mins)

CMPE12 - Notes chapter 1. Digital Logic. (Textbook Chapter 3)

Save from: cs. Logic design 1 st Class أستاذ المادة: د. عماد

ECE 545 Digital System Design with VHDL Lecture 1A. Digital Logic Refresher Part A Combinational Logic Building Blocks

Appendix B. Review of Digital Logic. Baback Izadi Division of Engineering Programs

Combinatorial Logic Design Principles

CSC9R6 Computer Design. Practical Digital Logic

E&CE 223 Digital Circuits & Systems. Lecture Transparencies (Boolean Algebra & Logic Gates) M. Sachdev. Section 2: Boolean Algebra & Logic Gates

0 Sets and Induction. Sets

( c) Give logic symbol, Truth table and circuit diagram for a clocked SR flip-flop. A combinational circuit is defined by the function

CMPE12 - Notes chapter 2. Digital Logic. (Textbook Chapters and 2.1)"

DIGITAL LOGIC CIRCUITS

Department of Electrical & Electronics EE-333 DIGITAL SYSTEMS

Mealy & Moore Machines

Numbers and Arithmetic

L4: Karnaugh diagrams, two-, and multi-level minimization. Elena Dubrova KTH / ICT / ES

CSE 140L Spring 2010 Lab 1 Assignment Due beginning of the class on 14 th April

Chapter 5 Synchronous Sequential Logic

DO NOT COPY DO NOT COPY

II. COMBINATIONAL LOGIC DESIGN. - algebra defined on a set of 2 elements, {0, 1}, with binary operators multiply (AND), add (OR), and invert (NOT):

EECS150 - Digital Design Lecture 23 - FFs revisited, FIFOs, ECCs, LSFRs. Cross-coupled NOR gates

Vidyalankar S.E. Sem. III [CMPN] Digital Logic Design and Analysis Prelim Question Paper Solution

CS/EE 181a 2010/11 Lecture 4

Gate-Level Minimization

Computer Science Final Examination Friday December 14 th 2001

Outline. policies for the first part. with some potential answers... MCS 260 Lecture 10.0 Introduction to Computer Science Jan Verschelde, 9 July 2014

ENG2410 Digital Design Combinational Logic Circuits

SAMPLE ANSWERS MARKER COPY

Boolean Algebra and Digital Logic

Outcomes. Spiral 1 / Unit 5. Logic Function Synthesis KARNAUGH MAPS. Karnaugh Maps

1. Consider the conditional E = p q r. Use de Morgan s laws to write simplified versions of the following : The negation of E : 5 points

Spiral 1 / Unit 5. Karnaugh Maps

Chapter 2 (Lect 2) Canonical and Standard Forms. Standard Form. Other Logic Operators Logic Gates. Sum of Minterms Product of Maxterms

CprE 281: Digital Logic

Transcription:

CST0.2017.2.1 COMPUTER SCIENCE TRIPOS Part IA Thursday 8 June 2017 1.30 to 4.30 COMPUTER SCIENCE Paper 2 Answer one question from each of Sections A, B and C, and two questions from Section D. Submit the answers in five separate bundles, each with its own cover sheet. On each cover sheet, write the numbers of all attempted questions, and circle the number of the question attached. You may not start to read the questions printed on the subsequent pages of this question paper until instructed that you may do so by the Invigilator STATIONERY REQUIREMENTS Script paper Blue cover sheets Tags SPECIAL REQUIREMENTS Approved calculator permitted

CST0.2017.2.2 SECTION A 1 Digital Electronics (a) Briefly describe the main feature of a combinational logic block. [2 marks] (b) Use Boolean algebra to simplify the following expression W = A.B.C.D.E + A.C.D + A.C.F.G.H + A.B.C.D.E + A.C.D.E + E.H in sum of products form. Hint: X.Y + X.Z = X.Y + X.Z + Y.Z (c) A 2-bit binary adder sums two numbers, A 1 A 0 and B 1 B 0 to yield the unsigned result Y 2 Y 1 Y 0, where the zero subscript indicates the least significant bit (LSB). (i) Write down the truth table for the required outputs Y 2, Y 1 and Y 0. (ii) Using a Karnaugh map (K map) or otherwise, give the simplified sum of products expression for Y 2. (iii) Using a K map or otherwise, determine a simplified product of sums expression for Y 2 and show how the circuit can be implemented using only NOR gates (of any number of inputs). [7 marks] (d) Simplify the following four variable function F (A, B, C, D) using the Quine- McCluskey (Q-M) method: Minterms: A.B.C.D, A.B.C.D, A.B.C.D, A.B.C.D, A.B.C.D, A.B.C.D Don t cares: A.B.C.D, A.B.C.D, A.B.C.D [7 marks] 2

CST0.2017.2.3 2 Digital Electronics (a) Give the truth table for an RS Latch implemented using two cross coupled NOR gates and determine the state diagram for the Q output. [6 marks] (b) Give the truth table for a 2-to-4 decoder (i.e., 2 control inputs, S 1, S 0, and 4 outputs, Q 3, Q 2, Q 1, Q 0 ) and show how it can be implemented using 2-input NOR and NOT gates. (c) Show how the 2-to-4 decoder in part (b ) can be used to implement a 4-to-1 multiplexor (i.e., 4 inputs, 2 control inputs and 1 output) using only NAND gates for the additional combinational logic required. (d) (i) Write down the state transition table corresponding to the following state diagram where [Q B Q A ] are the current state, B and A are the inputs, and X and Y are the outputs. (ii) Show how two D-type flip flops and two 4-to-1 multiplexors can be used to implement the Mealy machine given in the state diagram in part (d )(i ). [6 marks] 3 (TURN OVER)

CST0.2017.2.4 SECTION B 3 Operating Systems (a) What is the CPU IO burst cycle? How does it motivate multi-programming? What does it mean for a process to be CPU bound or IO bound? [6 marks] (b) Consider a single processor system supporting two running processes, A and B, with the following sequential execution patterns: A: [CPU 8 ms; IO 1 ms; CPU 8 ms; IO 1 ms; CPU 8 ms] B: [CPU 2 ms; IO 1 ms; CPU 2 ms; IO 1 ms; CPU 2 ms] Assume that IO operations do not interfere with each other and are blocking, and that scheduling and context switch times are negligible. (i) What is the total elapsed time for the two processes to run to completion? [2 marks] (ii) Assume the system runs a non-preemptive scheduler where processes are scheduled in the order in which they become runnable, and that B takes priority over A in the event of a tie. Give the combined execution pattern of the two processes in the format as in part (b), and determine the total elapsed time for the two processes to run to completion. [5 marks] (iii) Repeat part (b)(ii) with a pre-emptive scheduler operating with a time slice of 4 ms. [5 marks] (iv) What are the costs and the benefits of a pre-emptive over a non-preemptive scheduler for this workload, which would you choose, and why? [2 marks] 4

CST0.2017.2.5 4 Operating Systems (a) The operating system typically provides each process with the illusion that it runs in a contiguous piece of memory. State the problem of external fragmentation in memory where processes have variably sized memory partitions. Describe how paged virtual memory solves this problem, and any time and space costs it introduces. (b) Consider a 64 bit machine architecture providing 48 bit virtual addressing where the operating system uses a 4-level page table structure where a page is 4096 bytes and each page table entry is 8 bytes in size. (i) Show how the virtual address 0x00be.efc0.ffee is mapped to a physical address using the 4-level page table. You should give the size of each level in the page table in terms of both bytes and entries, as well as the size of a page table. [6 marks] (ii) Assume a memory access takes 40 ns, and the machine provides a Translation Lookaside Buffer (TLB) with a hit rate of 90% and a search time of 10 ns. What is the effective memory access time? (iii) Assume that a naive operating system designer instead proposes to use only a single level of page table structure. Show how this will affect both the space overheads of paging and the effective memory access time. Indicate whether a single level of page table is practical in this system. [3 marks] (c) Consider a system where each process has three distinct memory areas requiring distinct access permissions. How do the space and time overheads due to paging change if the system moves from using small (e.g., 2 12 byte) pages to using large (e.g., 2 22 byte) pages? [3 marks] 5 (TURN OVER)

CST0.2017.2.6 SECTION C 5 Software and Security Engineering The public-key Needham-Schroeder protocol is as follows: A B : {NA, A} KB B A : {NA, NB} KA A B : {NB} KB (a) Explain the notation used and the purpose of the protocol. (b) What is wrong with this as a protocol design and how might this flaw be fixed? [10 marks] (c) What would we still have to check about an implementation? [6 marks] 6 Software and Security Engineering (a) Explain the difference between redundancy, backup and fallback. (b) Give an example of a failure that cannot be mitigated by backup. (c) Give two examples of systems where managing redundancy is easy, and two where it is hard. [8 marks] (d) Can you suggest one or more general principles for distinguishing the cases in part (c) above? 6

CST0.2017.2.7 SECTION D 7 Discrete Mathematics (a) (i) Calculate gcd(144, 77), the greatest common divisor of 144 and 77, as an integer linear combination of 144 and 77. (ii) What is the multiplicative inverse of 77 in Z 144 inverse of 67 in Z 77? and the multiplicative [2 marks] (iii) Describe all integers x that solve the following two congruences { 77 x 1 (mod 144) 67 x 3 (mod 77) Indicate how one may calculate the least natural number solution to the above. Justify your answers. (b) For a string w {1, 2}, let (w) N denote the sum of all the numbers in it. For instance, (ε) = 0 for ε the null string, and (1212) = 6. For every n N, define S n = { w {1, 2} (w) = n }. In particular, ε S 0 and 1212 S 6. (i) List the elements of S n for each n {0, 1, 2, 3, 4, 5}. [2 marks] (ii) What is the cardinality of S n for each n N? Prove your claim. [5 marks] (iii) For all m, n N, define a bijective function ( (Sm+1 S n+1 ) (S m S n ) ) S m+n+2 [3 marks] 7 (TURN OVER)

CST0.2017.2.8 8 Discrete Mathematics (a) For a non-empty tuple of positive integers a 1,..., a n, let CD(a 1,..., a n ) = { d N : 1 i n. d a i } be the set of natural numbers that are common divisors of all a 1,..., a n. (i) Without using the Fundamental Theorem of Arithmetic, prove that for positive integers a and a, if CD(a, a ) = {1} then, for all integers k, (a a ) k a k a k (ii) Either prove or disprove that, for all natural numbers n 2 and all tuples of positive integers a 1,..., a n, if CD(a 1,..., a n ) = {1} then, for all integers k, (a 1... a n ) k = a 1 k... a n k. [3 marks] (iii) Either prove or disprove that, for all natural numbers n 2 and all tuples of positive integers a 1,..., a n, if CD(a 1,..., a n ) = {1} then, for all integers k, a 1 k... a n k = (a 1... a n ) k. [3 marks] (b) Either prove or disprove that for all sets A, B, X, Y, ( A = X B = Y ) = A B = Y X (c) (i) Define the notion of a surjective function between two sets. [2 marks] (ii) State whether or not the function f : N {n N n 1} defined by f(0) = 1 { f(n)/2 if f(n) is even f(n + 1) = 9 f(n) + 1 otherwise (n N) is surjective. Prove your claim. 8

CST0.2017.2.9 9 Discrete Mathematics (a) Let r and s be solutions to the quadratic equation x 2 b x + c = 0. For n N, define d 0 = 0 d 1 = r s d n = b d n 1 c d n 2 (n 2) Prove that d n = r n s n for all n N. (b) Recall that a commutative monoid is a structure (M, 1, ) where M is a set, 1 is an element of M, and is a binary operation on M such that for all x, y, z in M. x 1 = x, x y = y x, (x y) z = x (y z) For a commutative monoid (M, 1, ), consider the structure (P(M), I, ) where P(M) is the powerset of M, I in P(M) is the singleton set {1}, and is the binary operation on P(M) given by for all X and Y in P(M). X Y = { m M x X. y Y. m = x y } Prove that (P(M), I, ) is a commutative monoid. [10 marks] (c) Define a section-retraction pair to be a pair of functions (s : A B, r : B A) such that r s = id A. (i) Prove that for every section-retraction pair (s, r), the section s is injective and the retraction r is surjective. (ii) Exhibit two sets A and B together with an injective function f : A B such that there is no function g : B A for which (f, g) is a sectionretraction pair. [2 marks] 9 (TURN OVER)

CST0.2017.2.10 10 Discrete Mathematics For each of the following languages over the alphabet {a, b}, state with justification whether the language is regular or not. m and n are natural numbers. (a) L 1 is the set of all strings with the number of a s in each being divisible by 3 and the number of b s being divisible by 7. (b) L 2 = {a, b} (c) L 3 = {a m b n m n} (d) L 4 = {uww R v for nonempty strings u, w, v {a, b} } w R is the string obtained by reversing the string w. (e) L 5 = {a n where there are twin primes p, p + 2, with p > n} Twin primes are pairs of primes which differ by 2, such as 5 and 7, or 17 and 19. It has been conjectured but never proven that there are infinitely many twin primes. END OF PAPER 10