Name: Signature:
Student ID Number:
CPSC 344 200506 Term 1 Midterm Exam 50 minutes SOLUTIONS + comments
Department of Computer Science University of British Columbia K. MacLean Exam Instructions (read carefully): 1. Immediately sign the first page of the
344 Midterm
2008
1.
a. HCI human error as a myth because people never make mistakes
False
 People always make mistakes, which is why human error is something designers and
developers try to fix. It is not a myth.
b. Mental visual image we hold of a scene
CPSC 313 06W Term 2 Problem Set #5  Solution 1. bool implies = !a  b; 2. The four signals divide into 2 classes, sort0 and sort3 choose the minimum or maximum elements, which look like this. sort3 is identical to sort0, with the comparisons changed from
CS 313, Winter 2006  Term 2
Assignment 5: HCL and y86
Assigned: February 26, Due: Sunday, March 4, 11:59PM (with the
usual 13 hour grace period)
Instructions: Hand in all solutions on paper.
1. Write an HCL expression for a boolean signal implies, true w
CS 313, Winter 2006  Term 2
Assignment 4: Defusing a Binary Bomb
Assigned: February 5, Due: Sunday, February 18, 11:59:59 PM
1
Introduction
The nefarious Dr. Evil has planted a slew of binary bombs on our machines. A binary bomb is a program
that consist
CPSC 313
06W Term 2
Problem Set #3  Solution
1. (a) int gcd(int a, int b)
cfw_
if (a = b)
return a;
else if (a > b)
return gcd(a  b, b);
else
return gcd(a, b  a);
.file
"gcdrec.c"
.text
.p2align 4,15
.globl gcd
.type
gcd, @function
gcd:
pushl
%ebp
mov
CPSC 313
06W Term 2
Problem Set #3
Due: Sunday, February 4, 2007 at 11:59 PM (thirteenhour grace period)
1. Write in C a function int gcd(int x, int y); that returns the greatest common divisor
of its two arguments. You may assume that they are both posi
CPSC 313
06W Term 2
Problem Set #2 Solution
1. The only illegal operation is taking the address of i, since it is in a register. Note the similarity of all
of the accesses to the variables that are stored in memory: a, l, and g. Despite the dierences in h
CPSC 313
06W Term 2
Problem Set #2
Due: Sunday, January 28, 2006 at 11:59 PM (thirteenhour grace period)
All of your solutions should be turned in on paper.
1. Variables declared in a C program can be stored in either registers or memory, and if in
memor
CPSC 313
06W Term 2
Problem Set #1
Due: Sunday, January 21, 2006 at 11: 59 PM (thirteenhour grace period)
Instructions: Hand all of your solutions in on paper.
1. On an IA32 machine (e.g., lin01.ugrad.cs.ubc.ca), using gcc, compile the following C progra
CPSC 313, 06w Term 2 Midterm 2 Solutions
Date: March 23, 2007; Instructor: Norm Hutchinson
1. (12 marks)
Short answers.
1a. (2 marks) Describe the difference between stalling and creating a bubble.
Stalling means that an instruction remains in a particula
CPSC 313, Winter 2006  Term 2
Understanding the Y86 Architecture
and its Sequential Implementation
Assigned: March 2, Due: Sunday, March 11, 11:59PM
For this problem set, you may either work by yourself or in a group of two. If you choose to work in a
gr
CPSC 313, Winter 2006  Term 2
Pipelining
Assigned: March 9, Due: Sunday, March 18, 11:59PM
All of these questions are to be handed in on paper.
1. Consider a vestage pipeline with stage gate delays of 150 ps, 75 ps, 100 ps, 100 ps and 175 ps and
a memor
Name:
Student ID Number:
Signature:
CPSC 344 2008W1 Midterm Exam
90 minutes
Department of Computer Science
University of British Columbia
K. MacLean
Exam Instructions (read carefully):
1. Sign this page in the space provided to indicate your
agreement wit
ame: Sample Soln (yours may differ!)
Student ID umber:
Signature:
CPSC 344, 200708 Winter Term 1 Midterm Exam
90 minutes
Department of Computer Science
University of British Columbia
S. Wolfman
Exam Instructions (read carefully):
1. Sign this page in the
ame: Signature:
Student ID umber:
CPSC 344, 200708 Winter Term 1 Midterm Exam 90 minutes
Department of Computer Science University of British Columbia S. Wolfman Exam Instructions (read carefully): 1. Sign this page in the space provided to indicate your
Name:
Student ID Number:
Signature:
CPSC 344 200607 (T1) Final Exam
[PARTIAL] SOLUTIONS
Department of Computer Science
University of British Columbia
K. MacLean
Exam Instructions (read carefully):
1. Immediately sign the first page of the exam with
your
Name: Signature:
Student ID Number:
CPSC 344 200506 Term 1 Midterm Exam 50 minutes
Department of Computer Science University of British Columbia K. MacLean Exam Instructions (read carefully): 1. Immediately sign the first page of the exam with your signa
CPSC 313
06W Term 2
Problem Set #9  Solution
1.
A. 00 0010 0111 1100
B.
VPN
TLBI
TLBT
TLB hit?
page fault?
PPN
0x9
0x1
0x2
N
N
0x17
C. 0101 1111 1100
D.
CO
CI
CT
cache hit?
cache byte?
2.
0x0
0xf
0x17
N

