Computer Science 61CL - Summer 1999 - Clancy - Final Exam

Computer Science 61CL - Summer 1999 - Clancy - Final Exam -...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
1 CS61C FINAL EXAM: 8/12/99 N. Isailovic Last name __________________________ First name __________________________ Student ID number _________________ Login: cs61c-_______ Please circle the last two letters of your login name. Abcdefghijklmnopqrstuvwxyz Discussion section meeting time ___________ TA's name __________________________ You are allowed to use two 8.5’’ x 11’’ double-sided handwritten pages of notes. No calculators! This booklet contains 13 numbered pages including the cover page plus photocopied pages from COD and the basic datapath design you are to use. Put all answers on these pages, please; don't hand in stray pieces of paper. The exam contains 7 substantive questions, the Signin Question, the statement immediately below (requiring a signature) and one extra credit question. You have three hours, so relax ---thisexamisn 't worth having a heart failure over. Good luck! I certify that my answers to this exam are all my own work. If I am taking this exam early, I certify that I shall not discuss the exam questions or answers with anyone until after the scheduled exam time. Signature __________________________________________________________ Question Name Time(minutes) Max Points Your points Signin 0 -1 to 0 Nested L oops 10 5 Cache 10 5 Vir tual M emor y 10 6 ALU Design 15 Datapath Design 25 20 Coding 30 Interrupts 30 14 Extra Credit 0 (1) Total 130 80
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CS61C Final Exam, Summer 1999 Your login: CS61C-_____ 2 Signin Question (-1 point if not followed): Fill out the front page correctly and write your login at the top of each of the pages. Circle your login initials so we can read them. Nested Loops Question (5 points)[10 minutes]: A matrix is a two-dimensional array. That is, a matrix is an array of elements, each of which is an array. Here is a sample matrix: [ a bcd ] [ e fgh ] [ i jkl ] [ m nop ] This matrix is a four-element array, the first element being the array [abcd] , the second element being the array [efgh] , the third element being the array [ijkl] , and the fourth element being the array [mnop] . In the C language, a matrix is accessed as a two-dimensional array. For example, suppose the above matrix/array were declared with the name mat in some C code. Then the phrase mat[1][2] would return element g , since this is the element in row 1 and column 2 of the matrix. You are given the task of writing a short nested loop which initializes each element of a particular matrix named TestMatrix . You know of two possible ways to write this loop. (Assume both i and j are already declared to be integers.) Option 1: for (i = 0; i < 1000; i++) { for (j = 0; j < 1000; j++) { TestMatrix[i][j]=i+j+1; } } Option 2: for (j = 0; j < 1000; j++) { for (i = 0; i < 1000; i++) { } } Which of these two loops would result in a more efficient initialization of TestMatrix? In other words, which loop would execute more quickly at run-time? Justify your answer using any knowledge you feel applies to this.
Background image of page 2
CS61C Final Exam, Summer 1999 Your login: CS61C-_____ 3 Cache Question (5 points)[10 minutes]: Imagine that you have a 16 KB direct-mapped cache with 8 word blocks.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 13

Computer Science 61CL - Summer 1999 - Clancy - Final Exam -...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online