You are on page 1of 5

Coop-202002 Assessment Test - Access & VBA

(15 questions, password score = 9/15 or 60%)

Please select your answers for the questions below. Please note, that there is ONLY ONE best answer for
each question.

1. When creating an Access database, which step should be done first?


A. Tables
B. Primary Key
C. Foreign Key
D. Relationships

2. When determining PK and FK, which one below is correct?


A. A table must have a PK
B. You can only include one column in PK
C. You can only define one PK on a table
D. A table with a PK must have relationship with other table

3. When defining a table column as Text, you can do the following:


A. Save non-numeric data like ABC, Jay, Liu on this column because it is Text
B. Cannot save special characters such as @, $, #, & on this column, because they are not text
C. Cannot save numbers on the column because numbers are not text
D. Cannot save mixture of numbers and alphabets together on the column

4. In general, if you want to write a SELECT statement to fetch data, which of the following is the
correct syntax?
A. SELECT FROM Employees
B. SELECT Employees WHERE Level > 3 ORDER BY EmployeeID
C. SELECT OrderID * FROM Employees WHERE Level > 3 ORDER BY EmployeeID
D. SELECT OrderID, Level FROM Orders WHERE Level > 3 ORDER BY Level

5. You can only run SELECT query against a table if


A. The table has PK defined
B. The table has both PK and FK
C. The table has Unique Key
D. The table exists
6. When running the following query, what do you expect to see as the result?
SELECT OrderID, ProductID
FROM Import_Orders
WHERE (OrderID > 20000 AND OrderID <= 30000 AND OrderID > 90000)
A. Syntax error as you cannot use AND in WHERE clause more than once
B. Incorrect syntax because the parentheses are not accepted in this WHERE clause
C. This query will run but not return any rows
D. This query will run and return you some rows

7. When trying to get total row count from the table Orders, which of the following is right by
returning the correct row count?
A. SELECT COUNT(OrderDate) FROM Orders
B. SELECT COUNT(OrderID) FROM Orders
C. SELECT COUNT(ShipCountry) FROM Orders
D. SELECT COUNT(ShipCity) FROM Orders

8. Which of following SELECT queries can run with correct syntax?


A. SELECT o.OrderID, o.OrderDate, od.ProductID, od.UnitPrice
FROM Orders o INNER JOIN OrderDetails od ON o.OrderID = od.OrderID
B. SELECT o.OrderID, o.OrderDate, od.ProductID, od.UnitPrice
FROM Orders o INNER JOIN OrderDetails od WITH o.OrderID = od.OrderID
C. SELECT o.OrderID, o.OrderDate, od.ProductID, od.UnitPrice
FROM Orders o INNER JOIN OrderDetails od IN o.OrderID = od.OrderID
D. SELECT o.OrderID, o.OrderDate, od.ProductID, od.UnitPrice
FROM Orders o INNER JOIN OrderDetails od FOR o.OrderID = od.OrderID

9. Which of the following queries can give us the result of listing Orders with average unit price
and discount? (Use function AVG to gather average value on a field)
A. SELECT OrderID, AVG(UnitPrice), AVG(Discount) FROM OrderDetails
B. SELECT OrderID, AVG(UnitPrice), AVG(Discount) FROM OrderDetails GROUP BY ProductID
C. SELECT OrderID, AVG(UnitPrice), AVG(Discount) FROM OrderDetails GROUP BY OrderID
D. You cannot aggregate more than one field with one SELECT.
10. If you want to directly switch between the VBA code editor and your Access database Form
Design view, which below can you take to do it as the quickest way?
A. Press F9
B. Use ALT_F11
C. Click Menu, search the correct item, and then click to go to the window
D. Click it from the bottom window list of your Window system

11. You are to build an on-click event response VBA code, which of the following is correct name of
Event Procedure Sub for Clicking button btnSetCaption?
A. Private Sub btnSetCaption_Clicking ()
‘ Your code
End Sub
B. Private Sub btnSetCaption_Clicked ()
‘ Your code
End Sub
C. Private Sub btnSetCaption_OnClick ()
‘ Your code
End Sub
D. Private Sub btnSetCaption_Click ()
‘ Your code
End Sub

12. Look at the code below as in a Sub, which one can run and give you a result?
A. Dim CutomerID As Byte
CustomerID = 246.8
MsgBox “CustomerID = “ & CustomerID
B. Dim CutomerID As Byte
CustomerID = 256
MsgBox “CustomerID = “ & CustomerID
C. Dim CutomerID As Byte
CustomerID = 5001
MsgBox “CustomerID = “ & CustomerID
D. Dim CutomerID As Byte
CustomerID = 105
MsgBox “CustomerID = “, CustomerID
13. Look at the code in a form below, and then pick the right result.
Dim Adding As Integer
Private Sub Form_Load()
Adding = 0
‘ Some of your code
End Sub
Private Sub Add1()
‘ Some of your code
Adding = Adding + 1
Add2
End Sub
Private Sub Add2()
‘ Some of your code
Adding = Adding + 1
Add3
End Sub
Private Sub Add3()
‘ Some of your code
MsgBox “Adding=” & Adding
Adding = Adding + 1
End Sub
… Some of your VBA Subs and Functions

What will be displayed if Add1 is called?


A. Adding=0
B. Adding=1
C. Adding=2
D. Adding=3

14. Which of the following can be used in your VBA code to open another form from the current
form in Access?
A. Right click on the form from the left hand side of the form and choose Form View
B. Double-click on the form to open it
C. Call DoCmd.OpenForm
D. Use Me.OpenForm
15. When coding in VBA, why do we need to use ADO?
A. ADO is used to bound form and get data for its record source
B. Using ADO can link multiple forms each other
C. ADO is used to quickly open and close forms
D. ADO is used to connect to multiple types of data sources and run queries

1. A
2. C
3. A
4. D
5. D
6. C
7. B
8. A
9. C
10. B
11. D
12. A
13. C
14. C
15. D

You might also like