You are on page 1of 10

(COMP1022Q)[2013](f)midterm_review_questions~=bcidkjdy^_71086.pdf downloaded by bwdawani from http://petergao.net/ustpastpaper/down.php?course=COMP1022Q&id=0 at 2015-07-12 21:42:37. Academic use within HKUST only.

COMP1022Q Midterm Review Questions


Cell Formula
Q1) Here is a screen dump showing our target result. The chart at the bottom is included only to give
you an overview of the data.

Page 1 of 10

(COMP1022Q)[2013](f)midterm_review_questions~=bcidkjdy^_71086.pdf downloaded by bwdawani from http://petergao.net/ustpastpaper/down.php?course=COMP1022Q&id=0 at 2015-07-12 21:42:37. Academic use within HKUST only.

To achieve this result, you need to enter a correct Excel cell formula in D5 that calculates the
percentage of employees that have tertiary education. The formula will be copied and pasted into D6
to D19. The correct values of the cells are shown in the previous screen dump on page 1.

Write
your
answer
here

You dont
need to
write
anything
in these
cells

Page 2 of 10

Your
answer
will be
copied
and
pasted
into
these
cells

(COMP1022Q)[2013](f)midterm_review_questions~=bcidkjdy^_71086.pdf downloaded by bwdawani from http://petergao.net/ustpastpaper/down.php?course=COMP1022Q&id=0 at 2015-07-12 21:42:37. Academic use within HKUST only.

Cell Formula Logic Question


Q2)
You have created an Excel worksheet to assess whether to purchase your dream car. Your worksheet
looks like this:

The formula is
entered here

The logic is: if you have enough money to cover the cost of the dream car purchase plus 3 years of
parking fee and your partner is happy with that, then you will purchase the dream car.
Using this information, what is the formula of cell D8? It should show either TRUE or FALSE as the
output. Please write the formula in the box below.

Nested IF Question
Q3)
A numeric movie rating (a number in the range 0-100) is stored in B3. In cell B4 a corresponding
letter rating will be automatically given to the movie, as follows:
From 0 to 64 earns a C rating
From 65 to 84 earns a B rating
From 85 to 94 earns an A rating
From 95 to 100 earns an S rating
The result looks like this:

What is the formula in cell B4? Use nested IF functions to write the formula in the box below.

Page 3 of 10

(COMP1022Q)[2013](f)midterm_review_questions~=bcidkjdy^_71086.pdf downloaded by bwdawani from http://petergao.net/ustpastpaper/down.php?course=COMP1022Q&id=0 at 2015-07-12 21:42:37. Academic use within HKUST only.

Conditional Formatting Question


Q4)
In this question, you need to complete the formula used for conditional formatting. The visual
formatting is already set up. You only need to complete the formula for the rule. Here is a screen
dump reminding you what the Edit Formatting Rule dialog looks like.

Your formula for conditional


formatting goes here
The visual parameter is
already set for you (black)

Your formula needs to produce the same result shown in the screen dump (on the next page).
Here are some cell functions you may need for your answers.
ROW()
COLUMN()
MOD()

The cell function ROW() returns the row number of a cell.


For example, the cell formula =ROW(B5) returns 5.
The cell function COLUMN() returns the column number of a cell.
For example, the cell formula =COLUMN(D7) returns 4.
The cell function MOD(A, B) returns the integer remainder of A / B.
For example, the cell formula =MOD(8, 3) returns 2.

Here are some more examples.

