159.102 Computer Science Fundamentals - Massey - Exam - S2 2018
159.102 Computer Science Fundamentals - Massey - Exam - S2 2018
159.102 Computer Science Fundamentals - Massey - Exam - S2 2018
102 CP
AKLI
MASSEY UNIVERSITY
AUCKLAND CAMPUS
EXAMINATION FOR
159.102 COMPUTER SCIENCE FUNDAMENTALS
Write your answers to all applicable questions in the Blue Answer Book supplied.
Students may NOT remove any part of this question paper from the exam room.
The exam paper will be made available on the University Library website.
Page 1 of 5 CoS
1802/159.102 CP
AKLI
1. (a) Describe two different causes of delay while reading data from
a hard drive. [2]
(b) Describe one way of minimising the delays in Question 1(a). [1]
(c) eBooks are typically about 200KBytes in size. If an eBook reader has
2GBytes of storage space, approximately how many books can be
stored on the reader? [1]
(e) List the sequence of steps that are performed by the BIOS when
a computer is switched on. [2]
(g) What characters are used for end-of-line in a Windows text file? [1]
(l) Describe the difference between a static and a dynamic library. [2]
Page 2 of 5 CoS
1802/159.102 CP
AKLI
2. (a) In a simplified empty file system, the file allocation table has 16 entries:
0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1
The first two entries (each with a value of 0) are special and are where the
FAT and the directory are stored. A normal entry with a value of 1 means that
the corresponding sector on the disk is free. A normal entry with a value of 0
signifies the end of a chain of sectors. When allocating a new sector the lowest
numbered free sector is always chosen. The directory, which contains the
filenames and initial sectors, is always sorted alphabetically on the filename.
What do the FAT and directory contain after each of the following actions:
(i) Files t1 (5 sectors), then t2 (2 sectors) are added. [1]
(ii) File t1 is reduced to 3 sectors. [1]
(iii) File t2 is extended to 6 sectors in total. [1]
(e) Write, as a decimal, the value of the 32-bit floating point number that is
represented by the hexadecimal number:
c102000016 [1]
(f) Declare a C structure that can contain data describing an Electric car:
its make (a string), its model (a string), its price in dollars,
its number plate (a string!), its colour ("red", "blue" etc.) and
the maximum number of kilometres it can go on a full charge. [1]
(h) Assume that you already have a 10-element array a of the above structure,
which has been initialised with the data of 10 different Electric cars.
Write a piece of C code that uses a loop to find the green car that can
go the most kilometres on a full charge.
Print the details of this car using your function in Question 2(g).
There will be a unique answer. [5]
Page 3 of 5 CoS
1802/159.102 CP
AKLI
(b) A stack of up to 100 integers can be created using an array and an index.
Name the three standard functions that are associated with stacks. [1]
(c) Allowing the user of the stack direct access to the index variable is not
considered good programming practice, and can be overcome if two extra
functions are provided to the user.
The average can be found by dividing the sum of all the numbers on the
stack by how many numbers were on the stack. [3]
(f) Assuming you have all the correct header files included and with the
variables defined in Question 3(e), which of the following statements will
generate a compile time error?
Page 4 of 5 CoS
1802/159.102 CP
AKLI
(iii) Why is there an & before the i in the call to scanf? [1]
(b) The permutations of a string, with no repeated letters, are all the different
strings that can be formed by interchanging the letters of the string.
otherwise start a for loop where an integer i runs from 0 to less than n.
Inside the loop:
(c) Using your function in Question 4(b) write a main function that prints all
the permutations of the string "abcd" using the length of the string
as the initial value for n. [2]
(d) What is the first permutation printed by the above program? [2]
+++++++
Page 5 of 5 CoS