A. 00 0011 1010 1001
B.
VPN
TLBI
TLBT
TLB hit?
pa
CPSC 313, Winter 2006  Term 2
Problem Set #9
Assigned: April 2
Due Wednesday, April 11, 13:00 pm (no grace period)
1. Textbook 10.11
2. Textbook 10.12
3. Textbook 10.13
4. Consider a virtualmemory system with the following parameters
PTBR = physical ad
CPSC 313
06W Term 2
Problem Set #8  Solution
1. SRAM stands for Static Random Access Memory. It can be typically found in caches, on or off the
core. It is fast and persistent, but it requires more transistors so is more expensive per unit of memory
that
CPSC 313, Winter 2006  Term 2
Problem Set #8
Assigned: March 26, Due: Sunday, April 1, 11:59PM
You will hand in all of your solutions to this problem set on paper.
1. What is SRAM? Where do you typically nd it? What is good about it? What is bad about it
CPSC 313
06W Term 2
Problem Set #7  Solution
1.
(a)
1
185ps
= 5.41 109 cycles per second or 5.41 GHz
(b) 5.41 Gops (instructions per second)
(c) 5 * 185 = 925 ps per instruction
(d)
1
i. 600ps = 1.66 109 cycles per second or 1.66 GHz
ii. 1.66 Gops (instr
CPSC 313, 06w Term 2 Midterm 2
Date: March 23, 2007; Instructor: Norm Hutchinson
This is a closed book exam; no notes; you may use a calculator if you wish. Answer in the space provided;
use the backs of pages if needed.
There are 6 questions on 8 pages,
CPSC 313, 06w Term 2 Midterm 1 Solutions
Date: February 9, 2007; Instructor: Norm Hutchinson
1. (8 marks)
Short answers.
1a.
(2 marks) Is the address of a global variable in a C program determined statically (before the
program runs) or dynamically (while
CPSC 313, 06w Term 2 Midterm 1
Date: February 9, 2007; Instructor: Norm Hutchinson
This is a closed book exam; no notes; no calculators. Answer in the space provided; use the backs of pages
if needed.
There are 6 questions on 4 pages, totaling 42 marks.
Y
CPSC 320 Sample Final Examination
December 2010
[10] 1. Answer each of the following questions with true or false. Give a short justication
for each of your answers.
[5] a. 6n O(5n )
This is false:
6n
6
lim n = lim
n 5
n + 5
= +
Solution :
n
which means t
CPSC 320 Sample Final Examination
December 2010
Name:
Signature:
Student ID:
You have 2.5 hours to write the 8 questions on this examination. A total of 100 marks are available.
Justify all of your answers, except if the question
says not to.
Question