Midterm Examination - October 1996
APS105F - Computer Fundamentals
Examiner - Paul Chow
1 [15] -10pt(100,25)
2 [20] -10pt(100,25)
3 [20] -10pt(100,25)
4 [15] -10pt(100,25)
5 [10] -10pt(100,25)
6 [20] -10pt(100,25)
Total [100] -10pt(100,25)
Print:
First Name:Last Name:
Login ID:
Student Number:
mkdir assignments cd assignments cp /usr/copy/aps105/sort.t mysort.t mkdir ~/stuff cp /usr/copy/aps105/faces.t ~/stuff/myfaces.t cd .. mv ~/stuff/myfaces.t ~/assignments/newfaces.t rmdir ~/stuff pwd
What is the output of the last command? Hint: It starts with `/'.
-10pt(300,25)
After you type in your password, what does the system do before you are allowed to login?
procedure P(x : int) ... end P procedure Q(var y : int) ... end Q var A,B,C : int A := 5 B := 7 P(A) Q(B) Q(B-A) P(A+B) Q(P) P(12) Q(10)
var A : int var B : int var D : int procedure P (A : int, var C : int) var tmp : int B := B + 30 if A < B then tmp := A else tmp := B end if C := tmp end P A := 5 B := 42 P (A, D) put A, ",", B, ",", D
What is the final value of A? -10pt(100,25)
What is the final value of B? -10pt(100,25)
What is the final value of D? -10pt(100,25)
0 F 17 Cwhere there is an integer followed by a letter, which will be an F or a C for Fahrenheit and Celsius, respectively. The number and letter will be separated by a space. The program ends when the letter is not F or C. Note that .
for i : 1 .. 12 x := x + 1 end for
for decreasing j : N .. 1 by 2 x := x + 1 end for
for i : 1 .. N by 7 x := x + 1 end for
for i : 1 .. N for j : 1 .. N sum := 0 for k : 1 .. N sum := sum + A(i,k) * B(k,j) end for C(i,j) := sum end for end for
What is the computational complexity of this algorithm using the ``O'' notation?
-10pt(100,50)
Explain/show how you derived your answer.
Question 6 continued...