Question 1 · Multiple Choice
1 marksWhich of the following 8-bit binary representations represents the decimal number -58 in two's complement representation?
- A.11000110
- B.11000101
- C.10111010
- D.10111011
Worked solution
To convert -58 to 8-bit two's complement:\n1. Find the binary representation of +58: \(58 = 32 + 16 + 8 + 2\), which is 00111010.\n2. Invert the bits (one's complement): 11000101.\n3. Add 1 to the result: 11000110.
Marking scheme
1 mark for the correct option A. No marks for incorrect choices.
Question 2 · Multiple Choice
1 marksIn a school database, there are two tables: STUDENT and CLASS.\nSTUDENT table: StudentID (Primary Key), Name, ClassID\nCLASS table: ClassID (Primary Key), ClassTeacher\nWhich of the following database operations will violate referential integrity?
- A.Inserting a new student record into STUDENT with an existing ClassID in the CLASS table.
- B.Updating a student's Name in the STUDENT table.
- C.Deleting a record from the CLASS table where the ClassID is currently assigned to some students in the STUDENT table.
- D.Deleting a record from the STUDENT table.
Worked solution
Referential integrity requires that a foreign key value must match an existing primary key value in the referenced table. If a record in the parent table (CLASS) is deleted while there are still matching records in the child table (STUDENT), the foreign key ClassID in STUDENT would refer to a non-existent primary key in CLASS, violating referential integrity.
Marking scheme
1 mark for correct option C.
Question 3 · Multiple Choice
1 marksWhich register stores the memory address of the next instruction to be fetched and executed by the CPU?
- A.Program Counter (PC)
- B.Instruction Register (IR)
- C.Memory Data Register (MDR)
- D.Accumulator (ACC)
Worked solution
The Program Counter (PC) is a dedicated CPU register that holds the memory address of the next instruction to be fetched and executed. Once the instruction is fetched, the PC is incremented to point to the next instruction.
Marking scheme
1 mark for correct option A.
Question 4 · Multiple Choice
1 marksWhich of the following statements about compilers and interpreters is correct?
- A.An interpreter translates the entire source code into machine code before execution, creating a standalone executable file.
- B.A compiler translates and executes the source code line by line, which makes debugging easier during program development.
- C.Compiled programs generally run faster than interpreted programs because translation is completed before execution.
- D.Interpreted programs do not require the interpreter to be present on the system during execution.
Worked solution
Compiled programs are already fully translated into machine code, allowing direct execution by the CPU at high speed. Interpreted programs must be translated line-by-line during runtime by an interpreter, which introduces overhead and requires the interpreter to be present.
Marking scheme
1 mark for correct option C.
Question 5 · Multiple Choice
1 marksAn IP address of a host is 192.168.10.45, and its subnet mask is 255.255.255.240. What is the network ID (subnet address) of the network to which this host belongs?
- A.192.168.10.0
- B.192.168.10.32
- C.192.168.10.40
- D.192.168.10.48
Worked solution
To find the network ID, perform a bitwise AND operation between the IP address and the subnet mask. For the fourth octet: IP = 45 (00101101 in binary), Mask = 240 (11110000 in binary). The bitwise AND is \(00101101 \text{ AND } 11110000 = 00100000\), which is 32 in decimal. Therefore, the network ID is 192.168.10.32.
Marking scheme
1 mark for correct option B.
Question 6 · Multiple Choice
1 marksIn public key cryptography, if Alice wants to send a confidential message to Bob, which key should Alice use to encrypt the message to ensure that only Bob can read it?
- A.Alice's private key
- B.Alice's public key
- C.Bob's private key
- D.Bob's public key
Worked solution
In public key cryptography, to ensure confidentiality, the sender (Alice) must encrypt the message using the recipient's (Bob's) public key. Only the recipient's private key (Bob's private key) can decrypt this message.
Marking scheme
1 mark for correct option D.
Question 7 · Multiple Choice
1 marksWhich of the following is an advantage of Radio Frequency Identification (RFID) technology over traditional barcodes?
- A.RFID tags require a direct line of sight between the reader and the tag to be scanned.
- B.Multiple RFID tags can be scanned simultaneously from a distance.
- C.RFID tags are much cheaper to manufacture and implement than barcode stickers.
- D.RFID tags cannot store read/write data and can only be used once.
Worked solution
RFID uses radio waves to transfer data, which does not require a direct line of sight. This allows readers to scan hundreds of RFID tags simultaneously and from a distance, whereas barcodes must be scanned individually with direct line of sight.
Marking scheme
1 mark for correct option B.
Question 8 · Multiple Choice
1 marksConsider the following pseudocode:\n\n```\nSet count = 0\nFor i From 1 To 4\n For j From i To 4\n count = count + (i * j)\n Next j\nNext i\n```\n\nWhat is the final value of `count` after executing the pseudocode?
- A.50
- B.65
- C.70
- D.100
Worked solution
Let's trace the nested loops:\n- \(i = 1\): \(j\) runs from 1 to 4. \(\text{count} = 0 + (1\times1 + 1\times2 + 1\times3 + 1\times4) = 10\).\n- \(i = 2\): \(j\) runs from 2 to 4. \(\text{count} = 10 + (2\times2 + 2\times3 + 2\times4) = 10 + 18 = 28\).\n- \(i = 3\): \(j\) runs from 3 to 4. \(\text{count} = 28 + (3\times3 + 3\times4) = 28 + 21 = 49\).\n- \(i = 4\): \(j\) runs from 4 to 4. \(\text{count} = 49 + (4\times4) = 49 + 16 = 65\).\nThus, the final value of `count` is 65.
Marking scheme
1 mark for correct option B.
Question 9 · Multiple Choice
1 marksA photographer publishes their photo under a 'CC BY-NC-ND' Creative Commons license. Which of the following acts is permitted under this license without obtaining additional permission?
- A.A school teacher prints the photo in a free school newsletter and gives credit to the photographer.
- B.A marketing firm uses the photo in a commercial advertisement with attribution.
- C.A graphic designer modifies the colors of the photo and publishes the edited version on a personal blog.
- D.A local business prints the photo on postcards and sells them to raise funds, attributing the photographer.
Worked solution
The license 'CC BY-NC-ND' stands for:\n- BY (Attribution): Credit must be given.\n- NC (Non-Commercial): Commercial use is prohibited.\n- ND (No Derivatives): Modifications are prohibited.\nOption A complies with all terms: it is non-commercial (free school newsletter), has no modifications, and attributes the photographer. Options B and D violate the NC clause, while Option C violates the ND clause.
Marking scheme
1 mark for correct option A.
Question 10 · Multiple Choice
1 marksThere is a database table `SALES` with the following columns: `SalespersonID`, `SaleAmount`, and `Region`.\nWhich of the following SQL statements finds the `Region` where the total sales amount exceeds 50000?
- A.`SELECT Region FROM SALES WHERE SUM(SaleAmount) > 50000 GROUP BY Region`
- B.`SELECT Region FROM SALES GROUP BY Region HAVING SUM(SaleAmount) > 50000`
- C.`SELECT Region FROM SALES GROUP BY Region WHERE SaleAmount > 50000`
- D.`SELECT Region, SUM(SaleAmount) FROM SALES WHERE SaleAmount > 50000`
Worked solution
In SQL, aggregate functions (such as `SUM`) cannot be used in a `WHERE` clause because the `WHERE` clause filters individual rows before grouping. To filter groups created by `GROUP BY` based on aggregate conditions, the `HAVING` clause must be used. Therefore, Option B is correct.
Marking scheme
1 mark for correct option B.
Question 11 · Multiple Choice
1 marksIn an 8-bit two's complement representation system, what is the result of adding the binary numbers representing the denary values \(-75\) and \(-85\)?
- A.The result is \(-160\), and no overflow occurs.
- B.The result is \(96\), and an overflow occurs.
- C.The result is \(-96\), and an overflow occurs.
- D.The result is \(-160\), and an overflow occurs.
Worked solution
In 8-bit two's complement, \(-75\) is represented as \(10110101_2\) and \(-85\) is represented as \(10101011_2\). Adding them gives: \(10110101_2 + 10101011_2 = 101100000_2\). Truncating to 8 bits gives \(01100000_2\), which is positive \(96_{10}\). Adding two negative numbers results in a positive number, which indicates that an arithmetic overflow has occurred.
Marking scheme
1 mark for the correct answer B. 0 marks for incorrect options.
Question 12 · Multiple Choice
1 marksAn IoT smart thermometer requires memory to store the following three items: (1) The bootloader program (startup code), (2) Real-time temperature logs collected over the last 24 hours, (3) The configured target temperature set by the user (which must persist even if the power is cut off). Which of the following combinations of memory types is the most suitable for storing each of these items respectively?
- A.(1) ROM, (2) RAM, (3) Flash Memory
- B.(1) RAM, (2) Flash Memory, (3) ROM
- C.(1) ROM, (2) Flash Memory, (3) RAM
- D.(1) Flash Memory, (2) ROM, (3) RAM
Worked solution
The bootloader (1) is non-volatile startup code, best stored in ROM. Real-time temperature logs (2) are frequently updated and do not need to persist permanently, so RAM is ideal. The user's configuration (3) needs to be non-volatile yet rewritable, making Flash Memory the most suitable.
Marking scheme
1 mark for the correct answer A. 0 marks for incorrect options.
Question 13 · Multiple Choice
1 marksA computer user notices that when they open too many large applications simultaneously, the hard disk activity light blinks constantly, and the system response becomes extremely slow. This phenomenon is known as 'thrashing'. Which of the following is the primary cause of thrashing?
- A.The operating system is constantly swapping pages between RAM and virtual memory on the disk.
- B.The computer's hard disk has too many fragmented files, requiring the disk head to move constantly.
- C.The CPU cache is too small to store the current instructions, forcing the CPU to read directly from the RAM.
- D.The device drivers of the active applications are conflicting, causing repeated software interrupts.
Worked solution
Thrashing occurs when the virtual memory system is overloaded, causing the operating system to spend more time swapping memory pages between RAM and the hard disk (paging file) than executing actual applications.
Marking scheme
1 mark for the correct answer A. 0 marks for incorrect options.
Question 14 · Multiple Choice
1 marksConsider two database tables: STUDENT (Student_ID, Name, Class, Club_ID) and CLUB (Club_ID, Club_Name, Teacher_In_Charge). 'Student_ID' and 'Club_ID' are the primary keys of STUDENT and CLUB respectively. 'Club_ID' in STUDENT is a foreign key referencing CLUB. Which of the following statements about referential integrity in this database is/are correct? (1) A new student record cannot be inserted with a Club_ID that does not exist in the CLUB table. (2) A club record cannot be deleted from the CLUB table if there are students currently registered with that Club_ID (assuming 'Restrict delete' is enforced). (3) A student's Club_ID can be set to NULL if joining a club is optional.
- A.(1) and (2) only
- B.(1) and (3) only
- C.(2) and (3) only
- D.(1), (2) and (3)
Worked solution
(1) is correct because referential integrity prevents foreign keys from referencing non-existent primary keys. (2) is correct because 'Restrict delete' prevents deletion of a primary record if there are child records referencing it. (3) is correct because if joining a club is optional, a NULL value is permitted in the foreign key field.
Marking scheme
1 mark for the correct answer D. 0 marks for incorrect options.
Question 15 · Multiple Choice
1 marksA database table SALES has records with schema: SALES (Transaction_ID, Product_Category, Amount, Salesperson). The records are: ('T101', 'Electronics', 1500, 'Alice'), ('T102', 'Furniture', 800, 'Bob'), ('T103', 'Electronics', 400, 'Alice'), ('T104', 'Clothing', 200, 'Charlie'), ('T105', 'Furniture', 1200, 'Bob'), ('T106', 'Electronics', 150, 'Charlie'). What is the output of the query: SELECT Salesperson, SUM(Amount) FROM SALES GROUP BY Salesperson HAVING COUNT(Transaction_ID) >= 2 AND AVG(Amount) > 500;
- A.Alice 1900, Bob 2000
- B.Alice 1900, Bob 2000, Charlie 350
- C.Alice 1500, Bob 1200
- D.Bob 2000
Worked solution
Grouping by Salesperson: 'Alice' has 2 transactions with sum 1900 and average 950. 'Bob' has 2 transactions with sum 2000 and average 1000. 'Charlie' has 2 transactions with sum 350 and average 175. The HAVING clause filters out groups where average amount is not greater than 500, which excludes Charlie. Thus, only Alice and Bob are returned with their sums.
Marking scheme
1 mark for the correct answer A. 0 marks for incorrect options.
Question 16 · Multiple Choice
1 marksWhich of the following statements about MAC (Media Access Control) addresses and IP (Internet Protocol) addresses is correct?
- A.A MAC address operates at the Network layer of the OSI model, while an IP address operates at the Data Link layer.
- B.A router uses MAC addresses to forward packets across different subnets, while a switch uses IP addresses to forward frames within a local area network (LAN).
- C.An IP address is typically assigned by a manufacturer and cannot be changed, whereas a MAC address is assigned by a network administrator or DHCP server.
- D.When a packet is forwarded from one router to another across the Internet, the destination IP address in the packet header remains the same, but the destination MAC address in the frame header changes at each hop.
Worked solution
During routing across subnets, the logical IP addresses (source and destination) remain constant to ensure end-to-end delivery. However, the physical MAC addresses in the Layer 2 frame header are updated at each hop (router) to direct the frame to the next intermediate node on the physical link.
Marking scheme
1 mark for the correct answer D. 0 marks for incorrect options.
Question 17 · Multiple Choice
1 marksIn secure online transactions, asymmetric encryption is widely used. Which of the following correctly describes the main purpose of using a digital signature?
- A.To encrypt the transactional data so that eavesdroppers cannot read the details.
- B.To verify the authenticity and integrity of the message, and to ensure non-repudiation.
- C.To store and protect the private key of the sender securely on a certificate authority's server.
- D.To establish a direct physical connection between the sender and the receiver's computer.
Worked solution
A digital signature is created by hashing the message and encrypting the hash with the sender's private key. The recipient can decrypt it with the sender's public key to verify that the message indeed came from the sender (authenticity), has not been altered (integrity), and cannot be denied by the sender (non-repudiation).
Marking scheme
1 mark for the correct answer B. 0 marks for incorrect options.
Question 18 · Multiple Choice
1 marksA school is developing a customized student portfolio system. Instead of purchasing physical servers, they decide to use a cloud service where they rent virtual machines with a pre-installed operating system and database management system, allowing their IT teachers to focus entirely on writing the system code and deploying the database. Which cloud service model are they using?
- A.Infrastructure as a Service (IaaS)
- B.Platform as a Service (PaaS)
- C.Software as a Service (SaaS)
- D.Network as a Service (NaaS)
Worked solution
Platform as a Service (PaaS) provides a computing platform, including operating system, programming language execution environment, database, and web server, which allows users to develop, run, and manage applications without the complexity of building and maintaining the infrastructure.
Marking scheme
1 mark for the correct answer B. 0 marks for incorrect options.
Question 19 · Multiple Choice
1 marksConsider the following algorithm: A is an array of integers [3, 8, 2, 7, 5]; N = 5; X = A[0]; Y = A[0]; For i from 1 to N - 1 do: If A[i] > X then X = A[i] Else if A[i] < Y then Y = A[i] End If End For; Print X - Y. What is the printed output of this algorithm?
- A.3
- B.5
- C.6
- D.8
Worked solution
The algorithm finds the maximum value (X) and minimum value (Y) of the array. During iteration: i=1: A[1]=8 > 3 -> X=8. i=2: A[2]=2 < 3 -> Y=2. i=3: A[3]=7 (no change). i=4: A[4]=5 (no change). Thus, X=8, Y=2. Finally, X - Y = 8 - 2 = 6.
Marking scheme
1 mark for the correct answer C. 0 marks for incorrect options.
Question 20 · Multiple Choice
1 marksConsider the following Python code to calculate the average of three test scores: score1 = 80; score2 = 90; score3 = 85; average = score1 + score2 + score3 / 3; print('The average is: ' + average). The programmer encounters two errors: (1) The calculated average is mathematically incorrect due to operator precedence, (2) The program crashes with a TypeError during runtime because of an attempt to concatenate a string and a float. Which of the following correctly classifies these two errors?
- A.(1) Logical error, (2) Runtime error
- B.(1) Syntax error, (2) Logical error
- C.(1) Runtime error, (2) Syntax error
- D.(1) Logical error, (2) Syntax error
Worked solution
Error (1) is a logical error because the program compiles and runs without crashing but produces incorrect logic (it calculates score1 + score2 + (score3/3) instead of (score1+score2+score3)/3). Error (2) causes the program to crash during execution due to unmatched types, which is classified as a runtime error.
Marking scheme
1 mark for the correct answer A. 0 marks for incorrect options.
What is the 8-bit two's complement representation of the decimal number \(-37\)?
- A.11011011
- B.11011010
- C.10100101
- D.11100101
Worked solution
To find the 8-bit two's complement of \(-37\): 1. Represent \(+37\) in 8-bit binary: \(00100101_2\). 2. Find the one's complement by inverting the bits: \(11011010_2\). 3. Add 1 to find the two's complement: \(11011010_2 + 1_2 = 11011011_2\).
Marking scheme
1 mark for the correct option. No marks for incorrect or multiple answers.
A database designer wants to ensure that a student record in the 'Student' table cannot be deleted if the student has already enrolled in any course in the 'Enrollment' table. Which integrity constraint should be applied?
- A.Entity integrity constraint
- B.Referential integrity constraint with CASCADE rule
- C.Referential integrity constraint with RESTRICT rule
- D.Domain integrity constraint with NOT NULL check
Worked solution
The referential integrity constraint ensures consistency between related tables. Under the RESTRICT rule (or NO ACTION), the system prevents the deletion of a record in the parent table ('Student') if there are corresponding matching records in the child table ('Enrollment').
Marking scheme
1 mark for the correct option. No marks for incorrect or multiple answers.
During the Fetch-Decode-Execute cycle, which register is used to store the address of the next instruction to be fetched from memory, and which register holds the instruction currently being decoded?
- A.Program Counter (PC) and Memory Data Register (MDR)
- B.Memory Address Register (MAR) and Instruction Register (IR)
- C.Program Counter (PC) and Instruction Register (IR)
- D.Accumulator (ACC) and Memory Data Register (MDR)
Worked solution
The Program Counter (PC) stores the address of the next instruction to be fetched. Once the instruction is fetched from memory, it is loaded into the Instruction Register (IR) where it is decoded and executed.
Marking scheme
1 mark for the correct option. No marks for incorrect or multiple answers.
A computer has an IP address of '192.168.10.45' and a subnet mask of '255.255.255.240'. Which of the following is the network address (subnet address) of this host?
- A.192.168.10.0
- B.192.168.10.32
- C.192.168.10.40
- D.192.168.10.48
Worked solution
The host part in the last octet is 45, which in binary is \(00101101_2\). The last octet of the subnet mask is 240, which is \(11110000_2\). Performing a bitwise AND operation: \(00101101_2 \text{ AND } 11110000_2 = 00100000_2\), which is 32 in decimal. Thus, the subnet address is '192.168.10.32'.
Marking scheme
1 mark for the correct option. No marks for incorrect or multiple answers.
To achieve both confidentiality and authenticity (non-repudiation) when Alice sends a message to Bob using public key cryptography, which of the following processes should Alice use?
- A.Encrypt the message with Alice's private key, and sign it with Bob's public key.
- B.Encrypt the message with Bob's public key, and sign it with Alice's private key.
- C.Encrypt the message with Alice's public key, and sign it with Bob's private key.
- D.Encrypt the message with Bob's private key, and sign it with Alice's public key.
Worked solution
To achieve confidentiality, Alice encrypts the message with Bob's public key so that only Bob can decrypt it with his private key. To achieve authenticity and non-repudiation, Alice signs the message with her private key, which anyone can verify using Alice's public key.
Marking scheme
1 mark for the correct option. No marks for incorrect or multiple answers.
Consider the following pseudocode which processes an array A of 6 elements: '[3, 8, 2, 7, 5, 10]':
N = 6
FOR i = 0 TO N-2
FOR j = i+1 TO N-1
IF A[i] < A[j] THEN
temp = A[i]
A[i] = A[j]
A[j] = temp
ENDIF
ENDFOR
ENDFOR
What is the content of array A immediately after the outer loop finishes its first iteration (where i = 0)?
- A.[8, 3, 2, 7, 5, 10]
- B.[10, 3, 2, 7, 5, 8]
- C.[10, 8, 7, 5, 3, 2]
- D.[3, 8, 2, 7, 5, 10]
Worked solution
When i = 0, the inner loop compares A[0] with A[j] for j from 1 to 5:
- j = 1: A[0] < A[1] (3 < 8) is true -> swap, A becomes [8, 3, 2, 7, 5, 10]
- j = 2: A[0] < A[2] (8 < 2) is false
- j = 3: A[0] < A[3] (8 < 7) is false
- j = 4: A[0] < A[4] (8 < 5) is false
- j = 5: A[0] < A[5] (8 < 10) is true -> swap, A becomes [10, 3, 2, 7, 5, 8].
Thus, at the end of i = 0, the array is [10, 3, 2, 7, 5, 8].
Marking scheme
1 mark for the correct option. No marks for incorrect or multiple answers.
A database table STUDENT has the attributes StudentID, Name, Class, Gender, and Score. Which of the following SQL statements correctly displays the Class and the number of female students for classes with more than 5 female students?
- A.SELECT Class, COUNT(*) FROM STUDENT WHERE Gender = 'F' GROUP BY Class HAVING COUNT(*) > 5;
- B.SELECT Class, COUNT(*) FROM STUDENT GROUP BY Class HAVING Gender = 'F' AND COUNT(*) > 5;
- C.SELECT Class, COUNT(*) FROM STUDENT WHERE Gender = 'F' AND COUNT(*) > 5 GROUP BY Class;
- D.SELECT Class, COUNT(*) FROM STUDENT GROUP BY Class WHERE Gender = 'F' HAVING COUNT(*) > 5;
Worked solution
Option (a) is correct. It filters female students first using WHERE, groups them by Class, and then uses HAVING to filter classes with more than 5 students. Option (b) fails because Gender is used in HAVING without being grouped. Option (c) fails because aggregate functions (COUNT) cannot be used in WHERE. Option (d) has incorrect SQL keyword ordering.
Marking scheme
1 mark for the correct option. No marks for incorrect or multiple answers.
An illustrator shares their digital artwork under a Creative Commons license. The terms of the license allow others to copy, distribute, and display the work, and also allow others to modify or build upon the work. However, any commercial use is forbidden, and any modified works must be shared under the same license terms. Which of the following Creative Commons licenses did the illustrator apply?
- A.CC BY-ND
- B.CC BY-NC-ND
- C.CC BY-NC-SA
- D.CC BY-SA
Worked solution
The restrictions are: attribution (BY, default in CC), non-commercial (NC), and share-alike (SA, modified works shared under same terms). Since modifying is allowed, ND (No Derivatives) is NOT applied. Therefore, the license is CC BY-NC-SA.
Marking scheme
1 mark for the correct option. No marks for incorrect or multiple answers.
Which of the following statements about Virtual Memory is/are correct?
(1) Virtual memory uses a portion of secondary storage (such as a hard disk or SSD) to simulate additional RAM.
(2) Increasing the size of virtual memory can speed up CPU instruction execution as effectively as increasing physical RAM.
(3) A "page fault" occurs when the requested memory page is not currently located in the physical RAM and needs to be fetched from secondary storage.
- A.(1) only
- B.(1) and (3) only
- C.(2) and (3) only
- D.(1), (2) and (3)
Worked solution
(1) is correct as virtual memory uses secondary storage to extend address space. (2) is incorrect because secondary storage is significantly slower than physical RAM; relying heavily on virtual memory causes 'thrashing' and slows down the system. (3) is correct by definition of a page fault.
Marking scheme
1 mark for the correct option. No marks for incorrect or multiple answers.
A web form requires users to enter a Hong Kong Identity Card (HKID) number. The system performs several validation checks on the input:
(1) Check if the input is not left blank.
(2) Check if the input format matches one or two uppercase letters, followed by six digits, and a single digit/letter in parentheses.
(3) Calculate and verify the check digit using a weighted formula based on the preceding characters.
Which of the following correctly identifies these validation checks?
- A.(1) Presence check, (2) Range check, (3) Type check
- B.(1) Presence check, (2) Format check, (3) Check digit validation
- C.(1) Type check, (2) Format check, (3) Range check
- D.(1) Range check, (2) Type check, (3) Check digit validation
Worked solution
(1) Checking if a mandatory field is filled is a presence check. (2) Checking if the characters follow a specific template is a format check. (3) Verifying the correctness of an embedded validation digit using a mathematical algorithm is a check digit validation.
Marking scheme
1 mark for the correct option. No marks for incorrect or multiple answers.
Question 31 · Multiple Choice
1 marksIf an 8-bit register uses 2's complement representation, what is the 8-bit binary result of the subtraction \(01001100_2 - 10110101_2\), and does overflow occur?
- A.\(10010111_2\), overflow occurs
- B.\(10010111_2\), overflow does not occur
- C.\(11001001_2\), overflow occurs
- D.\(11001001_2\), overflow does not occur
Worked solution
First, convert both numbers to decimal or compute in binary. \(A = 01001100_2 = 76_{10}\). \(B = 10110101_2\). Since MSB of \(B\) is 1, it is a negative number. Its magnitude is found by flipping the bits and adding 1: \(01001010 + 1 = 01001011_2 = 75_{10}\). Thus \(B = -75_{10}\). The subtraction is \(A - B = 76 - (-75) = 151_{10}\). The range of an 8-bit 2's complement system is \([-128, 127]\). Since 151 is outside this range, overflow occurs. Performing the subtraction in binary: \(01001100_2 - 10110101_2 = 01001100_2 + 01001011_2 = 10010111_2\). The result has a sign bit of 1, indicating a negative number, which conflicts with a positive result, confirming overflow.
Marking scheme
1 mark for the correct answer A.
Question 32 · Multiple Choice
1 marksWhich of the following statements about cache memory in a computer system are correct?
(1) It stores frequently used data and instructions to reduce the average time to access memory.
(2) It has a faster access speed than registers.
(3) It resides inside or very close to the CPU chip.
- A.(1) only
- B.(1) and (3) only
- C.(2) and (3) only
- D.(1), (2) and (3)
Worked solution
Statement (1) is correct as cache acts as a temporary buffer to speed up data access between CPU and RAM. Statement (2) is incorrect because registers are the fastest memory located directly inside the CPU core, which are faster than cache. Statement (3) is correct as cache memory is designed to be physically close to or integrated into the CPU to minimize latency.
Marking scheme
1 mark for the correct answer B.
Question 33 · Multiple Choice
1 marksConsider two database tables: `STUDENT(StudentID, Name, ClassID)` and `CLASS(ClassID, ClassTeacher, RoomNo)`. `StudentID` and `ClassID` are the primary keys of the respective tables. `ClassID` in `STUDENT` is a foreign key referencing `CLASS`. Which of the following operations will be rejected by the DBMS in order to maintain referential integrity?
(1) Inserting a new record into `STUDENT` with a `ClassID` that does not exist in `CLASS`.
(2) Deleting a record from `CLASS` whose `ClassID` is currently assigned to some students in `STUDENT`.
(3) Deleting a record from `STUDENT`.
- A.(1) only
- B.(2) only
- C.(1) and (2) only
- D.(1), (2) and (3)
Worked solution
Operation (1) is rejected because the foreign key in `STUDENT` must reference an existing primary key in `CLASS`. Operation (2) is rejected because deleting a parent record that has associated child records would leave orphan records in `STUDENT`, violating referential integrity. Operation (3) is allowed because deleting a record from a child table does not violate any referential integrity constraints.
Marking scheme
1 mark for the correct answer C.
Question 34 · Multiple Choice
1 marksA subnet of a school network has the IP address `192.168.10.32` with a subnet mask of `255.255.255.240`. Which of the following is/are valid IP address(es) for host computers on this subnet?
(1) `192.168.10.35`
(2) `192.168.10.45`
(3) `192.168.10.47`
- A.(1) only
- B.(1) and (2) only
- C.(2) and (3) only
- D.(1), (2) and (3)
Worked solution
The subnet mask is `255.255.255.240`. The last octet has 4 subnet bits and 4 host bits. With 4 host bits, there are \(2^4 = 16\) addresses per subnet. For the subnet starting at `192.168.10.32`:
- Subnet/Network Address: `192.168.10.32`
- First usable host address: `192.168.10.33`
- Last usable host address: `192.168.10.46`
- Broadcast Address: `192.168.10.47`
Therefore, `192.168.10.35` and `192.168.10.45` are valid host addresses. `192.168.10.47` is the broadcast address, which cannot be assigned to a host computer. Hence, (1) and (2) only.
Marking scheme
1 mark for the correct answer B.
Question 35 · Multiple Choice
1 marksAlice wants to send an encrypted and digitally signed email to Bob. She wants to ensure confidentiality (only Bob can decrypt and read it) and authenticity (Bob can verify the email was sent by Alice). Which keys should Alice use to encrypt the email message and to create the digital signature respectively?
- A.Encrypt message: Bob's private key; Create signature: Alice's public key
- B.Encrypt message: Alice's private key; Create signature: Bob's public key
- C.Encrypt message: Bob's public key; Create signature: Alice's private key
- D.Encrypt message: Alice's public key; Create signature: Bob's private key
Worked solution
To achieve confidentiality, Alice must encrypt the message with the recipient's public key (Bob's public key), so that only the corresponding private key (Bob's private key) can decrypt it. To achieve authenticity, Alice must sign the message using her own private key (Alice's private key). Bob can then verify this signature using Alice's public key.
Marking scheme
1 mark for the correct answer C.
Question 36 · Multiple Choice
1 marksConsider the following pseudocode algorithm:
```
A = 45
B = 12
COUNT = 0
While A >= B Do
A = A - B
COUNT = COUNT + 1
EndWhile
```
What are the values of `A` and `COUNT` after the execution of the algorithm?
- A.`A = 21`, `COUNT = 2`
- B.`A = 0`, `COUNT = 3`
- C.`A = 9`, `COUNT = 4`
- D.`A = 9`, `COUNT = 3`
Worked solution
Let's dry run the algorithm:
- Initial: `A = 45`, `B = 12`, `COUNT = 0`
- Loop 1: `A >= B` (45 >= 12 is True)
- `A = 45 - 12 = 33`
- `COUNT = 0 + 1 = 1`
- Loop 2: `A >= B` (33 >= 12 is True)
- `A = 33 - 12 = 21`
- `COUNT = 1 + 1 = 2`
- Loop 3: `A >= B` (21 >= 12 is True)
- `A = 21 - 12 = 9`
- `COUNT = 2 + 1 = 3`
- Loop 4: `A >= B` (9 >= 12 is False). The loop terminates.
- Final values: `A = 9`, `COUNT = 3`.
Marking scheme
1 mark for the correct answer D.
Question 37 · Multiple Choice
1 marksA school registration system requires users to enter a student's date of birth in the format `DD/MM/YYYY`. Which of the following validation checks can be applied to verify the correctness of the input?
(1) Format check to ensure the input contains forward slashes at correct positions.
(2) Range check to ensure the month `MM` is between 1 and 12.
(3) Verification check by double entry of the date of birth.
- A.(1) and (3) only
- B.(2) and (3) only
- C.(1) and (2) only
- D.(1), (2) and (3)
Worked solution
Validation checks are automated procedures carried out by a computer to identify invalid data. (1) Format check and (2) Range check are validation techniques. (3) Double entry is a data verification method, which is used to check if data has been copied or entered accurately, but is not a system-automated validation rule on the input string format itself. Thus, (1) and (2) only.
Marking scheme
1 mark for the correct answer C.
Question 38 · Multiple Choice
1 marksIn an operating system, what is the main purpose of "paging" in virtual memory management?
- A.To compress data stored in the RAM to save system resources
- B.To automatically defragment the storage device to improve direct access speed
- C.To ensure that multiple active processes can write to the exact same physical memory address simultaneously without conflict
- D.To divide physical and virtual memory into fixed-size blocks to allow non-contiguous physical memory allocation to processes
Worked solution
Paging is a memory management scheme that eliminates the need for contiguous allocation of physical memory. It divides physical memory into fixed-size blocks (called page frames) and virtual memory into same-sized blocks (called pages), allowing the operating system to store processes in non-contiguous physical memory locations.
Marking scheme
1 mark for the correct answer D.
Question 39 · Multiple Choice
1 marksA programmer wants to release their software under a Creative Commons license. They want to allow others to copy, distribute, and display the software, but only if they give the programmer proper credit, do not use it for commercial purposes, and do not make any derivative works (no modifications). Which combination of Creative Commons terms should the programmer choose?
- A.CC BY-NC-SA
- B.CC BY-NC-ND
- C.CC BY-SA-ND
- D.CC BY-NC
Worked solution
To require giving proper credit, the programmer needs 'Attribution' (BY). To restrict usage to non-commercial activities, the programmer needs 'Non-Commercial' (NC). To prevent modification/creation of derivative works, the programmer needs 'No Derivatives' (ND). Therefore, the correct combination is CC BY-NC-ND.
Marking scheme
1 mark for the correct answer B.
Question 40 · Multiple Choice
1 marksConsider a database table `SALES(SalesID, ProductID, Region, Amount)`. Which SQL query can find the regions where the total sales amount exceeds 50,000?
- A.SELECT Region FROM SALES WHERE SUM(Amount) > 50000 GROUP BY Region
- B.SELECT Region FROM SALES GROUP BY Region HAVING SUM(Amount) > 50000
- C.SELECT Region FROM SALES WHERE Amount > 50000 GROUP BY Region
- D.SELECT Region FROM SALES GROUP BY Region WHERE SUM(Amount) > 50000
Worked solution
To calculate the total sales amount per region, we must group the records by `Region` using `GROUP BY Region`. To filter the groups based on an aggregate condition (sum of amount > 50000), we must use the `HAVING` clause because `WHERE` cannot be used with aggregate functions like `SUM()`. Therefore, Option B is correct.
Marking scheme
1 mark for the correct answer B.