AQA IGCSE · thinka 原創模擬試題

2018 AQA IGCSE Computer Science (9210) 模擬試題連答案詳解

Thinka Specimen 2018 Oxford AQA International GCSE-Style Mock — Computer Science (9210)

160 240 分鐘2018
An original Thinka practice paper modelled on the structure and difficulty of the Specimen 2018 Oxford AQA International GCSE Computer Science (9210) paper. Not affiliated with or reproduced from Oxford.

卷一 甲部 (Non-programming analysis)

Answer all questions. You must refer to the Skeleton Program and preliminary material to analyze data types, scope, subroutines, and basic operations.
7 題目 · 14
題目 1 · Short Answer
2
The Skeleton Program uses a variable IsGameOver of Boolean type. Explain how a Boolean variable differs from a String variable.
查看答案詳解

解題

1 mark: Boolean can only hold True/False (or 1/0, representing a binary state).
1 mark: String can hold multiple/sequence of alphanumeric characters (or text).

評分準則

1 mark: For identifying that Boolean only stores True/False (two states).
1 mark: For identifying that String stores a sequence of characters (text).
題目 2 · Short Answer
2
The subroutine ProcessMove has parameters defined in its header. Explain the difference between a parameter and an argument.
查看答案詳解

解題

1 mark: Parameter is the placeholder/identifier in the subroutine definition.
1 mark: Argument is the actual value/variable passed during the function call.

評分準則

1 mark: Parameter definition (variable name in header).
1 mark: Argument definition (actual data passed on call).
題目 3 · Short Answer
2
Describe the lifetime of a local variable declared inside the subroutine RollDie.
查看答案詳解

解題

1 mark: Created when subroutine is called/starts.
1 mark: Destroyed/deleted/reclaimed when subroutine ends.

評分準則

