1050 Final Practice WithAnswer S24
1050 Final Practice WithAnswer S24
Chapters 10 to 18
Please note that this Final Exam practice only provides some questions for Chapters 10 to 18. The final exam
covers Chapters 2 to 12 and 15 to 18. Make sure to review all the materials on Brightspace.
Chapter 10
1. Define Application and System Software.
2. What are the jobs of an OS?
3. What is Partition Memory Management? Which registers are used for this method and why?
4. Define First Fit, Best Fit, and Worst Fit in Partition Memory Management.
5. Define the different states of a process.
6. What are preemptive and non-preemptive CPU scheduling?
7. Given the following state of a computer's memory in a Partition Memory Management system, if the
partitions are fixed and a new job arrives requiring 50 blocks of main memory, where would this block be
placed after using each of the First fit, Best fit, and Worst fit partition selection approaches respectively?
Answer using the #'s represented.
ANSWER: #1, #4, #2
Operating System
Process 1
Process 2
(#1) Empty 60 Blocks
(#2) Empty 80 Blocks
Process 3
(#3) Empty 60 Blocks
Process 4
(#4) Empty 55 Blocks
8. Given the following Page Map Table (PMT) with page size and frame size of 1024, what is the physical
address associated with the logical address of 100? What is the logical address associated with the physical
address of 100?
page 0 1 2 3 4
frame 4 2 3 0 1
9. Suppose processes P1 through P5 arrive in the ready state at essentially the same time in the order given
below. Given the service times shown, calculate the Turnaround Time for each process and the Total
Average Turnaround Time using each of these scheduling algorithms: FCFS, SJN, and Round Robin with a
time slice of 50.
1
Process P1 P2 P3 P4 P5
Service Time 25 55 120 80 200
Chapter 11
10. Define File, File System, Directory, Root Directory, and Working Directory.
11. Write at least one possible extension for each of these file types: a text data file, an audio file, a video file,
an image file, a word processing document, a program source file, a web page.
12. Define Disk Scheduling, Seek Time, and Latency. (Latency is the amount of time it takes the platter to rotate
into the proper position for reading or writing.)
13. Assume there is a 1mm distance between each of the tracks on a disk and the smallest track is 0 and the
largest is 99. If the read/write head is currently at track 20, and the following list of track requests is queued
up: 4, 12, 30, 35, 43, and 3, determine the total distance traveled by the read/write head if the operating
system uses each of these disk scheduling algorithms: FCFS, SSTF, and SCAN (moving towards lower
values). Which method is better? Why?
ANSWER:
FCFS: 4, 12, 30, 35, 43, 3
Distance: (20-4) + (12-4) + (30-12) + (35-30) + (43-35) + (43-3)
SSTF: 12, 4, 3, 30, 35, 43
Distance: (20-12) + (12-4) + (4-3) + (30-3) + (35-30) + (43-35)
SCAN: 12, 4, 3, 0, 30, 35, 43
Distance: (20-12) + (12-4) + (4-3) + (3-0) + (30-3) + (35-30) + (43-35)
14. Given the following list of cylinder requests in order in which they were received: 32, 12, 26, 15, 10, 1, 4, 51,
42. List the order in which these requests would be handled if the operating system uses each of these disk
scheduling algorithms: FCFS, SSTF, and SCAN (moving towards higher values). Assume that the disk is
positioned at cylinder 20.
Chapter 12
15. Define database, relational DBMS, record, key, field, and query.
16. The following spreadsheet shows the working
hours for 3 tutors over 5 weeks.
a. Identify inputs (given values), outputs
(calculated values), and labels by writing
the range of cells.
ANSWER:
Inputs: C4:C8, D4;D8, E4:E8
Outputs: F4:F10, G4:G10, C9:G9, C10:G10
Labels: D2, C3:G3, A6, B4:B10
b. Write the formulas for the outputs using
the correct range of cells. You should
2
write the formula for one cell and identify to which cells it can be copied to get the correct results.
Ignore the arrows!
ANSWER:
F4: = SUM(C4:E4)
G4: = AVERAGE(C4:E4) or = F4/COUNT(C4:E4)
C9: = SUM(C4:C8)
C10: = AVERAGE(C4:C8) or = C9/COUNT(C4:C8)
c. What happens if Amy does not work in week 2? (Which values will change?)
ANSWER:
D5, F5, G5, D9, D10, F9, G9, F10, G10
17. The following tables called Coffee, Orders, and CoffeeOrders are part of a database for a coffee shop. For
each of the following, write a SQL statement that:
a. returns the Coffee Name and Price for all the coffees.
b. returns the Coffee Name and Quantity for all the orders on July 23rd.
c. returns the TotalPrice for Latte (use the CoffeeID) on OrderID 100.
d. inserts two rows to CoffeeOrders for OrderID 400 which consists of 2 Mochas and 3 Hot Chocolates,
TotalPrice is calculated automatically.
e. update the Coffee table with a new price for Latte as 4.50.
Table: Coffee
CoffeeID CoffeeName Price
1 Latte 4.00
2 Mocha 5.00
3 Hot Chocolate 4.00
4 Americano 3.00
Table: Orders
OrderID OrderDate TotalPrice
100 2021-07-23 20
200 2021-07-23 14
300 2021-07-23 12
400 2021-07-27 24
Table: CoffeeOrders
OrderID CoffeeID Quantity TotalPrice
100 1 2 8
100 3 3 12
3
200 2 1 5
200 4 3 9
300 1 3 12
ANSWER:
Select Coffee.CoffeeName, Coffee.Price from Coffee
Chapter 15
18. Define network, protocol, bandwidth, client/server model, gateway, router, and repeater.
19. Define packet switching. What are DAT, ACK, and NAK headers? Why is it needed to send a packet number
and checksum within a DAT header?
20. Define the various types of networks.
21. Define network topology and the various topologies of networks.
22. Define host name, domain name, top level domain, IPv4, IPv6, and DNS.
23. The message "I am going to ace my CPSC 1050 final exam!" is to be sent over a reliable connection using the
TCP/IP Applet.
a. Presuming that each packet can carry 10 characters of data, how many data packets are required for the
whole process?
b. Presuming that the DAT header contains 11 characters, and the ACK header contains 9 characters for all
packets, what is the total number of extra characters being sent?
c. What is the ratio of "useful data" to the total data transmitted over the network for the given message?
ANSWER:
Message size: 42 characters, Number of packets = 42 / 10 = 4.2 so 5 packets are needed
Number of extra characters = 11 * 5 + 9 * 5 = 100
Ratio of useful data / total = 42 / (42 + 100)
4
Chapter 16
24. Define web, web browser, web server, website, URL, http, HTML, tag, and attribute.
25. What is the difference between head and body tags in HTML?
26. Which tags are used to display an ordered list and an unordered list?
27. Write an HTML command that displays a heading (the largest one) as "Final Exam" and a paragraph as
"Please write your name:".
28. Write an HTML command that creates a hyperlink to Google page.
29. Write an HTML command that inserts an image named test.jpg into your html file. The page must show
"Test Failed!" if the image is unavailable.
Chapter 17
30. Define information security, confidentiality, integrity, and availability.
31. What methods are used for user authentication?
32. Define cryptography, encryption, decryption, cipher, and key.
33. Using a Caesar cipher encryption shifting five letters to the left, (A encrypts to V, B to W, …), decrypt the
following message: DIAJMHVODJI NZXPMDOT
ANSWER:
INFORMATION SECURITY
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
V W X Y Z A B C D E F G H I J K L M N O P Q R S T U
34. Using a transposition cipher that arranges the letters of the message "I SEE THEM TODAY IN VANCOUVER"
column wise, and replaces space with /, the original message is written like:
I T T / A V
S H O I N E
E E D N C R
E M A / O /
/ / Y V U /
How does the message look like if encrypted by spiraling inward from the top right of the grid moving
clockwise?
ANSWER:
VER//UVY//EESITT/ANCO/AMEHOIND
Chapter 18
35. What are the limiting factors in a computer? Explain with examples.
36. Define time complexity and space complexity in comparing algorithms.
37. Write at least one example for each of these Big-O notations: O(1), O(N), O(N2), O(log(N)), and O(Nlog(N)).
5
ANSWER:
O(1): assigning a value to an element of an array
O(N): sequential search
O(N2): selection sort, bubble sort, insertion sort
O(log(N)): binary search
O(Nlog(N)): quicksort
38. What is the order of magnitude in Big-O notation for the following functions?
a. f(n) = n(log(n) + n)/2
b. f(n) = n(log(n) + n)/2n + 3log(n)
c. f(n) = n(log(n) + n)/2 + (n2 + 1)/n3
d. f(n) = n(log(n))/2 + n2/6 + n + n3/3n2
ANSWER:
a. O(n2)
b. O(n)
c. O(n2)
d. O(n2)