0% found this document useful (0 votes)
105 views4 pages

University of Victoria Midterm Exam 1 January 30 2020 Computer Science 349A

This document is a midterm exam for a computer science course. It contains 3 questions assessing numeric approximation techniques, floating point arithmetic, and ternary floating point number representation. Question 1 has students use Euler's method to numerically approximate the concentration of a radioactive contaminant over time. Question 2 has students evaluate a function using floating point arithmetic and calculate relative error. Question 3 asks students to represent a number in ternary, identify the smallest positive non-zero number representable, and calculate the size of gaps between numbers in a given range using ternary floating point. The exam is 50 minutes long and contains 18 total marks across the 3 questions.

Uploaded by

Malcolm Fenelon
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
105 views4 pages

University of Victoria Midterm Exam 1 January 30 2020 Computer Science 349A

This document is a midterm exam for a computer science course. It contains 3 questions assessing numeric approximation techniques, floating point arithmetic, and ternary floating point number representation. Question 1 has students use Euler's method to numerically approximate the concentration of a radioactive contaminant over time. Question 2 has students evaluate a function using floating point arithmetic and calculate relative error. Question 3 asks students to represent a number in ternary, identify the smallest positive non-zero number representable, and calculate the size of gaps between numbers in a given range using ternary floating point. The exam is 50 minutes long and contains 18 total marks across the 3 questions.

Uploaded by

Malcolm Fenelon
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

UNIVERSITY OF VICTORIA

MIDTERM EXAM 1 JANUARY 30 2020


COMPUTER SCIENCE 349A

NAME: STUDENT NO.


INSTRUCTOR: Rich Little
. DURATION: 50 minutes
TO BE ANSWERED ON THE PAPER
STUDENTS MUST COUNT THE NUMBER OF PAGES IN THIS EXAMINATION PAPER BEFORE
BEGINNING TO WRITE, AND REPORT ANY DISCREPANCY IMMEDIATELY TO ME.
PLEASE PUT YOUR NAME ON THE VERY BACK SHEET AS WELL.
THIS QUESTION PAPER HAS 4, SINGLE-SIDED PAGES. YOU MAY USE THE BACK
PAGES.
NOTES: (0) CLOSED BOOK EXAM; ONLY BASIC CALCULATORS ARE ALLOWED, (1)
ANSWER ALL QUESTIONS, (2) THERE ARE A TOTAL OF 18 MARKS, (3) THE BACK
PAGE OF EACH QUESTION MAY BE USED FOR YOUR ANSWERS. (4) STUDENTS ARE
ALLOWED ONE 8.5-by-11 INCH SHEET CONTAINING ANY INFORMATION — BOTH
SIDES CAN BE USED.

Question Possible marks Actual marks


1 6
2 6
3 6
Total 18
JAN 30, 2020 CSC 349A, 2

1. The amount of a uniformly distributed radioactive contaminant contained in a closed re-


actor is measured by its concentration c in becquerels/litre (Bq/L). The contaminant de-
creases at a decay rate proportional to its concentration, given by differential equation,

dc
= −kc
dt
where t is time in days (d) and k is a constant with units of inverse days (d−1 ).

(a) [4 points] Use Euler’s method to derive a numeric approximation to the concentration
of a radiactive contaminant at time ti+1 days, c(ti+1 ), given the concentration at time
ti days, c(ti ).
(b) [2 points] Let k = 0.175d−1 and suppose that c(0) = 100 Bq/L. Approximate the
concentration at time 0.1d using your method from (a).
JAN 30, 2020 CSC 349A, 3

2. (a) [4 points] Evaluate


y
f (x, y) = p
x2 + y 2 + x
using b = 10, k = 4 floating-point arithmetic with chopping where x = −12.34 and
y = 0.9555.
(b) [2 points] Given that the actual value is f (−12.34, 0.9555) = 25.868066..., what is the
relative error of your approxiamtion in (a)?
JAN 30, 2020 CSC 349A, 4

3. Consider a base-3, ternary, normalized floating-point number system. Analogous to a bit,


a ternary digit is a trit. Assume that a hypothetical ternary computer uses the following
floating-point representation:

sm se t1 t2 t3 t4 e1 e2

where sm is the sign of the mantissa and se is the sign of the exponent (0 for positive, 1
for negative), ti are the trits of the mantissa, and ej are the trits of the exponent.

(a) [2 points] What is the computer representation of 3(10) + 91 (10) in this system?


(b) [2 points] What is the smallest positive non-zero number that can be represented in
this system in decimal?
(c) [2 points] What is the size of the gap between any two consecutive numbers in the
interval 9(10) and 27(10) in this ternary floating-point system? Your answer should be
in decimal.

You might also like