Let \(A\) and \(B\) be two 8-bit signed integers represented in two's complement, where \(A = 01011011_2\) and \(B = 10100100_2\). Which of the following statements about the operation \(A + B\) is/are correct? (1) The result is negative. (2) No overflow occurs. (3) The hexadecimal representation of the result is \(\text{FF}_{16}\).
- A.(1) only
- B.(1) and (2) only
- C.(2) and (3) only
- D.(1), (2) and (3)
Worked solution
\(A = 01011011_2 = 91_{10}\). \(B = 10100100_2\). The two's complement of \(B\) is \(01011100_2 = 92_{10}\), so \(B = -92_{10}\). The sum \(A + B = 91 + (-92) = -1_{10}\). (1) \(-1_{10}\) is negative, so (1) is correct. (2) No overflow occurs since we add a positive and a negative number, so (2) is correct. (3) \(-1_{10}\) in 8-bit binary is \(11111111_2\), which is \(\text{FF}_{16}\) in hexadecimal, so (3) is correct. Thus, (1), (2) and (3) are all correct.
Marking scheme
Award 1 mark for the correct answer D. No partial marks are given.
A host has the IP address 192.168.10.45 with a subnet mask of 255.255.255.224. Which of the following is the network address (subnet address) to which this host belongs?
- A.192.168.10.0
- B.192.168.10.32
- C.192.168.10.45
- D.192.168.10.63
Worked solution
To find the network address, perform a bitwise AND operation between the IP address and the subnet mask. The fourth octet of the IP address is 45 (00101101 in binary). The fourth octet of the subnet mask is 224 (11100000 in binary). Performing the bitwise AND: 00101101 AND 11100000 = 00100000, which is 32 in decimal. Therefore, the network address is 192.168.10.32.
Marking scheme
Award 1 mark for the correct answer B. No partial marks.
Consider a database with two tables: Student(StudentID, Name, Class) where StudentID is the primary key, and Enrollment(StudentID, CourseID, EnrollDate) where (StudentID, CourseID) is the composite primary key, and StudentID is a foreign key referencing Student(StudentID). Which of the following operations will NOT violate any integrity constraints?
- A.Inserting a record into Enrollment with a StudentID value that does not exist in Student.
- B.Deleting a record from Student whose StudentID is currently referenced in Enrollment.
- C.Inserting a record into Enrollment with a null value for StudentID.
- D.Inserting a record into Student with a new StudentID value that does not exist in Student.
Worked solution
Option A violates referential integrity because the foreign key StudentID in Enrollment must refer to an existing primary key in Student. Option B violates referential integrity if there is a matching foreign key in Enrollment (unless cascading delete is configured, but by default it violates it). Option C violates entity integrity because StudentID is part of the primary key of Enrollment, and primary keys cannot contain null values. Option D is a standard insertion of a new record with a unique primary key in the primary table Student, which does not violate any integrity constraint.
Marking scheme
Award 1 mark for the correct answer D. No partial marks.
A database table Sales has columns SaleID, ProductID, Region, and Amount. What is the output of the following SQL query? SELECT Region, COUNT(SaleID) FROM Sales GROUP BY Region HAVING AVG(Amount) > 1100. [Sales Data: (1, 'P01', 'North', 1500), (2, 'P02', 'South', 2000), (3, 'P01', 'South', 1200), (4, 'P03', 'North', 800), (5, 'P02', 'North', 1000), (6, 'P01', 'North', 500)]
- A.Region: South, COUNT(SaleID): 2
- B.Region: North, COUNT(SaleID): 4
- C.Region: North, COUNT(SaleID): 4; Region: South, COUNT(SaleID): 2
- D.No records returned
Worked solution
First, group the records by Region: North has 4 records with amounts: 1500, 800, 1000, 500. The average (AVG) for North is (1500+800+1000+500)/4 = 3800/4 = 950. South has 2 records with amounts: 2000, 1200. The average (AVG) for South is (2000+1200)/2 = 3200/2 = 1600. The HAVING clause filters out groups where AVG(Amount) <= 1100. Thus, North is excluded (950 <= 1100) and only South is included (1600 > 1100). The query returns the Region (South) and the count of records in that group (2).
Marking scheme
Award 1 mark for the correct answer A. No partial marks.
A database relation R(A, B, C, D) has a composite primary key (A, B). Which of the following functional dependencies would violate the Second Normal Form (2NF)?
- A.(A, B) -> C
- B.C -> D
- C.A -> D
- D.(A, B) -> D
Worked solution
For a relation to be in 2NF, it must be in 1NF and every non-prime attribute must be fully functionally dependent on the entire primary key. If A -> D, the non-prime attribute D is functionally dependent on A, which is a proper subset of the primary key (A, B). This is a partial dependency, which violates 2NF.
Marking scheme
Award 1 mark for the correct answer C. No partial marks.
Consider the following pseudocode: A is a 1-indexed array of 5 integers: [4, 7, 2, 9, 5]. For i from 1 to 4 do: For j from 1 to 5 - i do: If A[j] > A[j+1] then Swap A[j] and A[j+1]. What is the content of the array A after the outer loop completes its first iteration (i.e., when i = 1)?
- A.[2, 4, 5, 7, 9]
- B.[4, 2, 7, 5, 9]
- C.[4, 2, 5, 7, 9]
- D.[2, 7, 4, 5, 9]
Worked solution
When i = 1, the inner loop index j ranges from 1 to 4. 1) j = 1: compare A[1] (4) and A[2] (7). No swap. Array: [4, 7, 2, 9, 5]. 2) j = 2: compare A[2] (7) and A[3] (2). Since 7 > 2, swap. Array becomes: [4, 2, 7, 9, 5]. 3) j = 3: compare A[3] (7) and A[4] (9). No swap. Array: [4, 2, 7, 9, 5]. 4) j = 4: compare A[4] (9) and A[5] (5). Since 9 > 5, swap. Array becomes: [4, 2, 7, 5, 9]. This is the final state after the first pass (i = 1).
Marking scheme
Award 1 mark for the correct answer B. No partial marks.
Which of the following correctly describes the roles of the Program Counter (PC) and the Memory Address Register (MAR) during the instruction fetch phase of a machine cycle?
- A.PC holds the address of the next instruction to be fetched, and MAR holds the memory address currently being read.
- B.MAR holds the data fetched from memory, and PC holds the decoded instruction.
- C.PC holds the address in memory currently being read, and MAR holds the next instruction.
- D.MAR holds the address of the next instruction, and PC holds the accumulated result of arithmetic operations.
Worked solution
The Program Counter (PC) keeps track of the memory address of the next instruction to be fetched. During the fetch phase, this address is copied from the PC to the Memory Address Register (MAR), which directly interfaces with the address bus to access the physical memory location currently being read. Therefore, option A is correct.
Marking scheme
Award 1 mark for the correct answer A. No partial marks.
Alice wants to send a confidential message to Bob and ensure that Bob can verify that the message indeed came from Alice (authenticity and non-repudiation). Using public-key cryptography, which keys should Alice use to (1) sign the message, and (2) encrypt the message, respectively?
- A.(1) Alice's private key; (2) Bob's public key
- B.(1) Alice's public key; (2) Bob's private key
- C.(1) Bob's public key; (2) Alice's private key
- D.(1) Bob's private key; (2) Alice's public key
Worked solution
To sign a message and guarantee authenticity/non-repudiation, the sender (Alice) must encrypt the message (or its hash value) using her own private key. Since only Alice knows her private key, successful decryption with Alice's public key proves Alice sent it. To ensure confidentiality, Alice must encrypt the message using the recipient's (Bob's) public key, so that only Bob can decrypt it using his private key. Thus, the correct sequence is (1) Alice's private key and (2) Bob's public key.
Marking scheme
Award 1 mark for the correct answer A. No partial marks.
A school wants to host its student management system. Instead of maintaining physical servers, the school decides to rent virtual servers and storage space from a cloud service provider, but the school's IT staff will still install and manage the operating system, databases, and application software. Which cloud service model is the school utilizing?
- A.Software as a Service (SaaS)
- B.Platform as a Service (PaaS)
- C.Infrastructure as a Service (IaaS)
- D.Database as a Service (DBaaS)
Worked solution
Infrastructure as a Service (IaaS) provides virtualized computing resources, such as virtual servers, storage, and networking, over the internet. The customer is responsible for installing and managing the operating system, middleware, databases, and applications. Since the school rents virtual servers and storage but manages the operating systems and databases themselves, this is an IaaS model.
Marking scheme
Award 1 mark for the correct answer C. No partial marks.
Which of the following statements comparing a compiler and an interpreter is/are correct? (1) A compiler translates the entire source code into machine code before execution, whereas an interpreter translates and executes code line-by-line. (2) An interpreted program generally runs faster than a compiled program because it does not require a compilation step. (3) If there is a syntax error in the middle of the code, a compiler will report the error before generating any executable, while an interpreter may execute the preceding lines before stopping at the error.
- A.(1) only
- B.(1) and (2) only
- C.(1) and (3) only
- D.(2) and (3) only
Worked solution
Statement (1) is correct: compiling translates the whole program first, while interpreting translates line-by-line during runtime. Statement (2) is incorrect: compiled programs run significantly faster than interpreted programs because they are already converted to machine code, while interpreted programs require translating overhead during execution. Statement (3) is correct: since compilers parse the entire program first, syntax errors prevent executable generation; interpreters run line-by-line, so they only halt when they actually encounter the erroneous line. Thus, (1) and (3) are correct.
Marking scheme
Award 1 mark for the correct answer C. No partial marks.
In an 8-bit two's complement representation, what is the binary representation of the decimal number \(-37\)?
- A.11011011
- B.11011010
- C.10100101
- D.11100101
Worked solution
To represent \(-37\) in 8-bit two's complement:
1. Express the absolute value \(37\) in binary: \(37 = 32 + 4 + 1 \Rightarrow 00100101_2\).
2. Find the one's complement by inverting all bits: \(11011010_2\).
3. Add 1 to find the two's complement: \(11011010_2 + 1 = 11011011_2\).
Thus, the correct option is A.
Marking scheme
1 mark for the correct option. No marks for incorrect or multiple options selected.
Which of the following statements about Cache Memory is/are correct?
(1) It is faster than registers inside the CPU.
(2) It stores frequently used data and instructions to speed up CPU access.
(3) It is typically larger in capacity than the main memory (RAM).
- A.(2) only
- B.(1) and (2) only
- C.(2) and (3) only
- D.(1), (2) and (3)
Worked solution
Statement (1) is incorrect because registers inside the CPU are the fastest memory components, faster than cache memory.
Statement (2) is correct because cache memory holds active/frequently-accessed instructions/data close to the CPU to reduce access latency.
Statement (3) is incorrect because cache memory has a much smaller storage capacity than RAM due to high cost and physical space constraints.
Therefore, only statement (2) is correct.
Marking scheme
1 mark for the correct option. No marks for incorrect or multiple options selected.
Which of the following IP addresses can be assigned to a host on a private local area network (LAN) without routing on the public Internet?
(1) 10.150.23.45
(2) 172.20.100.2
(3) 192.168.1.254
(4) 168.192.0.1
- A.(1) and (3) only
- B.(2) and (3) only
- C.(1), (2) and (3) only
- D.(1), (2), (3) and (4)
Worked solution
Private IP address ranges are designated for local networks:
- Class A: 10.0.0.0 to 10.255.255.255
- Class B: 172.16.0.0 to 172.31.255.255
- Class C: 192.168.0.0 to 192.168.255.255
Thus:
(1) 10.150.23.45 falls in the Class A private range.
(2) 172.20.100.2 falls in the Class B private range.
(3) 192.168.1.254 falls in the Class C private range.
(4) 168.192.0.1 is outside the private ranges (it is a public IP address).
Therefore, (1), (2), and (3) are private IP addresses.
Marking scheme
1 mark for the correct option. No marks for incorrect or multiple options selected.
In public-key cryptography, when Alice wants to send a digitally signed message to Bob to ensure non-repudiation and integrity, Alice should:
- A.Encrypt the message hash with Alice's private key.
- B.Encrypt the message hash with Bob's public key.
- C.Encrypt the message hash with Alice's public key.
- D.Encrypt the message hash with Bob's private key.
Worked solution
A digital signature is created by calculating the hash value of a message and encrypting that hash value with the sender's (Alice's) private key. The recipient (Bob) can verify the signature by decrypting it using Alice's public key. This ensures integrity (any modification of the message will result in a hash mismatch) and non-repudiation (only Alice, who holds her private key, could have created the signature).
Marking scheme
1 mark for the correct option. No marks for incorrect or multiple options selected.
In a relational database, there are two tables:
`STUDENT(StudentID, StudentName, ClassID)` and `CLASS(ClassID, ClassName, RoomNo)`.
`StudentID` is the primary key of `STUDENT`, and `ClassID` is the primary key of `CLASS`. `ClassID` in `STUDENT` is a foreign key referencing `CLASS`. Which of the following operations violates referential integrity?
- A.Inserting a new record into CLASS with a new ClassID.
- B.Inserting a new record into STUDENT with a ClassID that does not exist in CLASS.
- C.Deleting a record from STUDENT.
- D.Changing the ClassName of a class in the CLASS table.
Worked solution
Referential integrity states that every foreign key value in a table must match an existing primary key value in the referenced table (or be NULL).
- Option A: Inserting a record into the parent table (CLASS) does not violate integrity.
- Option B: Inserting a record into the child table (STUDENT) with a ClassID that does not exist in CLASS leaves a foreign key with no matching primary key, violating referential integrity.
- Option C: Deleting a record from the child table does not affect referential integrity.
- Option D: Changing ClassName of a class in CLASS does not affect the primary key ClassID.
Marking scheme
1 mark for the correct option. No marks for incorrect or multiple options selected.
Consider the table `Sales(SalesID, ItemID, Quantity, Price)`.
What is the purpose of the following SQL statement?
```sql
SELECT ItemID, SUM(Quantity * Price) AS TotalRevenue
FROM Sales
GROUP BY ItemID
HAVING SUM(Quantity * Price) > 1000;
```
- A.To find the list of item IDs where the unit price of any individual sale is greater than 1000.
- B.To calculate the total quantity sold for each item, and display those with total quantity greater than 1000.
- C.To find the item IDs whose total revenue (Quantity * Price) across all sales is greater than 1000.
- D.To display all sales records where the sales amount is greater than 1000, grouped by ItemID.
Worked solution
The query groups the sales records by ItemID. `SUM(Quantity * Price)` calculates the total revenue generated by each item. The `HAVING` clause filters the aggregated groups to retain only those groups where the calculated `TotalRevenue` is strictly greater than 1000.
Marking scheme
1 mark for the correct option. No marks for incorrect or multiple options selected.
A table `ProjectMember(ProjectID, EmployeeID, EmployeeName, HoursWorked)` has a composite primary key `(ProjectID, EmployeeID)`.
The functional dependencies are:
- `(ProjectID, EmployeeID) -> HoursWorked`
- `EmployeeID -> EmployeeName`
Which normal form does this table satisfy, and what is the reason?
- A.First Normal Form (1NF) only, because there is a partial dependency.
- B.Second Normal Form (2NF) only, because there are no transitive dependencies.
- C.Third Normal Form (3NF), because all non-key attributes are fully functionally dependent on the primary key.
- D.It is not even in 1NF, because it has duplicate keys.
Worked solution
1. The table contains atomic values, so it satisfies First Normal Form (1NF).
2. The primary key is composite: `(ProjectID, EmployeeID)`.
3. There is a partial dependency: `EmployeeID -> EmployeeName`. `EmployeeName` depends only on part of the primary key (`EmployeeID`), not the whole composite key. This violates Second Normal Form (2NF).
Therefore, the table satisfies First Normal Form (1NF) only.
Marking scheme
1 mark for the correct option. No marks for incorrect or multiple options selected.
Consider the following pseudocode:
```
Set A to [3, 8, 2, 7, 5]
Set N to 5
For i from 0 to N - 2:
For j from 0 to N - 2 - i:
If A[j] > A[j+1] Then
Swap A[j] and A[j+1]
EndIf
EndFor
EndFor
```
What is the state of array `A` after the outer loop has completed exactly 2 iterations (i.e., `i = 0` and `i = 1`)?
- A.[3, 2, 7, 5, 8]
- B.[2, 3, 5, 7, 8]
- C.[2, 3, 7, 5, 8]
- D.[2, 3, 5, 8, 7]
Worked solution
The pseudocode represents a Bubble Sort algorithm in ascending order.
Let's trace:
Initial state: `A = [3, 8, 2, 7, 5]`
- **First outer iteration (i = 0)**:
- `j = 0`: `A[0] > A[1]` (3 > 8 is false) -> `[3, 8, 2, 7, 5]`
- `j = 1`: `A[1] > A[2]` (8 > 2 is true) -> Swap -> `[3, 2, 8, 7, 5]`
- `j = 2`: `A[2] > A[3]` (8 > 7 is true) -> Swap -> `[3, 2, 7, 8, 5]`
- `j = 3`: `A[3] > A[4]` (8 > 5 is true) -> Swap -> `[3, 2, 7, 5, 8]`
After `i = 0`, the largest element (8) is correctly placed at the end.
- **Second outer iteration (i = 1)**:
- `j = 0`: `A[0] > A[1]` (3 > 2 is true) -> Swap -> `[2, 3, 7, 5, 8]`
- `j = 1`: `A[1] > A[2]` (3 > 7 is false) -> `[2, 3, 7, 5, 8]`
- `j = 2`: `A[2] > A[3]` (7 > 5 is true) -> Swap -> `[2, 3, 5, 7, 8]`
After `i = 1`, the array becomes `[2, 3, 5, 7, 8]`.
Marking scheme
1 mark for the correct option. No marks for incorrect or multiple options selected.
Consider the following recursive function:
```
Function f(n, k)
If n == 0 Then
Return 0
Else If n % 2 == 1 Then
Return k + f(n // 2, k * 2)
Else
Return f(n // 2, k * 2)
EndIf
EndFunction
```
Note: `//` is integer division. What is the return value of the function call `f(11, 3)`?
- A.33
- B.13
- C.15
- D.48
Worked solution
Let's trace the recursive function call f(11, 3):
1. `f(11, 3)`: Since `11 % 2 == 1`, returns `3 + f(5, 6)`.
2. `f(5, 6)`: Since `5 % 2 == 1`, returns `6 + f(2, 12)`.
3. `f(2, 12)`: Since `2 % 2 == 0`, returns `f(1, 24)`.
4. `f(1, 24)`: Since `1 % 2 == 1`, returns `24 + f(0, 48)`.
5. `f(0, 48)`: Since `n == 0`, returns `0`.
Working backwards:
- `f(1, 24) = 24 + 0 = 24`
- `f(2, 12) = f(1, 24) = 24`
- `f(5, 6) = 6 + f(2, 12) = 6 + 24 = 30`
- `f(11, 3) = 3 + f(5, 6) = 3 + 30 = 33`
The return value is 33. (This function computes binary multiplication \(n \times k\)).
Marking scheme
1 mark for the correct option. No marks for incorrect or multiple options selected.
A school wants to host its own virtual learning environment (VLE) website. The IT department decides to rent virtual machines (VMs) and storage from a cloud provider. They will install and maintain the operating systems, web server software, and the VLE application themselves. Which cloud service model is the school utilizing?
- A.Infrastructure as a Service (IaaS)
- B.Platform as a Service (PaaS)
- C.Software as a Service (SaaS)
- D.Database as a Service (DBaaS)
Worked solution
Infrastructure as a Service (IaaS) provides virtualized computing resources (such as virtual machines, storage, and networks) over the Internet. The user has control over operating systems, storage, and deployed applications. Since the school is renting basic virtual machines/storage and configuring the OS and applications themselves, this matches the IaaS model.
Marking scheme
1 mark for the correct option. No marks for incorrect or multiple options selected.
An 8-bit register stores a signed integer using two's complement representation. If the content of the register is \(10101100_2\), what is its decimal value?
- A.-84
- B.-44
- C.-83
- D.172
Worked solution
In two's complement representation, the most significant bit (MSB) is the sign bit. Since the MSB is 1, the number is negative.\nTo find its magnitude:\n1. Invert all the bits: \(10101100 \rightarrow 01010011\)\n2. Add 1 to the result: \(01010011 + 1 = 01010100_2\)\n3. Convert to decimal: \(01010100_2 = 64 + 16 + 4 = 84\).\nTherefore, the value is \(-84\).
Marking scheme
Award 1 mark for the correct option A.
Consider two database tables: `STUDENT` and `CLASS`.\n`STUDENT` table: `StudentID` (Primary Key), `Name`, `ClassID` (Foreign Key referencing `CLASS.ClassID`)\n`CLASS` table: `ClassID` (Primary Key), `TeacherInCharge`\n\nWhich of the following actions will definitely violate referential integrity?\nI. Inserting a new student record with a `ClassID` that does not exist in the `CLASS` table.\nII. Deleting a class record from the `CLASS` table while some student records in the `STUDENT` table still have that `ClassID`.\nIII. Updating a student's `Name` to null.
- A.I only
- B.I and II only
- C.II and III only
- D.I, II and III
Worked solution
I violates referential integrity because a foreign key value must exist in the referenced table's primary key column.\nII violates referential integrity because deleting a referenced row leaves orphaned foreign keys in the referencing table.\nIII does not violate referential integrity as it only involves the `Name` attribute, which is not a foreign key.
Marking scheme
Award 1 mark for the correct option B.
Consider the following pseudocode segment:\n\n```\nX = 15\nY = 6\nWhile X != Y Do\n If X > Y Then\n X = X - Y\n Else\n Y = Y - X\n EndIf\nEndWhile\n```\n\nWhat is the final value of `X`?
- A.3
- B.6
- C.9
- D.15
Worked solution
This pseudocode implements the Euclidean algorithm for finding the Greatest Common Divisor (GCD) of X and Y.\nLet's trace the values of X and Y:\n- Initially: X = 15, Y = 6\n- Loop 1: X > Y (15 > 6), so X = 15 - 6 = 9\n- Loop 2: X > Y (9 > 6), so X = 9 - 6 = 3\n- Loop 3: X < Y (3 < 6), so Y = 6 - 3 = 3\n- Now X = 3 and Y = 3. Since X == Y, the loop terminates.\nThe final value of X is 3.
Marking scheme
Award 1 mark for the correct option A.
A computer has an IP address of `192.168.10.45` with a subnet mask of `255.255.255.224`. Which of the following IP addresses belongs to the same subnet as this computer?
- A.192.168.10.15
- B.192.168.10.30
- C.192.168.10.60
- D.192.168.10.65
Worked solution
The subnet mask is `255.255.255.224`. The block size is \(256 - 224 = 32\).\nThe subnets are in increments of 32 for the last octet:\n- Subnet 1: .0 to .31 (Usable: .1 to .30)\n- Subnet 2: .32 to .63 (Usable: .33 to .62)\n- Subnet 3: .64 to .95 (Usable: .65 to .94)\n\nSince the computer's IP address has the last octet as 45, it belongs to Subnet 2 (.32 to .63).\nAmong the options, `192.168.10.60` has its last octet (60) within this range, so it belongs to the same subnet.
Marking scheme
Award 1 mark for the correct option C.
Alice wants to send a confidential message to Bob using public-key cryptography. She also wants to ensure that Bob can verify the message indeed came from her (authentication). Which of the following describes the correct encryption process?
- A.Alice encrypts the message with Bob's public key, then encrypts the result with her own public key.
- B.Alice encrypts the message with her own private key, then encrypts the result with Bob's public key.
- C.Alice encrypts the message with Bob's private key, then encrypts the result with her own private key.
- D.Alice encrypts the message with Bob's public key, then encrypts the result with her own private key.
Worked solution
To achieve both confidentiality and authentication:\n1. Alice encrypts the message with her own private key. Since only Alice has her private key, any recipient who can decrypt the message using Alice's public key knows it must have come from her (Authentication).\n2. Then, Alice encrypts the resulting ciphertext with Bob's public key. Since only Bob has Bob's private key, only Bob can perform the first stage of decryption, ensuring that nobody else can read the message (Confidentiality).
Marking scheme
Award 1 mark for the correct option B.
Consider the database table `SALES` below:\n\n| SaleID | Product | Category | Amount |\n|---|---|---|---|\n| 1 | Laptop | IT | 8000 |\n| 2 | Mouse | IT | 150 |\n| 3 | Desk | Furniture | 1200 |\n| 4 | Chair | Furniture | 800 |\n| 5 | Phone | IT | 5000 |\n\nWhat is the output of the following SQL query?\n\n```sql\nSELECT Category, AVG(Amount) FROM SALES\nGROUP BY Category\nHAVING COUNT(*) > 1 AND AVG(Amount) > 1000;\n```
- A.Category | AVG(Amount)
IT | 4383.33 - B.Category | AVG(Amount)
IT | 4383.33
Furniture | 1000.00 - C.Category | AVG(Amount)
Furniture | 1000.00 - D.Empty set (No rows returned)
Worked solution
First, the query groups the rows by `Category`:\n1. `IT` category group has records with amounts: 8000, 150, 5000.\n - `COUNT(*)` = 3\n - `AVG(Amount)` = (8000 + 150 + 5000) / 3 = 13150 / 3 = 4383.33\n2. `Furniture` category group has records with amounts: 1200, 800.\n - `COUNT(*)` = 2\n - `AVG(Amount)` = (1200 + 800) / 2 = 1000.00\n\nNext, the `HAVING` clause filters the groups:\n- For `IT`: `COUNT(*) > 1` (3 > 1, True) and `AVG(Amount) > 1000` (4383.33 > 1000, True). It is selected.\n- For `Furniture`: `COUNT(*) > 1` (2 > 1, True) and `AVG(Amount) > 1000` (1000 > 1000, False). It is filtered out.\n\nTherefore, only the row for `IT` is returned.
Marking scheme
Award 1 mark for the correct option A.
Which of the following statements about "thrashing" in virtual memory is/are correct?\n\nI. Thrashing occurs when the operating system spends more time swapping pages in and out of secondary storage than executing actual program instructions.\nII. Increasing the capacity of physical RAM can help resolve the thrashing problem.\nIII. Defragmenting the hard disk is the most effective way to eliminate thrashing.
- A.I only
- B.I and II only
- C.II and III only
- D.I, II and III
Worked solution
Statement I is the definition of thrashing in virtual memory management.\nStatement II is correct because adding physical memory reduces the need for the OS to perform page swaps, resolving the source of thrashing.\nStatement III is incorrect because disk fragmentation relates to file storage layout, whereas thrashing is caused by insufficient physical RAM to hold the running programs' active pages. Defragmentation does not solve thrashing.
Marking scheme
Award 1 mark for the correct option B.
During the fetch-decode-execute cycle of a CPU, which register is updated to store the address of the next instruction to be fetched immediately after an instruction is fetched?
- A.Memory Address Register (MAR)
- B.Program Counter (PC)
- C.Instruction Register (IR)
- D.Accumulator (ACC)
Worked solution
During the Fetch phase, the instruction address is read from the Program Counter (PC). Immediately after the current instruction is fetched from memory, the PC is automatically incremented/updated to point to the address of the next instruction in sequence.
Marking scheme
Award 1 mark for the correct option B.
Consider a relation `BOOK_LOAN` with attributes:\n`{LoanID, StudentID, StudentName, BookID, BookTitle, LoanDate}`\n\nAssume that:\n- `LoanID` is the primary key.\n- Each student has a unique `StudentID` and a single `StudentName`.\n- Each book has a unique `BookID` and a single `BookTitle`.\n\nWhich of the following normal forms does this relation satisfy?\n\nI. First Normal Form (1NF)\nII. Second Normal Form (2NF)\nIII. Third Normal Form (3NF)
- A.I only
- B.I and II only
- C.II and III only
- D.I, II and III
Worked solution
1. 1NF: All attributes contain atomic values, so it satisfies 1NF.\n2. 2NF: The primary key is a single attribute (`LoanID`), so there are no partial dependencies (which are only possible with a composite primary key). Thus, it satisfies 2NF.\n3. 3NF: We have functional dependencies: `LoanID -> StudentID` and `StudentID -> StudentName`. Since `StudentID` is not a superkey and `StudentName` is not a prime attribute, there is a transitive dependency: `LoanID -> StudentName` (via `StudentID`). Similarly, `LoanID -> BookTitle` is a transitive dependency (via `BookID`). Therefore, it does not satisfy 3NF.\nHence, it satisfies I and II only.
Marking scheme
Award 1 mark for the correct option B.
A software development company wants to develop and deploy a new web application. They want to focus entirely on coding and managing the application, without worrying about managing the underlying operating systems, hardware servers, storage, or network infrastructure. Which cloud computing service model is most suitable for them?
- A.Infrastructure as a Service (IaaS)
- B.Platform as a Service (PaaS)
- C.Software as a Service (SaaS)
- D.Database as a Service (DBaaS)
Worked solution
Platform as a Service (PaaS) provides a pre-configured environment (including operating system, database, runtime, and server environment) which allows developers to build, test, and run their code without having to manage the underlying hardware and OS infrastructure.
Marking scheme
Award 1 mark for the correct option B.
Consider the following pseudocode:
```
Integer Array A[0..5] = {3, 8, 2, 9, 5, 4}
Integer i, temp
For i = 0 To 4 Do:
If A[i] > A[i+1] Then:
temp = A[i]
A[i] = A[i+1]
A[i+1] = temp
EndIf
EndFor
```
What is the content of array `A` after executing the pseudocode?
- A.{2, 3, 4, 5, 8, 9}
- B.{3, 2, 8, 5, 4, 9}
- C.{3, 8, 2, 5, 4, 9}
- D.{3, 2, 5, 4, 8, 9}
Worked solution
Let's trace the algorithm step-by-step:
- Initially, A = {3, 8, 2, 9, 5, 4}.
- i = 0: Compare A[0] (3) and A[1] (8). Since 3 > 8 is false, no swap occurs. A remains {3, 8, 2, 9, 5, 4}.
- i = 1: Compare A[1] (8) and A[2] (2). Since 8 > 2 is true, swap them. A becomes {3, 2, 8, 9, 5, 4}.
- i = 2: Compare A[2] (8) and A[3] (9). Since 8 > 9 is false, no swap occurs. A remains {3, 2, 8, 9, 5, 4}.
- i = 3: Compare A[3] (9) and A[4] (5). Since 9 > 5 is true, swap them. A becomes {3, 2, 8, 5, 9, 4}.
- i = 4: Compare A[4] (9) and A[5] (4). Since 9 > 4 is true, swap them. A becomes {3, 2, 8, 5, 4, 9}.
Thus, the final array content is {3, 2, 8, 5, 4, 9}.
Marking scheme
Award 1 mark for the correct option (B). No marks are awarded for incorrect options.
A database table `STUDENT` contains fields `StudentID`, `Name`, `Class`, and `Score`. Which of the following SQL queries can correctly display the class name and the number of students in each class who scored 60 or above?
- A.`SELECT Class, COUNT(*) FROM STUDENT WHERE Score >= 60 GROUP BY Class;`
- B.`SELECT Class, COUNT(*) FROM STUDENT GROUP BY Class HAVING Score >= 60;`
- C.`SELECT Class, COUNT(Score) FROM STUDENT WHERE Score >= 60 GROUP BY StudentID;`
- D.`SELECT Class, SUM(Score) FROM STUDENT WHERE Score >= 60 GROUP BY Class;`
Worked solution
To find the number of students scoring 60 or above in each class:
1. We first filter individual student records where `Score >= 60` using the `WHERE` clause.
2. Then we group the filtered records by class using `GROUP BY Class`.
3. Finally, we use `COUNT(*)` to count the number of students in each group.
Option B is incorrect because `HAVING` can only filter groups using aggregated functions, not individual columns unless they are part of the GROUP BY clause. Option C groups by `StudentID`, which would not aggregate by class. Option D uses `SUM(Score)` which calculates the sum of scores rather than counting the number of students.
Marking scheme
Award 1 mark for the correct option (A). No marks are awarded for incorrect options.
In a relational database, table `PROJECT` has a composite primary key `(ProjID, MemberID)`. Table `MEMBER` has a primary key `MemberID`. Which of the following statements about referential integrity is/are correct?
(1) `MemberID` in `PROJECT` is a foreign key referencing `MemberID` in `MEMBER`.
(2) `MemberID` in `PROJECT` cannot contain duplicate values.
(3) A record cannot be added to `PROJECT` if its `MemberID` does not exist in `MEMBER`.
- A.(1) only
- B.(1) and (3) only
- C.(2) and (3) only
- D.(1), (2) and (3)
Worked solution
- Statement (1) is correct: `MemberID` in `PROJECT` is a foreign key that references the primary key `MemberID` of the `MEMBER` table.
- Statement (2) is incorrect: `MemberID` is part of a composite primary key `(ProjID, MemberID)` in `PROJECT`. Therefore, duplicate values are allowed for `MemberID` on its own, as long as each pair of `(ProjID, MemberID)` is unique.
- Statement (3) is correct: Under referential integrity constraints, a foreign key value must exist in the referenced table. Thus, a record with a non-existent `MemberID` cannot be inserted into `PROJECT`.
Marking scheme
Award 1 mark for the correct option (B). No marks are awarded for incorrect options.
Consider the following Entity-Relationship (ER) diagram representing a library system:
`[Reader] <---- (1:N) ---- [Borrow] ---- (N:1) ----> [Book]`
Which of the following descriptions about the relationship between `Reader` and `Book` is correct?
- A.A reader can borrow multiple books, and a book can be borrowed by multiple readers at different times.
- B.Each reader can only borrow one book, and each book can only be borrowed by one reader.
- C.The relation `Borrow` should have a composite primary key consisting of keys from both `Reader` and `Book` tables only, without any other fields allowed.
- D.The relationship between `Reader` and `Book` is a one-to-one (1:1) relationship.
Worked solution
The relation `Borrow` acts as a junction (or associative) entity table to resolve a many-to-many (N:M) relationship between `Reader` and `Book`. Therefore, a reader can borrow multiple books, and a book can be borrowed by different readers over time, which makes option A correct and options B and D incorrect. Option C is incorrect because the junction table `Borrow` can and usually does contain additional fields (e.g., `BorrowDate`, `DueDate`).
Marking scheme
Award 1 mark for the correct option (A). No marks are awarded for incorrect options.
A computer has the IP address `192.168.10.75` and the subnet mask `255.255.255.240`. Which of the following is the network address (or subnet ID) of the subnet to which this computer belongs?
- A.`192.168.10.0`
- B.`192.168.10.64`
- C.`192.168.10.72`
- D.`192.168.10.80`
Worked solution
To find the network address, we perform a bitwise AND operation between the IP address and the subnet mask. Since the first three octets of the mask are `255.255.255`, the first three octets of the network address remain `192.168.10`.
For the last octet:
- IP address last octet: \(75 = 01001011_2\)
- Subnet mask last octet: \(240 = 11110000_2\)
- Bitwise AND: \(01001011_2 \text{ AND } 11110000_2 = 01000000_2\), which is \(64\) in decimal.
Therefore, the network address is `192.168.10.64`.
Marking scheme
Award 1 mark for the correct option (B). No marks are awarded for incorrect options.
An audio file is recorded with the following specifications:
- Sampling rate: \(44.1 \text{ kHz}\)
- Sampling size: \(16\text{-bit}\)
- Channel: Stereo (2 channels)
- Duration: \(2\text{ minutes}\)
If no compression is applied, what is the estimated file size of the recorded audio file in megabytes (MB)? (Assume \(1 \text{ MB} = 10^6 \text{ bytes}\))
- A.\(5.3 \text{ MB}\)
- B.\(10.6 \text{ MB}\)
- C.\(21.2 \text{ MB}\)
- D.\(42.3 \text{ MB}\)
Worked solution
File size (in bits) = Sampling rate \(\times\) Sampling size \(\times\) Number of channels \(\times\) Duration
- Sampling rate = \(44,100 \text{ Hz}\)
- Sampling size = \(16 \text{ bits} = 2 \text{ bytes}\)
- Channels = \(2\)
- Duration = \(2 \text{ minutes} = 120 \text{ seconds}\)
File size (in bytes) = \(44,100 \times 2 \text{ bytes} \times 2 \times 120 \text{ seconds} = 21,168,000 \text{ bytes}\).
Since \(1 \text{ MB} = 10^6 \text{ bytes}\), the file size is \(21,168,000 / 10^6 = 21.168 \text{ MB}\), which is approximately \(21.2 \text{ MB}\).
Marking scheme
Award 1 mark for the correct option (C). No marks are awarded for incorrect options.
Which of the following descriptions about different types of computer memory is/are correct?
(1) Cache memory is faster than main memory (RAM) and is used to store frequently accessed data.
(2) ROM is non-volatile and is typically used to store the BIOS/UEFI boot programs.
(3) RAM is volatile, meaning its content is lost when the power is turned off.
- A.(1) and (2) only
- B.(1) and (3) only
- C.(2) and (3) only
- D.(1), (2) and (3)
Worked solution
All three statements are correct:
- Statement (1) is correct: Cache memory is a high-speed static RAM (SRAM) that helps the CPU access frequently used data faster than from dynamic RAM (DRAM / main memory).
- Statement (2) is correct: Read-Only Memory (ROM) is non-volatile, retaining its contents when powered down, making it suitable for the system's firmware/boot loader.
- Statement (3) is correct: Random Access Memory (RAM) is volatile and requires power to maintain data.
Marking scheme
Award 1 mark for the correct option (D). No marks are awarded for incorrect options.
Alice wants to send a confidential document to Bob over the Internet. To ensure both **confidentiality** (only Bob can read the document) and **authenticity** (Bob can verify that Alice is the sender), which of the following encryption methods should Alice use?
- A.Encrypt the document using Alice's private key, then encrypt the result using Bob's public key.
- B.Encrypt the document using Bob's private key, then encrypt the result using Alice's public key.
- C.Encrypt the document using Alice's public key, then encrypt the result using Bob's private key.
- D.Encrypt the document using Bob's public key, then encrypt the result using Alice's public key.
Worked solution
To achieve both confidentiality and authenticity:
1. **Authenticity / Integrity**: Alice encrypts (signs) the document using her own private key. Since only Alice has her private key, anyone decrypting it using Alice's public key knows it must have originated from Alice.
2. **Confidentiality**: Alice then encrypts the result using Bob's public key. Since only Bob has his corresponding private key, only Bob can decrypt the outer layer.
Therefore, option A is correct. (Note: In practice, to optimize performance, symmetric key cryptography is used for the bulk document, but the logic of asymmetric key wrapping remains the same).
Marking scheme
Award 1 mark for the correct option (A). No marks are awarded for incorrect options.
A software company wants to deploy a web application. Instead of managing physical servers, they decide to rent virtual machines and storage from a cloud service provider, allowing them to install their own operating systems, databases, and application software. Which cloud computing service model are they utilizing?
- A.Software as a Service (SaaS)
- B.Platform as a Service (PaaS)
- C.Infrastructure as a Service (IaaS)
- D.Database as a Service (DBaaS)
Worked solution
Infrastructure as a Service (IaaS) provides virtualized computing resources (servers, virtual machines, storage, and networking) over the Internet. The customer maintains full control over the operating systems, databases, and runtime environments. In contrast, Platform as a Service (PaaS) abstracts away operating system and server management, and Software as a Service (SaaS) provides ready-to-use software applications directly.
Marking scheme
Award 1 mark for the correct option (C). No marks are awarded for incorrect options.
Which of the following are the typical tasks performed by an operating system (OS)?
(1) Allocating memory space to different running applications.
(2) Managing input/output devices using device drivers.
(3) Scanning files to detect and remove computer viruses.
- A.(1) and (2) only
- B.(1) and (3) only
- C.(2) and (3) only
- D.(1), (2) and (3)
Worked solution
- Statements (1) and (2) are correct: Memory management (allocating RAM to programs) and device management (communicating with hardware components via drivers) are fundamental tasks of an operating system.
- Statement (3) is incorrect: Scanning and removing computer viruses is performed by antivirus software, which is classified as utility software, not a core service/task of the operating system itself.
Marking scheme
Award 1 mark for the correct option (A). No marks are awarded for incorrect options.