Ctrl `

Page 4 of 10

(COMP1022Q)[2013](f)midterm_review_questions~=bcidkjdy^_71086.pdf downloaded by bwdawani from http://petergao.net/ustpastpaper/down.php?course=COMP1022Q&id=0 at 2015-07-12 21:42:37. Academic use within HKUST only.

Part A) Here is the result of the conditional formatting.

The conditional
formatting is applied
to A4:H11 only

There is only one conditional formatting rule in this Excel worksheet. The rule changes the
background colour of some of the cells to black. It is applied to every cell in A4:H11 only.
What is the formula of the conditional formatting rule? Write your answer in the box below.

Part B) Here is the result of the conditional formatting.

The conditional
formatting is applied
to A4:H11 only

There is only one conditional formatting rule in this Excel worksheet. The rule changes the
background colour of some of the cells to black. It is applied to every cell in A4:H11 only.
What is the formula of the conditional formatting rule? Write your answer in the box below.

Page 5 of 10

(COMP1022Q)[2013](f)midterm_review_questions~=bcidkjdy^_71086.pdf downloaded by bwdawani from http://petergao.net/ustpastpaper/down.php?course=COMP1022Q&id=0 at 2015-07-12 21:42:37. Academic use within HKUST only.

VLOOKUP Questions
Q5)
A flight information checker system has been created in a worksheet called Checker. To use the
worksheet, you can enter the country and city of the flight destination to check the distance and time
required for any flights departing Hong Kong. The worksheet is shown below:

In the worksheet shown above the country and city of the destination are entered in cell C6 and C8
respectively. The unit of display for the distance travelled is entered in cell C10. If these inputs are
entered correctly, the flight distance and time will be displayed accordingly.
The flight information is stored in another worksheet, called Information, as shown here:

...

Each row contains the information of a flight departing from Hong Kong and arriving at a particular
destination city. Column D is the distance travelled in miles, Column E is the distance travelled in
kilometers and column F is the duration of the flight.
Page 6 of 10

(COMP1022Q)[2013](f)midterm_review_questions~=bcidkjdy^_71086.pdf downloaded by bwdawani from http://petergao.net/ustpastpaper/down.php?course=COMP1022Q&id=0 at 2015-07-12 21:42:37. Academic use within HKUST only.

Part A)
In cell C8 of the Checker worksheet, the cell will be highlighted using a yellow background if the
city entered in cell C8 is NOT in the country which has already been entered in cell C6. For
example, if you enter USA in cell C6 and then Shanghai in cell C8, cell C8 will be highlighted
with yellow, as shown below, because Shanghai is not in USA.

If you enter correct information such as China and Shanghai cell C8 will not be highlighted. To
do this, a new conditional formatting rule is set up for cell C8:

The formula in the rule will be created using a combination of the ISNA and VLOOKUP functions.
Your task is to fill in the four parameters in the VLOOKUP function shown below so that the
conditional formatting rule works as described above:

=ISNA(VLOOKUP( _____________________________________________ ,

_____________________________________________ ,

_____________________ , _______________________ )

Page 7 of 10

(COMP1022Q)[2013](f)midterm_review_questions~=bcidkjdy^_71086.pdf downloaded by bwdawani from http://petergao.net/ustpastpaper/down.php?course=COMP1022Q&id=0 at 2015-07-12 21:42:37. Academic use within HKUST only.

Part B)
After entering the correct country and city the flight information will be displayed in cell D16 and
cell D18. The flight distance in cell D16 is displayed using either miles or kilometers, depending on
the value in cell C10. For example, here is the information of the flight going to Sydney, which is
stored in the Information worksheet, and the display of the flight information:

When the display unit in cell C10 is miles:

When the display unit in cell C10 is kilometers:

You need to use a VLOOKUP function in cell D16 to show the correct distance. Please fill in the
parameters of the VLOOKUP function in the space below.
Hint: you may need to use another formula function in one of the parameters.

= VLOOKUP( _____________________________________________ ,

_____________________________________________ ,

_____________________________________________ , FALSE )
Q6)
There are five different formulas listed below. We assume that in the worksheet the value in cell A1
can be found in one of the cells in column C and the values in column C are sorted in ascending
order. Based on these assumptions, four of the formulas will produce the same result and one of them
will produce a different result.
These formulas are not copied and pasted and they are not located anywhere within column A to
column G. Which one will produce a different result?
A)

B)

C)

D)

E)
Answer:
The formula that will produce a different result is (A/B/C/D/E): _____________
Page 8 of 10

(COMP1022Q)[2013](f)midterm_review_questions~=bcidkjdy^_71086.pdf downloaded by bwdawani from http://petergao.net/ustpastpaper/down.php?course=COMP1022Q&id=0 at 2015-07-12 21:42:37. Academic use within HKUST only.

VBA If Question
Q7)
Assume there is a cell with name WishOfPeter and another cell with name FinalResult.
We have the following VBA code in the workbook.

Private Sub Worksheet_Change(ByVal Target As Range)


Dim WishOfPeter As String
If Target.Address = Range("WishOfPeter").Address Then
WishOfPeter = Range("WishOfPeter")
If InStr(1, WishOfPeter, "book") > 0 Then
Range("FinalResult") = "sexy ladies"
ElseIf InStr(1, WishOfPeter, "GameCube") > 0 Then
Range("FinalResult") = "xbox"
ElseIf InStr(1, WishOfPeter, "note") > 0 Then
Range("FinalResult") = "COMP 1022Q course textbook"
ElseIf InStr(1, WishOfPeter, "notebook") > 0 Then
Range("FinalResult") = "notebook for taking notes"
Else
Range("FinalResult") = "fresh air"
End If
End If
End Sub

What will be shown in the cell called FinalResult if we enter notebook in the cell called
WishOfPeter and then press the Enter key?
A)
B)
C)
D)
E)

sexy ladies
xbox
COMP 1022Q course textbook
notebook for taking notes
fresh air

Answer:
The text shown in FinalResult is (A/B/C/D/E): ___________________

Page 9 of 10

(COMP1022Q)[2013](f)midterm_review_questions~=bcidkjdy^_71086.pdf downloaded by bwdawani from http://petergao.net/ustpastpaper/down.php?course=COMP1022Q&id=0 at 2015-07-12 21:42:37. Academic use within HKUST only.

VBA Looping Question


Q8)
Here is some VBA code.

Private Sub Workbook_Open()


Dim cash As Integer
cash = 100
While cash > 0
If cash > 100 Then
' Buy some expensive candies
cash = cash - 50
MsgBox "I have bought some expensive candies!"
ElseIf cash >= 60 Then
' Buy some not so expensive candies
cash = cash - 30
MsgBox "I have bought some not so expensive candies!"
ElseIf cash >= 10 Then
' Buy some cheap candies
cash = cash - 10
MsgBox "I have bought some cheap candies!"
ElseIf cash > 0 Then
' Buy some super cheap candies
cash = cash - 1
MsgBox "I have bought some super cheap candies!"
End If
Wend
End Sub

When you open the Excel file that contains the VBA code shown above some message boxes
are shown. How many message boxes are shown? What messages are shown?
Answer:
How many message boxes are shown: _______________________________

What messages are shown: _________________________________________________________

_________________________________________________________________________________

Page 10 of 10

You might also like