 # Family Name: ________________________________ Given Names: ________________________________ Student Number: _____________________________

```Family Name: ________________________________
Given Names: ________________________________
Student Number: _____________________________
Signature: ___________________________________
The University of New South Wales
SAMPLE Final Examination
November 2008
ENGG1811 Computing for Engineers
Time allowed: 2 hours
Total number of questions: 44, in 3 Sections
Total number of marks: 100
No examination materials permitted
Calculators may not be used
Questions are not worth equal marks
Answer all questions except where noted in Section C
A table of VBA functions is included inside the front cover
This paper may not be retained by the candidate
Answers must be written in ink. Except where
they are expressly required, pencils may be used
only for drawing, sketching or graphical work.
ENGG1811 Sample Final Exam
TABLE OF VBA FUNCTIONS
Function call
Returns…
Int(num)
Largest integer ≤ num
num with fraction removed (truncates towards zero)
Absolute value of num (same type)
Numeric data in str converted to Double
val rounded to dp decimal places (Double)
num as a string
arg (number or string) as an integer, fraction truncated
Square root of num
e raised to the power of num
Natural logarithm of num
Sine or cosine of a in radians
Tangent of a in radians, arctangent of r
Next pseudo-random number between 0 and 1
Fix(num)
Abs(num)
Val(str)
Round(val, dp)
CStr(num)
CInt(arg)
Sqr(num)
Exp(num)
Log(num)
Sin(a), Cos(a)
Tan(a), Atn(r)
Rnd()
String functions
Len(str)
Number of characters in str
Mid(str,start,len)
Substring of str, beginning at start, length len
Mid(str,start)
Substring of str, beginning at start to end of string
Left(str,len)
First len characters of str, all of str if len > Len(str)
Right(str,len)
Last len characters of str, all of str if len > Len(str)
Asc(str)
Character code for first character in str
Chr(code)
Unit string containing character with specified code
LCase(str)
str with all upper-case chars converted to lower case
UCase(str)
str with all lower-case chars converted to upper case
Trim(str)
str with spaces removed from both ends
InStr(str,match)
First position in str where match occurs as a substring
Replace(str,match,rep) str with all occurrences of match replaced by rep (other
arguments are possible)
String(str,n)
n copies of first character of str
Page 2 of 19
ENGG1811 Sample Final Exam
Section A: Multiple Choice Questions
Answer the questions in this section on the answer sheet provided, NOT on this paper.
Each question has four alternatives. Once you have chosen an alternative, fill in the
selected letter (e.g., “B)”) against the question number on the multiple-choice sheet. Be
careful that you fill each answer in on the correct row of the multiple-choice sheet, and
erase any stray marks.
Each question in this section is worth 1 (one) mark. There is no additional penalty for
answering a question incorrectly. It is recommended that you spend no more than 30
minutes on this section.
A1.
What kind of communication does the Internet use?
A)
B)
C)
D)
A2.
A)
B)
C)
D)
A3.
Cookies are stored on a server for use by a client
Cookies are stored on a client and retrieved by a server
Cookies are placed on a server by a client
Cookies cannot be removed from a client’s computer
Suppose that in a MS Excel spreadsheet cells A1, B1 and C1 contain the values
2, 3, and 4 respectively. What value will be displayed in a cell containing the
formula
=(A1+C\$1)/\$A\$1+B1
A)
B)
C)
D)
A4.
Synchronous
Point-to-point
2
4
6
the formula is invalid
Suppose you want to design a query in a MS Access database that requests input
from the user when the query is run, and then displays records selected on the
basis of the user’s input. What kind of query would you use?
A)
B)
C)
D)
Action query
Append query
Parameter query
Question query
Page 3 of 19
ENGG1811 Sample Final Exam
A5.
Consider the following portion of a MS Excel worksheet.
Suppose that cell E4 contains the formula =\$B2+C\$3 and that this cell is now
copied to cell D5. What value will be shown in cell D5?
A)
B)
C)
D)
A6.
Which of the following is not a valid formula when typed into the cell L5 in a
MS Excel worksheet?
A)
B)
C)
D)
A7.
=AVERAGE(D6:D11)
=AVERAGE(A\$1:B4, D2:\$E\$5)
=AVERAGE(A2:10D)
=AVERAGE(A2)
Which one of the following statements is false?
A)
B)
C)
D)
A8.
9
10
14
16
Firewalls are used to protect computers from fire.
Cluster computing uses homogenous hardware.
Internet Protocol Version 6 (IPv6) is uses 16 byte IP-addresses.
IP packets (of the same message) may take different routes across the
Internet.
In MS Excel, the Histogram tool can be used to…
A)
B)
C)
D)
display historical commands.
display historical calculations.
calculate and display correlations between two or more variables.
None of the above.
Page 4 of 19
ENGG1811 Sample Final Exam
A9.
Consider the following portion of a MS Excel worksheet.
Suppose that cell C1 contains the formula =IF(\$B\$1>35,"Hot","Cool")
and that this cell is now copied to cell C2. What value will be shown in cell C2?
A)
B)
C)
D)
A10.
In MS Access, which one of the following statements is true for the wildcard
character * (asterisk)?
A)
B)
C)
D)
A11.
Embedded Systems are general purpose systems.
Embedded Systems use embedded input from a user.
Embedded systems are commonly used for controlling devices.
Embedded systems can be easily reprogrammed for a new task.
Which one of the following statements is true?
A)
B)
C)
D)
A13.
It matches 1 or more characters.
It matches 0 or more spaces.
It matches 0 or more strings.
It matches 0 or more characters.
Which one of the following statements is true?
A)
B)
C)
D)
A12.
Hot
Cool
Error
None of the above
RFID tags require laser scanning.
A passive RFID tag does not use an antenna.
An active RFID tag does not require a power source.
Normally passive RFID tags store ID numbers.
The original version of ASCII used,
A)
B)
C)
D)
4-bit code
7-bit code
8-bit code
16-bit code
Page 5 of 19
ENGG1811 Sample Final Exam
A14.
Another term for database redundancy is,
A)
B)
C)
D)
A15.
DHCP (Dynamic Host Computer Protocol):
A)
B)
C)
D)
A16.
duplication
omission
implementation
assessment
makes sure a computer gets the same IP every time it connects to the network
lets the computer select its own IP address when it connects to the network
assigns an IP address to the computer from a list
maintains a LAN’s connection to the Internet
Which one of the following statements is true?
A) forward chaining starts with outcomes and tries to find possible causes for the
outcomes.
B) expert systems tend to cover a wide area of expertise in many domains
C) machine learning algorithms try to build models from observations
D) its easy to acquire tacit knowledge
A17.
Enforcing data types while designing a database helps us to:
A) avoid possible data entry errors
B) reduce redundancy in a database
C) save data types for future use
D) none of the above
A18.
In SQL, the WHERE clause specifies:
A) a list of fields to be used
B) a list of tables to be used
C) constraints on rows
D) constraints on columns
Page 6 of 19
ENGG1811 Sample Final Exam
A19.
The following table lists the arithmetic operators used in Visual Basic for
Applications (VBA), in decreasing order of precedence.
()
^
+ - (unary: sign)
* /
\
Mod
What is the value of this constant expression?
4 * 9 ^ 1 / 2
A)
B)
C)
D)
A20.
Which of the following statements about ByRef and ByVal is false?
A)
B)
C)
D)
A21.
6
12
18
36
If neither keyword is specified, ByVal is assumed
ByRef and ByVal are only used in procedure parameter lists
Variables passed by reference can be changed by the procedure
A parameter prefixed by ByVal is initialised from the value of the argument
We want to count the number of sheets in the active workbook whose names
begin with Temp, using a For statement of the form:
Dim wks As Worksheet
Dim numTemps As Integer
numTemps = 0
For ___________________________________
If wks.Name Like "Temp*" Then
numTemps = numTemps + 1
End If
Next wks
What is the correct first line of the For statement for the algorithm to work?
A) For wks = 1 To ActiveWorkbook.Sheets
B) For Each wks In ActiveWorkbook.Sheets
C) For wks = 1 To ActiveWorkbook.Sheets(Count)
D) For Each wks = 1 To ActiveWorkbook.Sheets.Count
Page 7 of 19
ENGG1811 Sample Final Exam
A22.
What are the values of x and y after this While loop terminates? x and y are
variables of type Integer.
x = 0: y = 0
While x < 5
x = x + 1
y = x + y
Wend
A)
B)
C)
D)
A23.
x
x
x
x
=
=
=
=
4,
5,
5,
6,
y
y
y
y
=
=
=
=
10
10
15
21
If blnA and blnB are Boolean variables, which expression is equivalent to
Not (blnA Or Not blnB)
A)
B)
C)
D)
A24.
Not
Not
Not
Not
blnA
blnA
blnA
blnA
Or Not blnB
Or blnB
And Not blnB
And blnB
Which of these statements about tail recursion is true?
A)
B)
C)
D)
Tail recursion only applies to functions, not subprograms.
Tail recursion occurs when there are multiple recursive calls in a function.
Tail recursion can be replaced by iteration to produce equivalent results.
The recursive definition of the Fibonacci sequence can be directly expressed
using tail recursion.
Page 8 of 19
ENGG1811 Sample Final Exam
Answer the 16 questions (totalling 40 marks) in this section using the space provided on
this question paper.
In this section, questions are not worth equal marks. The marks for each question are
indicated after the question number. You should aim to spend about 45 minutes on this
section (about 1 minute per mark).
B1.
(2 marks) Describe the two most important advantages of using Distributed/Grid
Computing.
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
__________________________________________________________
B2.
(2 marks) What is the main function of DNS?
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
__________________________________________________________
B3.
(3 marks) Briefly outline two applications of Public Key systems.
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
Page 9 of 19
ENGG1811 Sample Final Exam
B4.
(2 marks) Provide one major difference between synchronous and asynchronous
communication.
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
__________________________________________________________
B5.
(3 marks) What is the purpose of conditional formatting in a MS Excel
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
__________________________________________________________
B6.
(2 marks) Provide one major difference between ASCII and Unicode encodings.
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
Page 10 of 19
ENGG1811 Sample Final Exam
B7.
(2 marks) Provide two major differences between sequential computing and
parallel computing.
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
B8.
(2 marks) Briefly outline two different approaches we can use to solve singlevariable equations in MS Excel.
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
B9.
(2 marks) In MS Excel, what does the tool named “Descriptive Statistics” offer?
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
Page 11 of 19
ENGG1811 Sample Final Exam
B10. (5 marks) You have been asked to develop a spreadsheet to store and analyse
marks for students in a given course. You need to store the following marks for
each student in a course: Assignment_1, Assignment_2 and Exam. Assignment_1
and Assignment_2 marks are out of 25 each, and Exam marks are out of 50.
Assume that there are 30 students in the course.
You need to do the following analysis:
•
•
•
Calculate Total marks using the following formula:
Total = Assignment_1 + Assignment_2 + Exam
Find the top 10 students, based on Total marks
Find students whose Exam marks are greater than the average Exam
marks for the entire class.
Draw a diagram illustrating the design of your spreadsheet application. Indicate any
formulas or features of MS Excel that you would use.
Page 12 of 19
ENGG1811 Sample Final Exam
B11.
(2 marks) Explain the difference between the concepts of “Expert Systems” and
“Machine Learning Systems”, in Artificial Intelligence.
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
B12.
(2 marks) Briefly explain the role of a “digital certificate” in Public Key
Infrastructure (PKI).
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
Page 13 of 19
ENGG1811 Sample Final Exam
B13.
(4 marks) Assume the active worksheet contains a square matrix of numbers in
the upper left corner similar to that shown below. Write statements that find the
largest value in any cell on the major diagonal (these cells are shown shaded:
A1, B2, C3 etc), and assigns it to the variable diagmax.
The first empty cell on the diagonal (in this case F6) terminates the process.
Declare any other variables you need.
Page 14 of 19
ENGG1811 Sample Final Exam
B14.
(2 marks) Explain how to place a spin button on a sheet and allow it to control a
cell on the sheet (say D5). What restrictions are there on the value displayed?
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
B15.
(3 marks) Consider the following function, which is intended to determine
whether a string is palindromic (exactly the same when written backward as
forward). It has one syntax error (that Debug/Compile would find), one semantic
error that prevents the function from returning anything and one logical error.
Identify each error and describe it in a few words only.
' returns True if str is palindromic, else False
Function IsPal(str As String) As Boolean
Dim pos As Integer
' next position in str
Dim c1 As String
' single characters
Dim slen As Integer
' length of str
' Alg: match character with the one at opposite end
slen = Len(str)
For pos = 1 To slen \ 2
c1 = Mid(str, pos, 1) ' character at pos
c2 = Mid(str, slen-pos, 1)
' character at corresponding position from end
If c1 <> c2 Then
IsPal = False
Exit Function
End If
Next pos
End Function
Error 1 (syntax): ________________________________________________________
________________________________________________________________
Error 2 (semantic): ______________________________________________________
________________________________________________________________
Error 3 (logical): ________________________________________________________
________________________________________________________________
Page 15 of 19
ENGG1811 Sample Final Exam
B16.
(2 marks) In the space below write statements that extract the character exactly
in the middle of a string str, provided the string has an odd number of
characters, and assigns it to strMiddle. If str has an even number of
characters assign the empty string instead.
Examples:
str = "car"
strMiddle = "a"
str = "cart"
strMiddle = ""
Page 16 of 19
ENGG1811 Sample Final Exam
Section C: Programming Questions
This section is worth 36 marks. Answer 3 questions only. Each question is worth 12
marks, so it doesn’t matter which three you attempt.
C1.
The Harvard Step Fitness Test estimates the fitness of an athlete by the
following procedure: the athlete steps up and down from a standard gym bench
once every two seconds for 5 minutes. After this the athlete’s pulse (in integral
beats per minutes) is taken after 1 minute, 2 minutes and 3 minutes. Call these
values p1, p2, and p3. The fitness score s is calculated using this formula
s=
30000
p1 + p 2 + p 3
A 16-year old female athlete is considered to have an Excellent fitness if s is 86
or more, and Poor fitness if s is less than 50.
Write a VBA Function that accepts the three pulse rates and returns one of the
strings "Poor", "OK", or "Excellent", according to the calculated score.
You may use the header as shown below, and you may (just this once!) use
literal constants in the function.
Function Harvard16Female(p1 As Integer, _
p2 As Integer, p3 As Integer) As String
C2.
Write a VBA subprogram that writes a table of squares and cubes in rows 2 to
21 of the active sheet, the first few rows of which are show below:
1
2
3
4
5
6
7
C
A
B
n
n
1
2
3
4
5
6
2
n3
1
4
9
16
25
36
1
8
27
64
125
216
Define and use constants where appropriate.
Page 17 of 19
ENGG1811 Sample Final Exam
C3.
Many functions can be approximated by their Taylor Series expansion. The
expansion of sin x is given by the formula
sin x = x −
x3 x5 x7
+
−
+ ...
3! 5! 7!
For example, this is the approximation using the first four terms of the formula:
http://en.wikipedia.org/wiki/Image:Taylorsine.svg
Write a VBA function that approximates sin x using a set number of initial terms
of the series as specified by a parameter. Hint: consider how each term is
derived from the previous one.
Page 18 of 19
ENGG1811 Sample Final Exam
C4.
Write a VBA subprogram that draws a thin red cross using the two diagonal
borders in all empty cells in row 1 of the active sheet. Your subprogram should
consider all 256 columns.
the user puts a applies a thin red border to the left of cell E15:
Range("E15").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 3
End With
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Your subprogram should manipulate the cells directly rather than use the
Selection object.
END OF EXAMINATION
Page 19 of 19
``` # How to reach our office in Munich Accenture Anni-Albers-Straße 11 80807 München # 12. A common metal is known to have a cubic... has a density of 7.20 g/cm # Input-Sensitive Profiling (or how to find the big-Oh of a program?)   