1 mark: For stating it only exists/is created when the subroutine is executed.
1 mark: For stating it is destroyed/ceases to exist when the subroutine terminates.
題目 4 · Short Answer
2
In a scoring subroutine, the division operation TotalScore DIV 10 (or TotalScore // 10 in Python) is used. Explain how this operation differs from the standard division operation /.
查看答案詳解

解題

1 mark: DIV/integer division discards the remainder/fractional part to return an integer.
1 mark: Standard division / returns a decimal/real/float value.

評分準則

1 mark: Explaining DIV returns a whole number / truncates fractional part.
1 mark: Explaining standard division retains the decimal/fractional part / returns a real number.
題目 5 · Short Answer
2
The Skeleton Program defines a constant BOARD_SIZE = 100. Explain two benefits of using a named constant instead of the literal value 100 throughout the code.
查看答案詳解

解題

Any two from: Increases readability/understandability of code; Easier to maintain/update (only change once); Prevents accidental modification during execution.

評分準則

1 mark per valid benefit (Max 2):
- Improves readability (gives meaning to the number 100);
- Easier to maintain/update the value in a single location;
- Prevents accidental changes to the value during program run.
題目 6 · Short Answer
2
The subroutine GetChoice is a function, whereas DisplayBoard is a procedure. Explain how a function differs from a procedure.
查看答案詳解

解題

1 mark: Function returns a value.
1 mark: Procedure does not return a value.

評分準則

1 mark: Function returns a value (using return statement).
1 mark: Procedure executes code/performs a task without returning a value (or returns control only).
題目 7 · Short Answer
2
The subroutine ValidateChoice uses a while loop to repeat a prompt until the user enters a valid option. Explain why a while loop (indefinite iteration) is more appropriate here than a for loop (definite iteration).
查看答案詳解

解題

1 mark: The number of incorrect inputs is unknown/not fixed in advance.
1 mark: A for loop requires knowing the number of iterations beforehand.

評分準則

1 mark: Indefinite iteration/while is used when the number of loops is not known beforehand (depends on user behavior).
1 mark: Definite iteration/for loop is used when the number of repeats is fixed/known in advance.

卷一 乙部 (Short programming modifications)

Apply code modifications to the existing subroutines in the Skeleton Program to output specified messages, validate moves, or change conditional controls. Provide source code and verification screenshots.
5 題目 · 30
題目 1 · Structured
6
The game is to be updated so that rolling a maximum value of 6 on the die triggers a 'Super Roll'. When a player rolls a 6, they are awarded an extra 6 spaces, meaning they move 12 spaces in total on that turn.

Modify the subroutine `MakeMove` so that if the die roll is 6, the program:
1. Prints the message `"Super Roll! Moving 12 spaces."`
2. Adds 12 to the player's position instead of the normal `DieValue`.

If the roll is any other number, the program should function normally.

Provide your amended program source code for `MakeMove`.
查看答案詳解

解題

The solution requires inserting a conditional statement (`if`) after the die value is generated. If `DieValue` is equal to 6, the message `"Super Roll! Moving 12 spaces."` is printed, and `CurrentPlayerPosition` is incremented by 12. Otherwise, `CurrentPlayerPosition` is incremented by `DieValue` as normal.

評分準則

1 mark: Correctly checking if `DieValue` is equal to 6.
1 mark: Printing the message `"Super Roll! Moving 12 spaces."` inside the correct conditional branch.
1 mark: Adding 12 to `CurrentPlayerPosition` when `DieValue` is 6.
1 mark: Correct `else` structure to add `DieValue` when it is not 6.
2 marks: Correct indentation and syntax maintaining the overall structure of `MakeMove`.
題目 2 · Structured
6
The game is to be improved to warn players when they are close to a hazard. If a player is positioned within 3 squares below a snake (i.e., their position is 1, 2, or 3 squares away from the start of a snake), a warning message should be displayed before they roll.

In our game, snakes are represented by negative values in the `Board` array.
Modify the subroutine `MakeMove` to check if any of the three squares immediately ahead of the player (i.e., `CurrentPlayerPosition + 1`, `CurrentPlayerPosition + 2`, and `CurrentPlayerPosition + 3`) contains a snake (a value less than 0 in the `Board` array). If a snake is detected, display the message: `"CAUTION: Snake nearby!"` once. Ensure you do not check indices beyond the board size (99).

Provide your amended program source code for `MakeMove`.
查看答案詳解

解題

Before the player takes their turn, the program iterates through the next three indices (`CurrentPlayerPosition + 1` to `+ 3`). If any index is within the board boundaries and holds a value less than 0 (representing a snake), a flag `snake_nearby` is set to `True`. If `snake_nearby` is `True`, the caution message is printed.

評分準則

1 mark: Correctly iterating over or checking the next three positions (`+1`, `+2`, `+3`).
1 mark: Ensuring no index out of bounds error occurs (checking index <= 99).
1 mark: Identifying a snake by checking if `Board[index] < 0`.
1 mark: Displaying the caution message `"CAUTION: Snake nearby!"` exactly once when a snake is detected.
2 marks: Correct integration into the start of the `MakeMove` subroutine without altering the existing move mechanism.
題目 3 · Structured
6
To make the game more exciting, an 'Underdog Bonus' is to be introduced. At the start of a player's turn, if they are currently trailing the other player by more than 15 squares, they receive a +1 bonus to their die roll.

Modify the subroutine `MakeMove` to accept the opponent's position as an additional parameter, and use it to implement this feature. If active, display the message: `"Underdog Bonus Active! +1 added to roll."`.

Provide your amended program source code for `MakeMove` and how it is called in `PlayGame`.
查看答案詳解

解題

To implement the Underdog Bonus:
1. Pass the opponent's position to `MakeMove`.
2. Check if `OpponentPlayerPosition - CurrentPlayerPosition > 15`.
3. If true, set a `bonus` variable to 1 and print the message.
4. Add the `bonus` to `CurrentPlayerPosition` when updating it with `DieValue`.

評分準則

1 mark: Modifying the `MakeMove` definition to accept the opponent's position as a parameter.
1 mark: Updating the subroutine call in `PlayGame` to pass the correct opponent's position.
1 mark: Checking if the difference between opponent's position and current player's position is strictly greater than 15.
1 mark: Printing the correct message `"Underdog Bonus Active! +1 added to roll."`.
1 mark: Adding the +1 bonus to the player's movement.
1 mark: Ensuring the bonus is not applied during testing 'J' (jump) moves.
題目 4 · Structured
6
The game is to be modified with a 'Trap' mechanism. If a player lands on the exact same square that the other player is currently occupying (except for the starting square 0), they are trapped. The landing player is pushed back by 3 squares, and a message is displayed: `"Trap! Occupied square. Back 3 spaces."`

Modify the subroutine `PlayGame` to implement this check immediately after a player has completed their move (after calling `MakeMove` and resolving any snake/ladder transitions).

Provide your amended program source code for `PlayGame`.
查看答案詳解

解題

In `PlayGame`, after updating `PlayerPositions[PlayerNum]` using `MakeMove`, we find the index of the other player (`OpponentNum = (PlayerNum + 1) % 2`). If both positions are equal and not 0, the message is printed, and the current player's position is decremented by 3. We use `max(0, ...)` to ensure the position does not become negative.

評分準則

1 mark: Identifying the opponent's index/position correctly.
1 mark: Testing if both players are on the same square.
1 mark: Ensuring the trap does not trigger on the start square (0).
1 mark: Printing the message `"Trap! Occupied square. Back 3 spaces."`.
1 mark: Moving the landing player back by 3 spaces.
1 mark: Ensuring the position does not become negative (using a check or `max(0, ...)`).
題目 5 · Structured
6
The game developers want to introduce a single 'Golden Ladder' to the board. The Golden Ladder must start at a random square between 10 and 50 (inclusive). It must have a fixed length of 30 squares.

Modify the subroutine `PlaceSnakesAndLadders` so that:
1. It selects a random start position for the Golden Ladder between 10 and 50.
2. It checks if the selected start position is empty (contains 0). If not, it repeatedly selects a new start position until an empty square is found.
3. It places the Golden Ladder by assigning the value 30 to that index in the `Board` array, and displays the message: `"Golden Ladder placed at square X"` where X is the starting square.

Provide your amended program source code for `PlaceSnakesAndLadders`.
查看答案詳解

解題

We use Python's `random.randint(10, 50)` to choose a start square. A `while` loop ensures that if the chosen square is already occupied (i.e. `Board[golden_start] != 0`), it picks a new one. Once an empty square is found, the value 30 is assigned to `Board[golden_start]` and the message is printed.

評分準則

1 mark: Generating a random starting square in the range 10 to 50 inclusive using `random.randint` or equivalent.
1 mark: Using a loop (`while`) to check if the chosen square is already occupied.
1 mark: Re-selecting a random start position inside the loop.
1 mark: Assigning the value 30 to the correct index in the `Board` array.
1 mark: Printing the message `"Golden Ladder placed at square X"` with the correct variable value.
1 mark: Placing this code within `PlaceSnakesAndLadders` and returning the modified `Board` correctly.

卷一 部分 C (Longer programming features)

Implement complete new features by either authoring new subroutines with parameter passing or dynamically updating the board state using random generation libraries.
2 題目 · 30
題目 1 · practical
15
A new hazard called "Meteor Strike" is to be implemented in the game.

After every 5 turns (i.e. when `TurnCount` is a multiple of 5), a meteor strike occurs on the board.

The meteor strikes a random square on the board from index 10 to 89 inclusive.

- If a player is currently on the square that is struck, they are immediately moved back 10 squares (but not below square 0).
- If the struck square contains a wormhole or any other board shortcut, its effect is destroyed (the value in the `Board` array at that index is set to 0).
- A suitable message should be displayed informing players of the strike location and any consequences.

Create a new subroutine called `ProcessMeteorStrike` to implement this feature. This subroutine should:
1. Generate a random square number for the strike location.
2. Check if either player is on that square and update their position if necessary.
3. Clear any existing shortcuts on that square by updating the `Board` array.
4. Display appropriate messages.

The positions of the players, the `Board` array, and the current turn count should be passed as parameters. The subroutine should return the updated `Board` array and player positions.

The new subroutine should be called from the `PlayGame` subroutine after both players have completed their turns in a round.

Describe how you would design and implement this subroutine, providing the algorithm or pseudocode for `ProcessMeteorStrike` and showing where it should be integrated into the `PlayGame` subroutine loop.
查看答案詳解

解題

### Python 3 Implementation Example

```python
import random

def ProcessMeteorStrike(Board, PlayerPositions, TurnCount):
if TurnCount % 5 == 0:
# 1. Generate random strike location between 10 and 89
strike_zone = random.randint(10, 89)
print(f"ALERT: A meteor has struck square {strike_zone}!")

# 2. Check and update player positions
for i in range(len(PlayerPositions)):
if PlayerPositions[i] == strike_zone:
PlayerPositions[i] = max(0, PlayerPositions[i] - 10)
print(f"Player {i} was caught in the blast and blown back to square {PlayerPositions[i]}!")

# 3. Clear any shortcut/hazard at this square
if Board[strike_zone] != 0:
Board[strike_zone] = 0
print(f"The shortcut/hazard on square {strike_zone} was destroyed by the impact.")

return Board, PlayerPositions
```

### Integration in `PlayGame`

```python
# Inside PlayGame loop, after turns are completed:
TurnCount += 1
Board, PlayerPositions = ProcessMeteorStrike(Board, PlayerPositions, TurnCount)
```

評分準則

Marks are awarded as follows:
- **[3 marks]**: Correct subroutine header for `ProcessMeteorStrike` accepting all three required parameters (`Board`, `PlayerPositions`, `TurnCount`).
- **[2 marks]**: Correct generation of random strike index using a valid range (10 to 89 inclusive).
- **[3 marks]**: Correct logic to check both players' positions against the strike zone and deduct 10 squares, ensuring the position never falls below 0 (e.g. using `max(0, pos - 10)` or conditional checks).
- **[2 marks]**: Correctly updating the `Board` array at the strike index to 0 to remove any existing shortcuts/hazards.
- **[2 marks]**: Clear and appropriate console messages outputting the strike location and the impact details.
- **[2 marks]**: Correctly calling `ProcessMeteorStrike` from `PlayGame` with the appropriate parameters, conditioned on `TurnCount % 5 == 0`.
- **[1 mark]**: Returning the updated `Board` and `PlayerPositions` back to the calling routine.
題目 2 · practical
15
A new feature is to be implemented where "Mystery Chests" are placed on the board.

- A "Mystery Chest" is represented by the value `50` in the `Board` array.
- When a player lands on a Mystery Chest square, a random effect is triggered. The chest is then consumed (the board square value becomes 0).
- There are three possible random effects, each with an equal probability of occurring:
1. **"Teleport"**: The player is moved to a random square between 20 and 80.
2. **"Zap"**: The player is moved back to square 0.
3. **"Double"**: The player immediately rolls the die again and moves forward by that amount.

Create a new subroutine called `TriggerMysteryChest`. This subroutine should:
- Check if the player has landed on a Mystery Chest (value 50).
- If so, display a message: "You found a Mystery Chest!"
- Select one of the three random effects with equal probability.
- Implement the logic for the chosen effect (including rolling the die for "Double" or generating the random square for "Teleport").
- Set the value of the chest's square in the `Board` array to 0.
- Display a message indicating which effect was triggered and the player's new position.

The active player's position, the active player's index, and the `Board` array should be passed as parameters. The subroutine should return the updated player position and the updated `Board` array.

This subroutine should be called from the `PlayGame` subroutine after a player's move has been finalized (including any snake or ladder movements).

Describe how you would design and implement this subroutine, providing the algorithm or pseudocode for `TriggerMysteryChest` and showing where it should be integrated into the `PlayGame` subroutine loop.
查看答案詳解

解題

### Python 3 Implementation Example

```python
import random

def TriggerMysteryChest(PlayerPos, PlayerIdx, Board):
if Board[PlayerPos] == 50:
print(f"Player {PlayerIdx} found a Mystery Chest!")
# Consume chest
Board[PlayerPos] = 0

# Equal probability for three effects
effect = random.randint(1, 3)

if effect == 1: # Teleport
new_pos = random.randint(20, 80)
PlayerPos = new_pos
print(f"Effect: Teleport! Player {PlayerIdx} was teleported to square {PlayerPos}.")
elif effect == 2: # Zap
PlayerPos = 0
print(f"Effect: Zap! Player {PlayerIdx} was sent back to square 0.")
elif effect == 3: # Double
die_roll = random.randint(1, 6)
PlayerPos += die_roll
print(f"Effect: Double! Player {PlayerIdx} rolled a {die_roll} and moved to square {PlayerPos}.")

return PlayerPos, Board
```

### Integration in `PlayGame`

```python
# Inside PlayGame loop, after a player makes their move:
PlayerPositions[PlayerNum], Board = TriggerMysteryChest(PlayerPositions[PlayerNum], PlayerNum, Board)
```

評分準則

Marks are awarded as follows:
- **[3 marks]**: Correct subroutine declaration with appropriate parameter list (`PlayerPos`, `PlayerIdx`, `Board`).
- **[1 mark]**: Correct logic checking if the current square has the chest value (50).
- **[2 marks]**: Generation of a random choice (1 to 3) representing the three equal-probability outcomes.
- **[2 marks]**: Correct implementation of the "Teleport" effect (generating a random destination between 20 and 80, and updating position).
- **[1 mark]**: Correct implementation of the "Zap" effect (resetting player position to 0).
- **[3 marks]**: Correct implementation of the "Double" effect (generating a die roll between 1 and 6, and advancing the player).
- **[1 mark]**: Setting the chest square value to 0 in the `Board` array to ensure it is consumed.
- **[1 mark]**: Outputting clear descriptive messages for each event.
- **[1 mark]**: Returning the updated position and board variables.

卷二 Concepts and Principles

Answer all questions in the spaces provided. Covers binary representations, hardware and secondary storage, networking protocols, tracing algorithms, and web page styles.
24 題目 · 82
題目 1 · Mathematical Conversions and Arithmetic
1.5
A system uses an unsigned 8-bit binary representation. Convert the binary value 01101101 to its decimal representation. Show your working.
查看答案詳解

解題

The binary value 01101101 is converted to decimal as follows: \(0 \times 128 + 1 \times 64 + 1 \times 32 + 0 \times 16 + 1 \times 8 + 1 \times 4 + 0 \times 2 + 1 \times 1 = 64 + 32 + 8 + 4 + 1 = 109\).

評分準則

0.5 marks for showing any correct place values or correct addition steps (e.g., \(64 + 32 + 8 + 4 + 1\)).
1.0 mark for the correct final answer (109).
題目 2 · Mathematical Conversions and Arithmetic
1.5
Convert the hexadecimal number A5 to an 8-bit binary number.
查看答案詳解

解題

Each hexadecimal digit represents 4 bits: A in decimal is 10, which is binary 1010. 5 is binary 0101. Combining them gives 10100101.

評分準則

0.5 marks for converting either digit correctly to binary (A as 1010 or 5 as 0101).
1.0 mark for the correct combined 8-bit binary representation (10100101).
題目 3 · Mathematical Conversions and Arithmetic
1.5
Perform binary addition on the two unsigned 6-bit binary numbers 011011 and 001101. Show your working.
查看答案詳解

解題

Add the numbers from right to left:
011011 (27)
+ 001101 (13)
--------
101000 (40)

Carries are generated at positions 2, 3, 4, 5, and 6 (from right to left).

評分準則

0.5 marks for showing the correct carrying process.
1.0 mark for the correct binary sum (101000).
題目 4 · Mathematical Conversions and Arithmetic
1.5
An image has a resolution of 16 by 16 pixels. Each pixel can be one of 16 different colors. Calculate the minimum file size of the image data in bytes. Show your working.
查看答案詳解

解題

16 different colors require 4 bits per pixel (\(\log_2(16) = 4\)).
Total pixels = \(16 \times 16 = 256\) pixels.
Total size in bits = \(256 \times 4 = 1024\) bits.
Total size in bytes = \(1024 / 8 = 128\) bytes.

評分準則

0.5 marks for identifying that 4 bits are needed per pixel or calculating total bits (1024 bits).
1.0 mark for the correct final answer in bytes (128).
題目 5 · Mathematical Conversions and Arithmetic
1.5
A row of a black-and-white bitmap image has the following pixel values where W represents white and B represents black: WWWWWWBBBBWWBBBBBB. Calculate the number of bytes needed to store this row if it is compressed using Run-Length Encoding (RLE) with 1 byte for the count and 1 byte for the character.
查看答案詳解

解題

The sequence 'WWWWWWBBBBWWBBBBBB' has four runs:
1. 'WWWWWW' -> 6W (2 bytes)
2. 'BBBB' -> 4B (2 bytes)
3. 'WW' -> 2W (2 bytes)
4. 'BBBBBB' -> 6B (2 bytes)
Total = \(2 \times 4 = 8\) bytes.

評分準則

0.5 marks for showing the correct representation of the runs (e.g. 6W, 4B, 2W, 6B).
1.0 mark for the correct total number of bytes (8).
題目 6 · Mathematical Conversions and Arithmetic
1.5
A plain text file contains exactly 150 standard English characters. If the file is saved using standard 7-bit ASCII representation, calculate the minimum storage space required for the text in bits.
查看答案詳解

解題

Since each character in standard ASCII requires 7 bits, the storage space for 150 characters is \(150 \times 7 = 1050\) bits.

評分準則

0.5 marks for showing the calculation \(150 \times 7\).
1.0 mark for the correct final answer (1050).
題目 7 · Mathematical Conversions and Arithmetic
1.5
A secondary storage device has 3 Megabytes (MB) of available space. Calculate how many files of size 150 Kilobytes (KB) can be stored on this device. Assume 1 MB = 1000 KB. Show your working.
查看答案詳解

解題

First, convert the available space from Megabytes to Kilobytes:
\(3 \text{ MB} \times 1000 = 3000 \text{ KB}\).
Now, divide the total capacity by the file size:
\(3000 \text{ KB} / 150 \text{ KB} = 20\) files.

評分準則

0.5 marks for correctly converting 3 MB to 3000 KB.
1.0 mark for the correct number of files (20).
題目 8 · Mathematical Conversions and Arithmetic
1.5
A network connection has a transmission speed of 10 Megabits per second (Mbps). Calculate the time in seconds it will take to transmit a file of size 5 Megabytes (MB). Assume 1 Byte = 8 bits and 1 MB = 1,000,000 Bytes (and 1 Mbps = 1,000,000 bits per second).
查看答案詳解

解題

Convert the file size to bits:
\(5 \text{ MB} = 5,000,000 \text{ Bytes}\).
\(5,000,000 \times 8 = 40,000,000 \text{ bits}\).
Divide the total bits by the transmission speed:
\(40,000,000 \text{ bits} / 10,000,000 \text{ bits per second} = 4 \text{ seconds}\).

評分準則

0.5 marks for showing correct conversion of Megabytes to bits (40,000,000 bits).
1.0 mark for the correct transmission time in seconds (4).
題目 9 · Mathematical Conversions and Arithmetic
1.5
Convert the hexadecimal number \( \text{B}5 \) into an 8-bit binary number.
查看答案詳解

解題

1. Convert the first hexadecimal digit B (which is 11 in denary) to its 4-bit binary equivalent: 1011. 2. Convert the second hexadecimal digit 5 to its 4-bit binary equivalent: 0101. 3. Combine the two half-bytes (nibbles) together to form the 8-bit binary string: 10110101.

評分準則

1 mark for correctly converting at least one hexadecimal digit to its correct 4-bit binary equivalent (either B to 1011 or 5 to 0101). 0.5 marks for providing the correct final 8-bit binary sequence of 10110101.
題目 10 · Mathematical Conversions and Arithmetic
1.5
Calculate the sum of the two 8-bit binary numbers 01101100 and 00101110 using binary addition, and write down your final answer in binary format.
查看答案詳解

解題

Set up the columns for binary addition: 01101100 (108 in denary) + 00101110 (46 in denary). Add column-by-column starting from the least significant bit (right to left), carrying over 1 as necessary: Column 1 (2^0): 0 + 0 = 0. Column 2 (2^1): 0 + 1 = 1. Column 3 (2^2): 1 + 1 = 0 (carry 1). Column 4 (2^3): 1 + 1 + 1 (carry) = 1 (carry 1). Column 5 (2^4): 0 + 0 + 1 (carry) = 1. Column 6 (2^5): 1 + 1 = 0 (carry 1). Column 7 (2^6): 1 + 0 + 1 (carry) = 0 (carry 1). Column 8 (2^7): 0 + 0 + 1 (carry) = 1. The resulting binary string is 10011010, which represents 154 in denary.

評分準則

1 mark for showing correct working with the carry bits for at least three column additions. 0.5 marks for the correct final binary string of 10011010.
題目 11 · Mathematical Conversions and Arithmetic
1.5
An image consisting of only black and white pixels has a width of 24 pixels and a height of 16 pixels. Determine the smallest memory storage size in bytes needed for this bitmap file, assuming no overhead or metadata.
查看答案詳解

解題

1. Find the total number of pixels in the image: 24 pixels * 16 pixels = 384 pixels. 2. A black and white image uses a color depth of 1 bit per pixel, which means 384 pixels require 384 bits of storage. 3. Convert bits into bytes by dividing the total number of bits by 8: 384 / 8 = 48 bytes.

評分準則

1 mark for showing correct working (either showing the total pixel count of 384 or showing the division of bits by 8). 0.5 marks for the correct final integer answer of 48.
題目 12 · Mathematical Conversions and Arithmetic
1.5
A file has a size of 3 Kilobytes (KB). Calculate the exact size of this file in bits, using the base-2 (binary) definition of a Kilobyte where 1 KB = 1024 bytes.
查看答案詳解

解題

1. Convert Kilobytes to bytes using the binary definition: 3 KB * 1024 bytes/KB = 3072 bytes. 2. Convert bytes to bits by multiplying the number of bytes by 8: 3072 bytes * 8 bits/byte = 24576 bits.

評分準則

1 mark for correct intermediate calculation showing conversion to bytes (3072 bytes) or representing the full calculation as 3 * 1024 * 8. 0.5 marks for the correct final value of 24576.
題目 13 · Conceptual Explanation
4
A web designer is optimizing a bitmap image for a website. Explain how reducing the color depth of an image from 24 bits to 8 bits affects both the file size and the visual quality of the image.
查看答案詳解

解題

When color depth is reduced from 24 bits (3 bytes) per pixel to 8 bits (1 byte) per pixel, the image file size is reduced to approximately one-third of its original size. This makes it faster to download and display on a web browser. On the other hand, the visual quality will degrade. A 24-bit image can represent over 16.7 million distinct colors, allowing for smooth gradients and realistic detail. An 8-bit image is limited to only 256 colors. This reduction causes a loss of color precision, which is particularly visible as 'banding' in gradients, and makes complex photographic textures appear less realistic or blocky.

評分準則

Award 1 mark for each of the following (max 4 marks): 1 mark: Explaining that the file size will decrease (significantly / to approximately a third). 1 mark: Detailing that each pixel now requires only 8 bits (1 byte) of data instead of 24 bits (3 bytes). 1 mark: Explaining that the number of available colors decreases from over 16 million to 256. 1 mark: Explaining the visual impact (such as loss of detail, pixelation, or color banding in gradients).
題目 14 · Conceptual Explanation
4
A school wants to distribute a large archive of educational video files to students who have limited internet access. Compare the use of optical discs (such as DVDs) and USB flash memory drives (solid-state storage) for this purpose, explaining one advantage of each medium in this context.
查看答案詳解

解題

For wide distribution, optical discs (DVDs) offer a very low unit cost, meaning the school can produce and hand them out to many students cheaply. If a disc is damaged or lost, it is inexpensive to replace. However, many modern laptops do not have optical drives. In contrast, USB flash memory drives (solid-state storage) are highly durable, have much faster read speeds, and offer significantly higher storage capacities, allowing them to store many more or higher-quality videos. USB drives also plug directly into almost any modern computer without needing an external drive, though they are much more expensive to purchase per unit.

評分準則

Award up to 2 marks for optical discs: 1 mark: Identifies optical discs are very inexpensive / cost-effective to produce in bulk. 1 mark: Explains this is useful if discs are lost or damaged / keeps distribution costs low. Award up to 2 marks for USB flash drives: 1 mark: Identifies USB flash drives have higher storage capacity / faster read speeds / higher compatibility with modern computers. 1 mark: Explains this allows for more high-quality video files to be stored / played smoothly without a DVD drive.
題目 15 · Conceptual Explanation
4
A customer is about to enter their payment details on an online shopping website. Explain why the website must use the HTTPS protocol instead of HTTP, and describe how HTTPS secures the customer's data.
查看答案詳解

解題

Unlike HTTP, which sends data in plain text, HTTPS uses encryption (via SSL/TLS) to secure all communications between the user's browser and the web server. This ensures that even if sensitive payment information is intercepted by a third party on the network, it cannot be read or understood. Furthermore, HTTPS requires the server to present a digital certificate signed by a trusted Certificate Authority. This authenticates the identity of the website, protecting the customer from phishing or 'man-in-the-middle' attacks by verifying they are connected to the genuine merchant.

評分準則

Award 1 mark for each of the following (max 4 marks): 1 mark: Identifying that HTTPS encrypts the data being transmitted (whereas HTTP transmits in plain text). 1 mark: Explaining that encryption prevents intercepted data from being readable to hackers or unauthorized parties. 1 mark: Mentioning that HTTPS uses digital certificates / SSL / TLS. 1 mark: Explaining that certificates authenticate the website's identity, preventing phishing or connection to imposter servers.
題目 16 · Conceptual Explanation
4
An algorithm is designed to find the range (the difference between the maximum and minimum values) of an array of positive integers. Explain the steps the algorithm must take to calculate this range, starting from a given array of size N.
查看答案詳解

解題

To calculate the range of an array, the algorithm must first determine the highest and lowest values present. It initializes two placeholder variables, 'max' and 'min', with the value at index 0 of the array. It then loops through the remaining elements (from index 1 to N-1). Inside the loop, it compares each element: if the current element is greater than 'max', it updates 'max'; if the current element is smaller than 'min', it updates 'min'. After checking all elements, the algorithm subtracts 'min' from 'max' to find the difference and outputs this final value as the range.

評分準則

Award 1 mark for each key stage of the explanation (max 4 marks): 1 mark: Initialize both tracking variables ('max' and 'min') with the first array element (index 0). 1 mark: Loop/iterate through the remaining elements of the array. 1 mark: Compare each element in the loop and update 'max' if the element is higher, and 'min' if the element is lower. 1 mark: Subtract the final 'min' from 'max' after the loop to calculate and return the range.
題目 17 · Conceptual Explanation
4
A web developer can style a web page using either inline CSS or an external CSS stylesheet. Explain two benefits of using an external CSS stylesheet instead of inline styles for a multi-page website.
查看答案詳解

解題

An external CSS stylesheet separates design and presentation from the structure of HTML. First, this promotes design consistency across multiple web pages because they all pull from a single styling source. If the color scheme changes, the developer only needs to modify the single external file to update the entire website automatically. Second, it improves performance and maintainability. It prevents duplicate style rules, keeping individual HTML files clean and small. Browsers can also cache the external CSS file after the first page load, reducing bandwidth and speeding up page load times for the rest of the site.

評分準則

Award up to 2 marks for each well-explained benefit (max 4 marks): Benefit 1: 1 mark: Identifying design consistency / global updates (changes in one file affect all pages). 1 mark: Explaining how this saves developer time and prevents design discrepancies. Benefit 2: 1 mark: Identifying improved website performance / cleaner code (smaller HTML file sizes). 1 mark: Explaining how separating content from presentation allows browser caching or makes debugging easier.
題目 18 · Conceptual Explanation
4
A software company is upgrading its database system. They are deciding whether to switch from standard 7-bit ASCII to 16-bit Unicode (UTF-16) for storing text. Explain one advantage and one disadvantage of making this switch.
查看答案詳解

解題

The main advantage of switching to 16-bit Unicode is global compatibility. Standard ASCII is restricted to English letters, numbers, and basic symbols (128 characters). Unicode provides space for up to 65,536 distinct characters, allowing the database to accurately represent non-Latin writing systems (such as Chinese, Arabic, or Cyrillic), mathematical symbols, and modern emojis. The primary disadvantage is the increased cost of storage and memory. Because Unicode characters in UTF-16 require 16 bits (2 bytes) each, text fields will consume roughly twice as much disk space and RAM, which can degrade database search speeds and increase infrastructure costs.

評分準則

Award up to 2 marks for the advantage: 1 mark: Identifies that Unicode supports a larger character set / multilingual characters. 1 mark: Explains the benefit, such as enabling internationalization / support for non-English scripts and emojis. Award up to 2 marks for the disadvantage: 1 mark: Identifies that Unicode requires more storage bits per character (16 bits vs 7/8 bits). 1 mark: Explains the consequence, such as doubling the database file size / using more transmission bandwidth.
題目 19 · Conceptual Explanation
4
A user notices that upgrading their computer's CPU to one with double the clock speed does not always double the performance when running complex applications. Explain why this is the case, referencing two other hardware bottlenecks that can limit overall performance.
查看答案詳解

解題

A computer system's performance is determined by its weakest link, a concept known as a hardware bottleneck. Even if a CPU can execute instructions twice as fast, it cannot process data it does not have. First, RAM (Main Memory) acts as a bottleneck: if the system RAM has a slow bus speed or high latency, the fast CPU spends idle clock cycles waiting to fetch instructions. Second, secondary storage devices (especially traditional magnetic hard drives) are millions of times slower than the CPU. During file operations or when the system relies on virtual memory (paging), the CPU is bottlenecked waiting for data transfers from disk storage.

評分準則

Award up to 2 marks for explaining each bottleneck (max 4 marks): Bottleneck 1 (RAM): 1 mark: Identifying RAM speed/capacity as a limiting factor. 1 mark: Explaining that the CPU must idle/wait for data to transfer from RAM, neutralizing the clock speed increase. Bottleneck 2 (Secondary Storage): 1 mark: Identifying slow secondary storage (HDD vs SSD) or bus speeds as a bottleneck. 1 mark: Explaining that slow disk access times delay file execution and virtual memory page swaps. (Accept other valid hardware bottlenecks, e.g., Cache size limits, GPU speed, or Thermal throttling).
題目 20 · Conceptual Explanation
4
A company installs a software firewall on its network gateway. Explain the purpose of a firewall and describe how it helps protect the company's internal network from unauthorized access.
查看答案詳解

解題

The main purpose of a firewall is to secure an internal, trusted network from untrusted external networks (such as the Internet). It functions by continuously inspecting packets of data entering or leaving the network. The firewall references a configured security policy containing rule sets (e.g., permitted IP addresses, protocols, or port numbers). If an incoming packet matches a blocked rule or originates from an unauthorized external source, the firewall drops or rejects it. This prevents unauthorized remote access, blocks port scanning, and helps contain malware before it can compromise internal systems.

評分準則

Award 1 mark for each of the following (max 4 marks): 1 mark: Defining a firewall as a barrier that monitors / filters incoming and outgoing network traffic. 1 mark: Explaining that it controls traffic passing between a trusted internal network and an untrusted external network (Internet). 1 mark: Stating that it uses a set of pre-defined security rules / criteria to evaluate data packets. 1 mark: Describing that it blocks malicious or unauthorized packets (e.g., hackers, malware) while letting safe traffic pass through.
題目 21 · Algorithm Tracing & Logical Analysis
8
Figure 1 shows an algorithm written in pseudo-code.

```
Value <- 10
Count <- 0
FOR I <- 0 TO 4
IF Items[I] > Value THEN
Items[I] <- Items[I] - 5
Count <- Count + 1
ELSE
Items[I] <- Items[I] * 2
ENDIF
ENDFOR
```

The algorithm operates on an array called `Items`. The initial contents of the array `Items` are:

* `Items[0] = 12`
* `Items[1] = 8`
* `Items[2] = 15`
* `Items[3] = 6`
* `Items[4] = 11`

**1.1** Complete the trace table to show the execution of the algorithm. (6 marks)

| Value | Count | I | Items[0] | Items[1] | Items[2] | Items[3] | Items[4] |
| :---: | :---: | :-: | :---: | :---: | :---: | :---: | :---: |
| 10 | 0 | - | 12 | 8 | 15 | 6 | 11 |
| | | | | | | | |

**1.2** State what the value in the variable `Count` represents at the end of the algorithm, and explain why. (2 marks)
查看答案詳解

解題

1.1
- When I = 0: Items[0] is 12, which is > 10. Items[0] becomes 12 - 5 = 7. Count increments to 1.
- When I = 1: Items[1] is 8, which is <= 10. Items[1] becomes 8 * 2 = 16. Count remains 1.
- When I = 2: Items[2] is 15, which is > 10. Items[2] becomes 15 - 5 = 10. Count increments to 2.
- When I = 3: Items[3] is 6, which is <= 10. Items[3] becomes 6 * 2 = 12. Count remains 2.
- When I = 4: Items[4] is 11, which is > 10. Items[4] becomes 11 - 5 = 6. Count increments to 3.

1.2 The IF condition checks if each original element is strictly greater than 10. If so, `Count` is incremented. Therefore, it tracks the count of elements initially greater than 10.

評分準則

1.1 (6 marks):
- 1 mark: Correct values for I sequence (0, 1, 2, 3, 4).
- 1 mark: Correct updates to Count (changes to 1, then 2, then 3).
- 1 mark: Correct update to Items[0] (becomes 7) and Items[1] (becomes 16).
- 1 mark: Correct update to Items[2] (becomes 10) and Items[3] (becomes 12).
- 1 mark: Correct update to Items[4] (becomes 6).
- 1 mark: All final row values are accurate.

1.2 (2 marks):
- 1 mark: Stating it represents the count of elements greater than 10/Value.
- 1 mark: Explaining it is because the IF statement condition evaluates to True only for values strictly greater than 10.
題目 22 · Algorithm Tracing & Logical Analysis
8
A local area network (LAN) consists of three workstation computers (PC1, PC2, PC3) connected to a network switch. The switch is also connected to a router that provides access to the Internet.

**2.1** Describe the distinct roles of a Media Access Control (MAC) address and an Internet Protocol (IP) address in this network. (3 marks)

**2.2** A packet is sent from PC1 to a web server on the Internet. Explain how the destination MAC address and destination IP address in the packet header change as the packet moves from PC1 to the router, and then from the router across the Internet to the web server. (3 marks)

**2.3** Identify the TCP/IP stack layer that determines the optimal path for packets across networks, and name one protocol that operates at this layer. (2 marks)
查看答案詳解

解題

2.1 MAC addresses operate at the link layer to identify specific devices on the local segment. IP addresses operate at the network layer to route packets across multiple interconnected networks.
2.2 IP addresses are end-to-end addresses; MAC addresses are hop-by-hop addresses. Thus, destination IP is always the web server, whereas destination MAC changes at each router node to the next direct recipient.
2.3 The Network (or Internet) layer handles the routing. IP is the primary protocol.

評分準則

2.1 (3 marks):
- 1 mark: MAC address uniquely identifies physical hardware / local NIC for delivery on the local subnet.
- 1 mark: IP address is a logical address used for routing across different networks.
- 1 mark: Explicit contrast showing local vs global context.

2.2 (3 marks):
- 1 mark: Stating the destination IP address remains unchanged throughout the journey.
- 1 mark: Stating the destination MAC address changes at each hop / gateway transition.
- 1 mark: Specifying that the initial destination MAC is that of the router (default gateway).

2.3 (2 marks):
- 1 mark: Correctly naming Network layer / Internet layer.
- 1 mark: Correctly naming IP / Internet Protocol (Accept: ICMP, OSPF, RIP).
題目 23 · Algorithm Tracing & Logical Analysis
8
A computer logic circuit has two inputs, A and B. The output, Q, is determined by the following Boolean expression:

$$\text{Q} = \text{NOT}(A \text{ AND } B) \text{ AND } (A \text{ OR } B)$$

**3.1** Complete the truth table below for this logic circuit. (4 marks)

| A | B | A AND B | NOT(A AND B) | A OR B | Q |
|:-:|:-:|:-------:|:------------:|:------:|:-:|
| 0 | 0 | | | | |
| 0 | 1 | | | | |
| 1 | 0 | | | | |
| 1 | 1 | | | | |

**3.2** State the name of the single logic gate that produces the identical outputs as the final column (Q) of this truth table. (1 mark)

**3.3** The logic circuit described above is a core component of a half-adder. Explain the purpose of a half-adder in a computer processor and how the output Q is used within it. (3 marks)
查看答案詳解

解題

3.1
- Row 1: A=0, B=0. A AND B = 0, NOT(A AND B) = 1, A OR B = 0. Q = 1 AND 0 = 0.
- Row 2: A=0, B=1. A AND B = 0, NOT(A AND B) = 1, A OR B = 1. Q = 1 AND 1 = 1.
- Row 3: A=1, B=0. A AND B = 0, NOT(A AND B) = 1, A OR B = 1. Q = 1 AND 1 = 1.
- Row 4: A=1, B=1. A AND B = 1, NOT(A AND B) = 0, A OR B = 1. Q = 0 AND 1 = 0.

3.2 The truth table matches the output of a standard XOR (Exclusive OR) gate (outputs 1 when inputs differ).

3.3 The half-adder calculates the sum of two binary bits. The XOR gate output yields the Sum bit (e.g., 1+1 gives sum 0, 1+0 gives sum 1).

評分準則

3.1 (4 marks):
- Award 1 mark per fully correct column (A AND B, NOT(A AND B), A OR B, Q).

3.2 (1 mark):
- 1 mark for XOR / Exclusive OR.

3.3 (3 marks):
- 1 mark: Stating the half-adder is used to perform binary addition on two single bits.
- 1 mark: Stating it generates a Sum bit and a Carry bit.
- 1 mark: Explaining that the output Q represents the Sum bit (since 1+1=0 with a carry, and 1+0=1).
題目 24 · Algorithm Tracing & Logical Analysis
8
A programmer writes the following HTML and CSS code to display a simple navigation header for a website.

```html








  • Home

  • Services




```

**4.1** Identify three syntax errors in the HTML and CSS code above. Describe how to correct each error. (6 marks)

**4.2** In web design, elements can have a display property set to either `block` or `inline`. Explain the difference in visual rendering between a block-level element and an inline element. (2 marks)
查看答案詳解

解題

4.1 The syntax errors prevent styles from applying and cause incorrect page rendering.
- Equals sign instead of colon in property declaration is invalid CSS.
- Comma in CSS separates selectors, not declarations; a semicolon must be used instead.
- Tags in HTML must be closed in reverse order of their opening (nested hierarchy).

4.2 Block-level elements (like or

) visually form blocks on the page, stacking vertically. Inline elements (like or ) display side-by-side without line breaks.

評分準則

4.1 (6 marks):
- Award 1 mark for identifying each distinct syntax error (up to 3).
- Award 1 mark for each corresponding correct fix (up to 3).
- Acceptable errors are: '=' used instead of ':', comma ',' used instead of semicolon ';', nested closing tags order `` instead of ``, or unclosed `
  • ` tag on the second list item.

    4.2 (2 marks):
    - 1 mark: Stating block elements begin on a new line and span full available width.
    - 1 mark: Stating inline elements do not force a new line and only span the width of their content.
  • 想知道自己有幾分把握?

    thinka 是 DSE 學生用的 AI 練習應用程式,有無限量練習題、即時自動批改和詳細解題步驟。逾 100,000 名學生用它確認自己真的識,而不只是「以為識」。

    想練更多類似題型?在 thinka 無限量操練,即時知道答案。

    免費開始練習