An original Thinka practice paper modelled on the structure and difficulty of the Jun 2025 (V1) Cambridge IGCSE Computer Science (0478) paper. Not affiliated with or reproduced from Cambridge.
卷一: Computer Systems
Answer all questions. Calculators are not allowed. Show all your working for numerical questions.
10 题目 · 79 分
题目 1 · structured
4 分
A digital camera stores files on a memory card.
(a) A high-resolution photo has a file size of 6 MiB. Calculate the file size of this photo in kibibytes (KiB). Show your working.
(b) The memory card has 3 GiB of free space remaining. Calculate how many video clips can be stored in this free space if each video clip has a file size of 512 MiB. Show your working.
查看答案详解收起答案详解
解题
(a) To convert mebibytes (MiB) to kibibytes (KiB), multiply by 1024: \(6 \times 1024 = 6144\text{ KiB}\)
(b) First, convert gibibytes (GiB) to mebibytes (MiB): \(3 \times 1024 = 3072\text{ MiB}\) Then, divide the total free space by the size of one video clip: \(3072 / 512 = 6\)
评分标准
(a) 1 mark for showing correct working (multiplication by 1024): - \(6 \times 1024\) 1 mark for correct final answer: - 6144 (KiB)
(b) 1 mark for showing correct conversion of 3 GiB to MiB: - \(3 \times 1024\) or 3072 (MiB) 1 mark for correct final answer: - 6 (video clips)
题目 2 · open-ended
4 分
A digital camera stores files on a memory card.
(a) A high-resolution photo has a file size of 6 MiB. Calculate the file size of this photo in kibibytes (KiB). Show your working.
(b) The memory card has 3 GiB of free space remaining. Calculate how many video clips can be stored in this free space if each video clip has a file size of 512 MiB. Show your working.
查看答案详解收起答案详解
解题
(a) To convert mebibytes (MiB) to kibibytes (KiB), multiply by 1024: \(6 \times 1024 = 6144\text{ KiB}\)
(b) First, convert gibibytes (GiB) to mebibytes (MiB): \(3 \times 1024 = 3072\text{ MiB}\) Then, divide the total free space by the size of one video clip: \(3072 / 512 = 6\)
评分标准
(a) 1 mark for showing correct working (multiplication by 1024): - \(6 \times 1024\) 1 mark for correct final answer: - 6144 (KiB)
(b) 1 mark for showing correct conversion of 3 GiB to MiB: - \(3 \times 1024\) or 3072 (MiB) 1 mark for correct final answer: - 6 (video clips)
题目 3 · written
9 分
An automated greenhouse system monitors soil moisture and temperature. It stores sensor configurations in 8-bit registers.
(a) (i) One sensor configuration is stored as the hexadecimal value **D4**. Convert this hexadecimal value into an 8-bit binary number. [1]
(ii) A threshold setting is stored as the denary value **173**. Convert this denary value into hexadecimal. Show your working. [2]
(b) The greenhouse has a small, low-power control panel mounted on a wall. (i) Identify an appropriate output device to display the current numeric sensor readings. [1] (ii) Give one reason why this device is suitable for this specific environment. [1]
(c) Hexadecimal is widely used in computer science. (i) State two reasons why computer programmers use hexadecimal rather than binary. [2] (ii) Identify one other use of hexadecimal in computer systems, apart from representing sensor configuration registers. Give a brief description of this use. [2]
查看答案详解收起答案详解
解题
(a) (i) Conversion of D4 to 8-bit binary: - D in hexadecimal is 13 in denary, which is 1101 in binary. - 4 in hexadecimal is 4 in denary, which is 0100 in binary. - Combining them gives: 11010100
(ii) Conversion of denary 173 to hexadecimal: - 173 / 16 = 10 remainder 13 - 10 in hexadecimal is A - 13 in hexadecimal is D - Combining them gives: AD
(b) (i) Suitable output device: LCD (Liquid Crystal Display) or OLED display. (ii) Reason: Highly compact, consumes very low power, and is easily readable in a compact greenhouse enclosure.
(c) (i) Reasons for using hexadecimal instead of binary: 1. It is shorter and more compact, making it easier/quicker for humans to read, write, and remember. 2. It reduces transcription errors as there are fewer digits to copy.
(ii) Other use of hexadecimal: - MAC (Media Access Control) addresses: Used to uniquely identify network interface cards/devices on a local network.
评分标准
(a) (i) 1 mark: - 11010100
(ii) 2 marks: - 1 mark for showing valid working (e.g. division by 16 showing quotient 10 and remainder 13, or converting first to binary: 10101101) - 1 mark for correct hex value: AD
(ii) 1 mark: - Low power consumption // takes up very little physical space // highly readable in low-light conditions (if backlit)
(c) (i) 2 marks for any two from: - Easier / quicker for a human / programmer to read / write / understand / remember - Shorter / more compact representation - Less likely to make errors / mistakes when copying or typing - Very straightforward to convert to and from binary
(ii) 2 marks: - 1 mark for identifying a valid alternative use - 1 mark for a correct description of that use
Examples: - MAC addresses (1) - to uniquely identify a physical device on a network (1) - HTML/CSS color codes (1) - to represent red, green, and blue (RGB) color values in web design (1) - IPv6 addresses (1) - to represent 128-bit network addresses in a manageable format (1) - Assembly language / debugging memory dumps (1) - to display values stored at memory locations (1)
题目 4 · short_answer
4 分
A designer is creating graphics for a new mobile application. (a) Define the term 'colour depth' when representing an image in a computer. [1] (b) Describe how increasing the resolution of an image affects both its file size and the quality of the image. [2] (c) Identify one piece of metadata that is typically stored with an image file, other than the date or time it was created. [1]
查看答案详解收起答案详解
解题
(a) Colour depth refers to the number of bits allocated to store the colour information of each individual pixel in an image. (b) When resolution is increased, the total number of pixels in the image increases. This results in: (1) An increase in file size because there are more pixels, meaning more data needs to be stored. (2) An increase in image quality, as the image becomes clearer, sharper, and shows finer details. (c) Other metadata examples include the image dimensions (width and height in pixels), the file format (e.g., JPEG, PNG), the GPS location where the image was captured, or camera settings (e.g., camera model).
评分标准
(a) [1 mark] - Number of bits used to represent the colour of each pixel / number of bits per pixel. (b) [2 marks] - 1 mark: File size increases (as there is more pixel data to store). - 1 mark: Quality / detail / sharpness increases (or image is less pixelated when enlarged). (c) [1 mark] - Any one of: Dimensions / width and height, GPS location, camera model, file format / type, copyright information. (Reject: date or time).
题目 5 · Data Transmission & Error Detection
12 分
A weather buoy located in the ocean transmits environmental data (such as water temperature and wind speed) back to a research facility on the coast.
(a) (i) Describe what is meant by serial half-duplex data transmission. [3]
(ii) State one advantage of using serial data transmission instead of parallel data transmission for this scenario. [1]
(b) A checksum is used to detect errors in the transmitted data.
(i) Describe the process of using a checksum to detect transmission errors at the receiving computer. [4]
(ii) Explain why a checksum is more robust at detecting multiple-bit errors than a simple parity check. [2]
(c) The system can also transmit data packets over the internet.
Describe the role of the packet header in ensuring that data can be correctly reassembled if packets arrive out of order. [2]
查看答案详解收起答案详解
解题
(a) (i) Serial half-duplex data transmission means: - Serial: Data is sent one bit at a time over a single wire/communication channel. - Half-duplex: Data can travel in both directions, but only in one direction at a time (not simultaneously).
(ii) One advantage of serial transmission over long distances (such as from a marine buoy to the coast) is that bits do not arrive skewed (out of sync), which is a common error in parallel cables. Additionally, it requires fewer wires, making it significantly cheaper to implement over long distances.
(b) (i) The process of checking data using a checksum: - The sender calculates a checksum value using an algorithm on the data block before transmission. - This calculated checksum value is appended to the data packet and transmitted. - The receiving computer recalculates the checksum from the received data using the same algorithm. - The receiving computer compares its recalculated checksum with the transmitted checksum. If they match, the data is assumed error-free; if they do not match, an error is detected and a request for retransmission is sent.
(ii) A simple parity check only checks if the number of 1s in a single byte is even or odd. If an even number of bits are flipped (corrupted) within the same byte, the parity remains unchanged and the error goes undetected. A checksum, however, sums the numerical values of the entire block of data. If multiple bits are changed across different bytes, it is extremely likely to alter the final block sum, allowing the receiver to detect the corruption.
(c) The packet header contains a packet sequence/order number. Because packets sent over the internet can take different routes and arrive out of order, the receiving computer uses these sequence numbers to reorder and correctly reassemble the packets back into the original complete file.
评分标准
(a) (i) [Max 3 marks] - 1 mark: Data is transmitted one bit at a time. - 1 mark: Over a single wire/pathway. - 1 mark: Data can travel in both directions but not simultaneously / only one direction at a time.
(ii) [Max 1 mark] - 1 mark: Less chance of data skewing over long distances // cheaper cabling over long distances.
(b) (i) [Max 4 marks] - 1 mark: Checksum value calculated by the sender using a specific algorithm / formula. - 1 mark: The calculated checksum is sent with the data block. - 1 mark: Receiver recalculates the checksum of the received data using the same algorithm. - 1 mark: Receiver compares the two values; if they differ, an error has occurred (and data is requested to be resent).
(ii) [Max 2 marks] - 1 mark: Parity checks cannot detect errors if an even number of bits (e.g. 2 bits) transpose / are flipped in the same byte. - 1 mark: Checksum relies on the total numerical sum of all data bytes in a block, meaning multiple bit flips in different locations will still change the overall sum, making detection highly likely.
(c) [Max 2 marks] - 1 mark: The packet header contains a sequence / packet number. - 1 mark: The receiver reads this sequence number to reorder / reconstruct the packets into their correct sequential order.
题目 6 · structured
9 分
The central processing unit (CPU) in a desktop computer is based on the Von Neumann architecture.
(a) Complete the table with the missing terms and definitions about CPU registers and buses.
| Term | Definition | | :--- | :--- | | Program Counter (PC) | **(i)** .................................................................................................... | | **(ii)** ............................................. | This register holds the memory address of the data or instruction currently being read from or written to. | | **(iii)** ............................................ | This bidirectional bus is used to transmit the actual data or instruction between the CPU and other components. | | Control Unit (CU) | **(iv)** ................................................................................................... |
[4]
(b) Identify the system bus that is unidirectional and explain why it must be unidirectional.
(a) (i) **Program Counter (PC) definition**: Stores the memory address of the next instruction to be fetched from memory. (ii) **MAR**: The Memory Address Register holds the address currently being accessed. (iii) **Data Bus**: The bidirectional bus used to transfer data/instructions. (iv) **Control Unit (CU) definition**: Manages and coordinates all the tasks and data flow of the CPU.
(b) - **Address Bus** (1 mark) - **Explanation**: The CPU only needs to specify memory locations (write addresses *to* memory) to retrieve or store data. Addresses do not need to be sent back to the CPU from memory, meaning the flow is entirely one-way. (1 mark)
(c) - Cache memory is located closer to/on the CPU and operates at much higher speeds than main memory (RAM). (1 mark) - Increasing the cache size means more frequently used instructions and data can be kept in cache. (1 mark) - This reduces the frequency of slower RAM accesses, decreasing the latency of the Fetch-Decode-Execute cycle and increasing CPU throughput. (1 mark)
评分标准
(a) [4 marks] - 1 mark for each correct missing cell (i) through (iv). - (i) Accept: "Stores / holds the address of the next instruction to be fetched / processed." - (ii) Accept: "Memory Address Register" or "MAR". - (iii) Accept: "Data bus" or "Data Bus". - (iv) Accept: "Directs the flow of data / signals inside the CPU" or "Coordinates the activity of the CPU / FDE cycle" or "Decodes instructions".
(b) [2 marks] - 1 mark for identifying "Address bus". - 1 mark for the explanation (e.g., "Addresses are only sent from the CPU to memory/input-output components, never in the opposite direction.")
(c) [3 marks] - Max 3 marks from: - Cache stores frequently/recently accessed data/instructions. [1] - Cache operates at a much faster speed than RAM. [1] - A larger cache increases the likelihood of finding needed data in the cache (higher hit rate). [1] - This reduces the number of times the CPU must read from/write to slower main memory (RAM). [1] - This speeds up the overall Fetch-Decode-Execute cycle / improves processing speed. [1]
题目 7 · free-text
9 分
A medical clinic, 'HealthyHeart', wants to securely transmit patient records over the internet to a central database.
(a) The clinic uses asymmetric encryption. Describe the process of how a patient record is encrypted at the clinic and decrypted at the central database server. [4]
(b) Identify two differences between symmetric encryption and asymmetric encryption, other than the process of key distribution. [2]
(c) In secure internet protocols (such as TLS), asymmetric encryption and symmetric encryption are often combined. Explain how and why they are used together. [3]
查看答案详解收起答案详解
解题
(a) 1. The clinic's computer obtains the central database server's public key. 2. The clinic's computer encrypts the patient record using this public key. 3. The encrypted patient record (ciphertext) is transmitted across the internet. 4. The central database server receives the encrypted data and uses its private key to decrypt it back into readable plain text.
(b) 1. Symmetric encryption uses a single key to both encrypt and decrypt data, whereas asymmetric encryption uses a key pair (public key and private key). 2. Symmetric encryption is computationally faster and requires less processing power, whereas asymmetric encryption is slower and more computationally intensive.
(c) 1. Asymmetric encryption is initially used during the handshake to securely exchange a temporary symmetric key (session key) between the clinic and the server. 2. Once the symmetric key is securely shared, symmetric encryption is used to encrypt all the actual data transmitted during the session. 3. This combines the security benefits of asymmetric key exchange (no shared secret needs to be sent in plain text) with the speed and efficiency of symmetric encryption for large data blocks.
评分标准
(a) [Max 4 marks] - 1 mark: Clinic obtains the server's public key. - 1 mark: Clinic encrypts the patient record using the public key. - 1 mark: Encrypted data (ciphertext) is transmitted. - 1 mark: Server decrypts the record using its corresponding private key.
(b) [Max 2 marks] - 1 mark: Symmetric uses a single key / Asymmetric uses a pair of keys (public and private). - 1 mark: Symmetric is faster / requires less CPU time / efficient for large files // Asymmetric is slower / computationally complex.
(c) [Max 3 marks] - 1 mark: Asymmetric encryption is used initially to securely exchange a symmetric/session key. - 1 mark: Symmetric encryption is then used to encrypt the actual data transmission / session payload. - 1 mark: Explaining the benefit: This provides both secure key exchange (asymmetric benefit) and fast data transmission (symmetric benefit).
题目 8 · descriptive
11 分
A graphic designer uses a computer with 8 GB of RAM and a fast Solid State Drive (SSD) to edit high-resolution 4K video.
(a) State what is meant by 'primary storage' and explain why RAM is categorized as primary storage rather than secondary storage. [3]
(b) During a complex rendering task, the RAM becomes full. Describe how the operating system utilizes virtual memory on the SSD to prevent the software from crashing. [5]
(c) Describe three negative consequences to the system's performance or hardware if virtual memory is used constantly (disk thrashing). [3]
查看答案详解收起答案详解
解题
(a) Primary storage refers to memory that is directly addressable by the CPU (e.g., RAM, ROM, Cache). RAM is classified as primary storage because it is directly connected to the CPU and holds the active programs, operating system instructions, and data currently in execution. Secondary storage (like SSDs or HDDs) is non-volatile, not directly accessible by the CPU, and used for long-term storage.
(b) When RAM becomes full, the OS implements virtual memory: 1. It allocates a portion of the secondary storage (SSD) to act as an extension of RAM. 2. RAM contents are organized into blocks called 'pages'. 3. The OS identifies inactive pages or data not currently in active use. 4. These inactive pages are transferred ('paged out') from RAM to the allocated space on the SSD, freeing up physical space in RAM for the currently executing tasks. 5. If the CPU needs the data that was moved to the SSD, a 'page fault' occurs, and the OS swaps it back into RAM ('paged in'), while moving another inactive page out to make space.
(c) Constant reliance on virtual memory leads to: 1. Reduced System Performance: SSD read/write speeds are orders of magnitude slower than RAM, causing noticeable lag. 2. Disk Thrashing: The OS spends more time swapping pages back and forth between RAM and SSD than actually executing instructions, causing the system to freeze. 3. SSD Lifespan Reduction: SSDs have a finite number of write cycles. Constant paging increases write operations, accelerating the wear and tear of the storage medium.
评分标准
Part (a): Max 3 marks - 1 mark: Definition of primary storage as directly accessible/addressable by the CPU. - 1 mark: RAM holds data/instructions currently in use/execution. - 1 mark: RAM is volatile (loses data when power is lost) / contrast with secondary storage which is non-volatile.
Part (b): Max 5 marks - 1 mark: The OS partitions/allocates a section of secondary storage (SSD) to act as virtual memory. - 1 mark: Data/memory is split into fixed-size blocks called 'pages'. - 1 mark: Inactive / least recently used pages are transferred/copied from RAM to the SSD. - 1 mark: This frees up physical space in RAM for active/new data. - 1 mark: Swapping process described: when inactive data is needed again, it is moved back to RAM and currently inactive pages are moved to the SSD.
Part (c): Max 3 marks (1 mark per consequence described) - 1 mark: Slower processing speed/system lag because SSD read/write speeds are much slower than RAM. - 1 mark: Disk thrashing occurs (where the system spends more time swapping pages than running programs, leading to freezing). - 1 mark: Hardware degradation / reduction in the lifespan of the SSD due to high volumes of read/write cycles.
题目 9 · structural
7 分
An automated agricultural system uses a mobile robot to harvest ripe fruit in a greenhouse.
(a) Identify **two** sensors that the harvesting robot would use to locate ripe fruit and avoid obstacles. [2]
(b) Describe how the robot’s microprocessor uses the data from these sensors to control the harvesting process. [3]
(c) Identify an appropriate actuator that would be used to physically pick the fruit, and state its function. [2]
查看答案详解收起答案详解
解题
(a) The robot needs to perceive its environment. To detect color (ripeness), it requires an optical sensor like a digital camera. To navigate without crashing into plants and structures, it needs a distance-measuring sensor such as an ultrasonic sensor.
(b) The microprocessor cannot directly process analog physical waves, so an ADC converts the analog signals to digital data. The microprocessor compares these values to its pre-programmed parameters. If the target matches the color and distance criteria, the control algorithm commands the mechanical parts to act.
(c) Actuators convert electrical signals from the processor into physical action. A mechanical gripper or arm powered by motors is needed to reach and pluck the fruit.
评分标准
(a) One mark per correct sensor identified, up to a maximum of 2 marks: - Camera / Image sensor - Ultrasonic sensor - Infrared sensor - LiDAR sensor (Accept: Color sensor / Light sensor) (Reject: Temperature sensor, pH sensor)
(b) One mark per point, up to a maximum of 3 marks: - Microprocessor receives data from the sensors continuously. - Analog sensor data is converted to digital using an ADC. - Microprocessor compares the values to stored/pre-programmed values (e.g., color range for ripeness / safe distance thresholds). - If color matches the ripe range (and distance is correct), a signal is sent to the actuator to pick the fruit. - If distance to an obstacle is too small, a signal is sent to the motors to stop/change direction. - The process is a continuous loop / operates in real-time.
(c) - 1 mark for identifying the actuator: Robotic gripper / motor / pneumatic cylinder / robotic arm. - 1 mark for explaining its function: To close/clench around the fruit to grasp it / to cut the stem / to move the robot's arm to the correct position.
题目 10 · written
10 分
A city-wide smart public bicycle rental company manages hundreds of docking stations. Each docking station contains an embedded computer system connected to a central server.
(a) The central server runs a multitasking operating system.
(i) Identify **two** functions of an operating system, other than memory management. [2]
(ii) When a user docks a bicycle, an interrupt is sent to the docking station's processor. Describe how the processor handles an interrupt. [2]
(b) The rental company's website is a target for cyber criminals who might launch a Distributed Denial of Service (DDoS) attack.
(i) Describe how a DDoS attack is performed. [2]
(ii) Identify **two** security methods that the company could use to help prevent or mitigate a DDoS attack. [2]
(c) The renting system allows users to pay using a digital currency.
(i) Explain **one** reason why digital currencies can have highly volatile exchange rates. [1]
(ii) Digital currencies rely on blockchain technology. Explain what is meant by a 'block' in a blockchain. [1]
查看答案详解收起答案详解
解题
(a) (i) Two functions of an operating system other than memory management are: 1. File management: managing files by creating, deleting, copying, and structuring directories. 2. Processor scheduling / Multitasking: allocating CPU time to different running processes.
(ii) When handling an interrupt: 1. The processor completes its current instruction execution cycle. 2. The processor saves the current state/register values so it can return to them later. 3. The Interrupt Service Routine (ISR) is loaded and run to handle the bicycle docking signal. 4. Once complete, the saved state is restored and the original program resumes.
(b) (i) A DDoS attack is performed when: - An attacker infects multiple devices with malware to create a network of controlled devices (a botnet). - The botnet simultaneously floods the target server with a massive volume of requests, overloading its bandwidth and resources, rendering the website inaccessible to legitimate users.
(ii) Two methods to prevent or mitigate a DDoS attack are: - Implementing a hardware or software firewall to filter out malicious traffic patterns. - Using a Content Delivery Network (CDN) to absorb and distribute the traffic spike. - Configuring rate limiting on the web server to restrict the number of requests accepted from any single source.
(c) (i) Digital currencies can have highly volatile exchange rates because their value is driven purely by market speculation, supply, and demand, rather than being backed by a central government, bank, or physical commodity.
(ii) A 'block' in a blockchain is a digital record containing a collection of verified transaction data, a timestamp, and a unique cryptographic hash linking it to the previous block in the chain.
评分标准
**Part (a)(i)** One mark per correct function up to a maximum of 2 marks. - File management // creation and deletion of files // directory structure - Processor/CPU scheduling // allocating execution time to tasks - Input/output control // managing peripherals / drivers - Security management // user authentication / password control - Interrupt handling
**Part (a)(ii)** One mark per distinct descriptive point up to a maximum of 2 marks. - The processor finishes executing the current instruction. - The state/contents of registers are saved. - The appropriate Interrupt Service Routine (ISR) is called/executed. - The saved registers are restored and the previous execution resumes.
**Part (b)(i)** One mark per distinct descriptive point up to a maximum of 2 marks. - A network of infected/compromised devices (botnet) is controlled remotely by an attacker. - These devices send an overwhelming volume of queries/traffic to the target server at the same time. - The server is overloaded/runs out of resources, causing it to crash or deny access to legitimate users.
**Part (b)(ii)** One mark per correct prevention/mitigation method up to a maximum of 2 marks. - Use of a firewall (to block suspicious IP addresses/traffic). - Using a Content Delivery Network (CDN) to absorb traffic. - Intrusion Detection/Prevention Systems (IDS/IPS). - Setting up rate limiting on network routers. - Broadening bandwidth limits to absorb sudden spikes (over-provisioning).
**Part (c)(i)** One mark for a valid explanation. - They are not backed by any central bank, government, or physical assets (like gold). - Their value depends entirely on market speculation / public perception / supply and demand.
**Part (c)(ii)** One mark for a correct description. - A block is a group/record of transactions that are cryptographically linked together. - It contains a list of validated transactions, a timestamp, and the cryptographic hash of the previous block.
Answer all questions. Use pseudocode or flowchart symbols as appropriate. No calculators permitted.
12 题目 · 79 分
题目 1 · written
4 分
A theater booking application requires users to enter the number of tickets they wish to purchase. The application only accepts a whole number from 1 to 8 inclusive.
(a) Identify the two values that would be used as **extreme test data** for this system. [2]
(b) Identify two values that would be used as **boundary test data** that should be rejected by this system. [2]
查看答案详解收起答案详解
解题
Extreme test data consists of the largest and smallest acceptable values that are at the outer limits of the valid range. For this system, the valid range is 1 to 8 inclusive, so the extreme values are 1 and 8.
Boundary test data consists of values that are on the immediate limits of the valid range. To test rejected boundary values, the values immediately outside the valid range are used, which are the integer below the minimum (0) and the integer above the maximum (9).
评分标准
(a) 1 mark for 1 1 mark for 8
(b) 1 mark for 0 1 mark for 9
题目 2 · written
4 分
An online registration portal has a field for entering a Membership Code. The Membership Code must consist of exactly 6 characters and contain only numeric digits.
Identify two different validation checks that can be applied to this field. For each check, explain how it is used to validate the input. [4]
查看答案详解收起答案详解
解题
To validate that a Membership Code has exactly 6 characters and contains only numeric digits, the following validation checks can be applied:
1. Length check: This ensures that the user does not enter more or fewer than 6 characters. 2. Character check (or Type check): This ensures that every character entered is a valid numeric digit (0-9) and no letters or special symbols are present.
评分标准
1 mark for each correct validation check identified (max 2): - Length check - Character check // Type check // Format check
1 mark for each correct explanation matching the identified check (max 2): - Length check explanation: Checks that the number of characters is exactly 6 / not more or less than 6 - Character/Type/Format check explanation: Checks that only numbers/digits are entered // checks that no alphabetical letters are entered // checks that it matches the 6-digit pattern
题目 3 · free_text
4 分
An algorithm is written in pseudocode to input 15 test scores and store them in an array named `Scores[]`.
```pseudocode FOR Index <- 1 TO 15 OUTPUT "Enter a score:" INPUT Score Scores[Index] <- Score NEXT Index ```
Rewrite this pseudocode algorithm to achieve the same result, but replace the count-controlled loop with an appropriate condition-controlled loop.
查看答案详解收起答案详解
解题
### Example 1 (Using a `WHILE` loop): ```pseudocode Index <- 1 WHILE Index <= 15 DO OUTPUT "Enter a score:" INPUT Score Scores[Index] <- Score Index <- Index + 1 ENDWHILE ```
### Example 2 (Using a `REPEAT` loop): ```pseudocode Index <- 1 REPEAT OUTPUT "Enter a score:" INPUT Score Scores[Index] <- Score Index <- Index + 1 UNTIL Index > 15 ```
评分标准
One mark per bullet point (Max 4): - Initialising a loop counter variable (e.g., `Index <- 1`) outside the loop. - Correct use of a condition-controlled loop with a condition configured to repeat exactly 15 times (e.g., `WHILE Index <= 15` or `REPEAT ... UNTIL Index > 15`) with correct matching closure (`ENDWHILE` or `UNTIL`). - Incrementing the loop counter variable (e.g., `Index <- Index + 1`) inside the loop body. - Rest of the algorithm correct (including exact array assignment `Scores[Index] <- Score`, INPUT, and OUTPUT statements).
题目 4 · free_text
4 分
An algorithm is written in pseudocode to input 15 test scores and store them in an array named `Scores[]`.
```pseudocode FOR Index <- 1 TO 15 OUTPUT "Enter a score:" INPUT Score Scores[Index] <- Score NEXT Index ```
Rewrite this pseudocode algorithm to achieve the same result, but replace the count-controlled loop with an appropriate condition-controlled loop.
查看答案详解收起答案详解
解题
### Example 1 (Using a `WHILE` loop): ```pseudocode Index <- 1 WHILE Index <= 15 DO OUTPUT "Enter a score:" INPUT Score Scores[Index] <- Score Index <- Index + 1 ENDWHILE ```
### Example 2 (Using a `REPEAT` loop): ```pseudocode Index <- 1 REPEAT OUTPUT "Enter a score:" INPUT Score Scores[Index] <- Score Index <- Index + 1 UNTIL Index > 15 ```
评分标准
One mark per bullet point (Max 4): - Initialising a loop counter variable (e.g., `Index <- 1`) outside the loop. - Correct use of a condition-controlled loop with a condition configured to repeat exactly 15 times (e.g., `WHILE Index <= 15` or `REPEAT ... UNTIL Index > 15`) with correct matching closure (`ENDWHILE` or `UNTIL`). - Incrementing the loop counter variable (e.g., `Index <- Index + 1`) inside the loop body. - Rest of the algorithm correct (including exact array assignment `Scores[Index] <- Score`, INPUT, and OUTPUT statements).
题目 5 · written
8 分
A company uses a 9-character identification code for its machinery. The format of the code is: - The first two characters are a country code (e.g. "DE", "FR"). - The next four characters are the year of manufacture (e.g. "2022"). - The final three characters are a unique serial number (e.g. "88A").
Example code: "DE202288A"
(a) Write an algorithm using pseudocode to: - Input the 9-character identification code. - Extract the 4-character manufacture year. - Convert this year to an integer. - Output "New" if the year is 2024 or later. - Output "Recent" if the year is from 2018 to 2023 inclusive. - Output "Old" if the year is before 2018. [5]
(b) State and explain how your algorithm from part (a) can be modified to check if the machinery is specifically from the country "DE". If the machinery is not from "DE", the algorithm should output "Non-German Machinery" and not perform the year check. [3]
查看答案详解收起答案详解
解题
(a) Example Pseudocode: ``` OUTPUT "Enter machinery code: " INPUT Code YearString <- SUBSTRING(Code, 3, 4) YearNum <- STRING_TO_NUM(YearString) IF YearNum >= 2024 THEN OUTPUT "New" ELSE IF YearNum >= 2018 THEN OUTPUT "Recent" ELSE OUTPUT "Old" ENDIF ENDIF ```
(b) Explanation of modifications: - Extract the first two characters of the code using `SUBSTRING(Code, 1, 2)`. - Wrap the existing year-checking code in an outer `IF` statement that checks if this extracted country code is equal to "DE". - In the `ELSE` branch of this outer `IF` statement, output the message "Non-German Machinery".
评分标准
(a) [Max 5 marks] - 1 mark: Correct input statement for the identification code. - 1 mark: Correct use of SUBSTRING() function with correct parameters to extract the year (e.g., SUBSTRING(Code, 3, 4)). - 1 mark: Correct conversion of the extracted string to a numeric value using a conversion function (e.g., STRING_TO_NUM()). - 1 mark: Correct logic for conditional checks with the specified boundaries (>= 2024, and 2018 to 2023). - 1 mark: Correct outputs for all three conditions ("New", "Recent", and "Old").
(b) [Max 3 marks] - 1 mark: Use of SUBSTRING() to extract the first 2 characters (e.g., SUBSTRING(Code, 1, 2)). - 1 mark: Outer IF statement checking if the country code is equal to "DE". - 1 mark: Outputting "Non-German Machinery" in the ELSE block of the outer IF statement and executing the year-checking block only in the THEN block.
题目 6 · free-text
4 分
A programmer is writing an algorithm to convert a given number of days into weeks and remaining days. The total number of days is stored in the variable TotalDays. (a) State which library routine (DIV or MOD) must be used to calculate the number of full weeks. Write a pseudocode statement to perform this calculation and store the result in the variable Weeks. (b) State which library routine (DIV or MOD) must be used to calculate the remaining days. Write a pseudocode statement to perform this calculation and store the result in the variable RemainingDays.
查看答案详解收起答案详解
解题
Part (a): To find the integer number of full weeks, the DIV routine is used because it performs integer division. Pseudocode statement: Weeks <- TotalDays DIV 7. Part (b): To find the leftover days (the remainder), the MOD routine is used. Pseudocode statement: RemainingDays <- TotalDays MOD 7.
评分标准
Part (a): 1 mark for identifying DIV. 1 mark for correct pseudocode: Weeks <- TotalDays DIV 7 (accept standard assignment operator '=' or '<-'). Part (b): 1 mark for identifying MOD. 1 mark for correct pseudocode: RemainingDays <- TotalDays MOD 7 (accept standard assignment operator '=' or '<-').
题目 7 · written
6 分
An algorithm has been written in pseudocode to calculate the average score of a student's exams. The program prompts the user to enter 5 exam scores. Each score must be between 0 and 100 inclusive. If an entered score is invalid, an error message is output and the user is repeatedly prompted to re-enter it. After 5 valid scores are entered, the algorithm calculates and outputs the average score.
```text 01 Total <- 0 02 FOR Count <- 1 TO 5 STEP -1 03 REPEAT 04 OUTPUT "Enter score: " 05 INPUT Score 06 IF Score < 0 OR Score > 100 07 THEN 08 OUTPUT "Invalid score, try again." 09 ENDIF 10 UNTIL Score >= 0 OR Score <= 100 11 Total <- Total + Count 12 NEXT Count 13 Average <- Total * 5 14 OUTPUT "The average score is ", Average ```
(a) Identify the line numbers of the four errors in the pseudocode and write a correction for each error.
(b) State one way the programmer could improve the maintainability of this pseudocode. Provide an example from the code.
查看答案详解收起答案详解
解题
Part (a): 1. On Line 02, `STEP -1` will cause the loop to decrement instead of increment, meaning it will not run correctly from 1 to 5. It should be removed. 2. On Line 10, the logical operator `OR` is used. If `Score` is -5, `Score <= 100` is true, so the loop terminates on invalid input. It must be `AND` so both conditions are satisfied for a valid score. 3. On Line 11, the loop counter `Count` is being added to `Total` instead of the variable `Score` entered by the user. 4. On Line 13, `Total` is multiplied by 5 instead of divided by 5 to calculate the average.
Part (b): Improvement can be made by: - Declaring and using constants instead of hardcoded numbers, such as replacing the literal value `5` with `CONSTANT NumExams = 5`. - Adding comments to document parts of the code (e.g. `// Validation loop`). - Using more descriptive variable names (e.g. `ExamScore` instead of `Score`).
评分标准
Part (a): 4 marks - 1 mark for identifying Line 02 and correction: `FOR Count <- 1 TO 5` / remove `STEP -1` - 1 mark for identifying Line 10 and correction: `UNTIL Score >= 0 AND Score <= 100` - 1 mark for identifying Line 11 and correction: `Total <- Total + Score` - 1 mark for identifying Line 13 and correction: `Average <- Total / 5`
Part (b): 2 marks - 1 mark for identifying a valid maintainability method (e.g., constants, comments, descriptive names). - 1 mark for a correct, relevant example based on the pseudocode.
题目 8 · Logic Circuits & Truth Tables
8 分
Consider the logic expression: X = (A OR NOT B) AND (B XOR C). (a) Describe the logic circuit for this expression by specifying the logic gates required and how their inputs and outputs must be connected. Each logic gate must have a maximum of two inputs. Do not simplify the expression. [4] (b) Complete the truth table for this logic expression. In your answer, list the final output values of X for all 8 rows starting from input 000 through to 111. [4]
查看答案详解收起答案详解
解题
(a) Logic circuit connections: 1. A NOT gate has input B. 2. An OR gate has inputs A and the output of the NOT gate. 3. A XOR gate has inputs B and C. 4. An AND gate has inputs from the output of the OR gate and the output of the XOR gate, producing the final output X. (b) Complete truth table for X: Row 1 (0,0,0) -> X = 0; Row 2 (0,0,1) -> X = 1; Row 3 (0,1,0) -> X = 0; Row 4 (0,1,1) -> X = 0; Row 5 (1,0,0) -> X = 0; Row 6 (1,0,1) -> X = 1; Row 7 (1,1,0) -> X = 1; Row 8 (1,1,1) -> X = 0.
评分标准
Part (a) [Max 4]: - 1 mark for identifying a NOT gate with B as input. - 1 mark for identifying an OR gate with inputs A and NOT B. - 1 mark for identifying a XOR gate with inputs B and C. - 1 mark for identifying an AND gate that takes the outputs of the OR and XOR gates to produce X. Part (b) [Max 4]: - 4 marks for 8 correct outputs. - 3 marks for 6/7 correct outputs. - 2 marks for 4/5 correct outputs. - 1 mark for 2/3 correct outputs. Correct output sequence for X (from 000 to 111): 0, 1, 0, 0, 0, 1, 1, 0.
题目 9 · structured
7 分
An animal shelter has set up a database table called `PETS` to store details of the animals currently in their care.
| PetID | Name | Species | Age | Fee | Adopted | |---|---|---|---|---|---| | P01 | Bella | Dog | 3 | 120 | Yes | | P02 | Milo | Cat | 2 | 80 | No | | P03 | Luna | Cat | 5 | 80 | Yes | | P04 | Rocky | Dog | 7 | 150 | No | | P05 | Coco | Rabbit | 1 | 40 | No | | P06 | Daisy | Dog | 3 | 120 | No | | P07 | Simba | Cat | 6 | 80 | Yes |
(a) (i) Identify one appropriate data type for the field `Adopted`. [1]
(ii) State the reason for the data type chosen. [1]
(b) Write the output from the structured query language (SQL) statement: [2]
```sql SELECT Name, Species, Fee FROM PETS WHERE Age < 4 AND Adopted = "No"; ```
(c) Complete the SQL statement to display only the `Name` of the pets that have a `Species` of `Dog`. [3]
(a) (i) Boolean / Text (ii) There are only two possible states (Yes or No) / only two responses possible.
(b) Milo Cat 80 Coco Rabbit 40 Daisy Dog 120
(c) SELECT Name FROM PETS WHERE Species = 'Dog';
评分标准
(a) (i) One mark for: - Boolean (accept logical / text / varchar)
(a) (ii) One mark for: - There are only two possible outcomes/values (Yes and No / True and False).
(b) Two marks for all three correct rows with correct columns. One mark for one or two correct rows. Output table: Name | Species | Fee Milo | Cat | 80 Coco | Rabbit | 40 Daisy | Dog | 120
(c) One mark per correct statement / clause: - `SELECT Name` [1] - `FROM PETS` [1] - `WHERE Species = 'Dog';` (accept double quotes, e.g., `"Dog"`, semicolon is optional) [1]
题目 10 · free-response
8 分
A system requires a function, ValidateCode, to check if a user-entered code meets specific security requirements.
The function must: - take two parameters: the code as a string, and the minimum expected length as an integer - check if the length of the code is at least the minimum expected length - check if the first character of the code is '#' - return TRUE if both conditions are met, otherwise return FALSE
(a) Write an algorithm using pseudocode to define the function ValidateCode. [5 marks]
(b) A program has a string variable called UserCode and a boolean variable called IsValid. Write a pseudocode statement to call the function ValidateCode with the parameter UserCode and a minimum length of 8, and store the returned result in IsValid. [3 marks]
查看答案详解收起答案详解
解题
(a) FUNCTION ValidateCode(Code : STRING, MinLength : INTEGER) RETURNS BOOLEAN IF LENGTH(Code) >= MinLength AND SUBSTRING(Code, 1, 1) = "#" THEN RETURN TRUE ELSE RETURN FALSE ENDIF ENDFUNCTION
(b) IsValid <- ValidateCode(UserCode, 8)
评分标准
(a) One mark per bullet point (Max 5): - Correct function header including name (ValidateCode) and two parameters (Code and MinLength) with appropriate data types. - Correct return type defined (RETURNS BOOLEAN). - Correct check for minimum length of the code using LENGTH(Code) >= MinLength (or equivalent syntax). - Correct check for the first character being '#' using SUBSTRING(Code, 1, 1) = "#" (or equivalent indexing). - Correctly returning TRUE and FALSE under the correct conditions, with clean use of IF-THEN-ELSE structure and ENDFUNCTION.
(b) One mark per bullet point (Max 3): - Correct variable assignment to IsValid (using <- or =). - Correct function call with matching name ValidateCode. - Correct arguments passed in the matching order: UserCode and the integer value 8.
题目 11 · written
7 分
An algorithm has been written in pseudocode to input 5 daily temperature readings, count how many days had a temperature greater than 30 (hot days), and determine the maximum temperature recorded.
(b) Identify the line numbers of the two errors in the pseudocode and suggest a correction for each error.
查看答案详解收起答案详解
解题
### Part (a) Trace Table Walkthrough: - **Initial values**: `HotDays` is set to `0`, `MaxTemp` is set to `0`, and `Count` is initialized to `1`. - **Iteration 1 (`Count` = 1)**: - `Temp` is input as `32`. - Since `32 > 30`, `HotDays` becomes `1`. - `32 < 0` is false, so `MaxTemp` remains `0`. - `Count` increments to `2`. - Loop test `Count = 5` is false. - **Iteration 2 (`Count` = 2)**: - `Temp` is input as `29`. - `29 > 30` is false, so `HotDays` remains `1`. - `29 < 0` is false, so `MaxTemp` remains `0`. - `Count` increments to `3`. - Loop test `Count = 5` is false. - **Iteration 3 (`Count` = 3)**: - `Temp` is input as `35`. - Since `35 > 30`, `HotDays` becomes `2`. - `35 < 0` is false, so `MaxTemp` remains `0`. - `Count` increments to `4`. - Loop test `Count = 5` is false. - **Iteration 4 (`Count` = 4)**: - `Temp` is input as `28`. - `28 > 30` is false, so `HotDays` remains `2`. - `28 < 0` is false, so `MaxTemp` remains `0`. - `Count` increments to `5`. - Loop test `Count = 5` is true, so the loop terminates. Note that the 5th input (`31`) is never read. - **Post-loop outputs**: - Outputs "Max Temp is: 0" and "Hot days: 2".
### Part (b) Logic Errors: 1. **First Error (Line 10)**: The comparison operator is incorrect. To find the maximum temperature, the algorithm should check if `Temp` is greater than `MaxTemp` (`IF Temp > MaxTemp`). Using `<` keeps `MaxTemp` at `0` for all positive values. 2. **Second Error (Line 15)**: The termination condition is off-by-one. Since `Count` starts at `1` and increments inside the loop, using `UNTIL Count = 5` causes the loop to run only 4 times (when `Count` becomes `5` on the 4th iteration, it exits). It should be `UNTIL Count > 5` or `UNTIL Count = 6` to process 5 temperatures.
评分标准
### Part (a) [4 Marks] - **1 mark** for correct initial values (`HotDays = 0`, `MaxTemp = 0`). - **1 mark** for correct trace of `Temp` (32, 29, 35, 28) and `Count` (1, 2, 3, 4, 5). - **1 mark** for correct tracking of `HotDays` (changing to 1, then to 2, and ending at 2). - **1 mark** for correct outputs ("Max Temp is: 0" and "Hot days: 2").
### Part (b) [3 Marks] - **1 mark** for identifying Line 10 and correcting to `IF Temp > MaxTemp`. - **1 mark** for identifying Line 15 and correcting to `UNTIL Count > 5` (or `UNTIL Count = 6`). - **1 mark** for accurate line numbers associated with the corresponding correct logical fix.
题目 12 · programming
15 分
A one-dimensional (1D) array named StudentName[] contains the names of 30 students participating in a science fair.
A two-dimensional (2D) array named StudentScores[] stores the marks awarded to each student for four separate criteria. The first dimension corresponds to the index of the student in StudentName[], and the second dimension represents the criteria index (1 to 4).
Each mark must be an integer from 0 to 50. These marks are entered by the user.
Special recognition is given to any student who has: - the maximum score in any of the four criteria - the highest total mark across all criteria.
A 1D array TotalScore[] is used to store the sum of the four marks for each student.
Write an algorithm using pseudocode or program code to meet these requirements: - input and validate the four marks (from 0 to 50 inclusive) for every student, storing them in StudentScores[] - calculate and store the total mark for each student in TotalScore[] - determine the maximum mark achieved for each of the four criteria - output the name of every student who achieved the maximum mark in each criterion, stating the criterion index - find the maximum total mark overall - output the name(s) of the student(s) with this highest total mark, along with their total mark value.
Your code should include comments explaining how it works. You are not required to declare the arrays. Ensure all inputs and outputs have appropriate prompting messages.
查看答案详解收起答案详解
解题
// Initialize TotalScore array to 0 FOR i <- 1 TO 30 TotalScore[i] <- 0 NEXT i
// Requirement 1: Input, validate and calculate totals FOR StudentIndex <- 1 TO 30 FOR CriterionIndex <- 1 TO 4 REPEAT OUTPUT "Enter score (0-50) for ", StudentName[StudentIndex], " on Criterion ", CriterionIndex, ":" INPUT Mark IF Mark < 0 OR Mark > 50 THEN OUTPUT "Invalid mark. Please enter a value between 0 and 50." ENDIF UNTIL Mark >= 0 AND Mark <= 50
// Store valid mark in the 2D array StudentScores[StudentIndex, CriterionIndex] <- Mark // Add mark to the student's total score TotalScore[StudentIndex] <- TotalScore[StudentIndex] + Mark NEXT CriterionIndex NEXT StudentIndex
// Requirement 2: Determine maximum mark achieved for each of the 4 criteria DECLARE MaxCriterion: ARRAY[1:4] OF INTEGER FOR CriterionIndex <- 1 TO 4 MaxCriterion[CriterionIndex] <- -1 FOR StudentIndex <- 1 TO 30 IF StudentScores[StudentIndex, CriterionIndex] > MaxCriterion[CriterionIndex] THEN MaxCriterion[CriterionIndex] <- StudentScores[StudentIndex, CriterionIndex] ENDIF NEXT StudentIndex NEXT CriterionIndex
// Requirement 3: Output student(s) with highest score in each criterion FOR CriterionIndex <- 1 TO 4 OUTPUT "Highest score for Criterion ", CriterionIndex, " is ", MaxCriterion[CriterionIndex], " achieved by:" FOR StudentIndex <- 1 TO 30 IF StudentScores[StudentIndex, CriterionIndex] = MaxCriterion[CriterionIndex] THEN OUTPUT StudentName[StudentIndex] ENDIF NEXT StudentIndex NEXT CriterionIndex
// Requirement 4: Find maximum total mark overall MaxTotal <- -1 FOR StudentIndex <- 1 TO 30 IF TotalScore[StudentIndex] > MaxTotal THEN MaxTotal <- TotalScore[StudentIndex] ENDIF NEXT StudentIndex
// Requirement 5: Output overall winner(s) with their total score OUTPUT "The highest overall total mark is ", MaxTotal, " achieved by:" FOR StudentIndex <- 1 TO 30 IF TotalScore[StudentIndex] = MaxTotal THEN OUTPUT StudentName[StudentIndex] ENDIF NEXT StudentIndex
评分标准
AO2: Apply knowledge and understanding of the principles and concepts of computer science to a given context, including the analysis and design of computational or programming problems (Max 9 marks)
7-9 marks: - The range of programming techniques used is appropriate to the problem. - All criteria stated for the scenario have been covered by the use of appropriate programming techniques (nested iteration, 1D/2D array manipulation, input validation, running totals, finding maximum values). - The data structures chosen are appropriate and store all the data required.
4-6 marks: - Some programming techniques used are appropriate to the problem. - More than one technique is applied to the scenario (e.g., handles input and validation, but logic for identifying multiple students with maximum values contains errors). - Some of the data structures chosen are appropriate and store some of the data required.
1-3 marks: - At least one programming technique has been used (e.g., a simple loop to input data). - Some data has been stored, but not appropriately.
---
AO3: Provide solutions to problems by evaluating computer systems, making reasoned judgements, and presenting conclusions (Max 6 marks)
5-6 marks: - The program has been fully and clearly commented. - Suitable identifiers with names meaningful to their purpose have been used throughout. - The program is in a logical order. - The solution is accurate and logically performs all the tasks given in the scenario. Ignore minor syntax errors.
3-4 marks: - Program is seen with some relevant comment(s). - The majority of identifiers used are appropriately named. - The solution contains parts that may be illogical or inaccurate. - The solution meets most of the requirements.
1-2 marks: - Program is seen without relevant comments. - Some identifier names used are appropriate. - The solution is inaccurate in many places. - The solution attempts at least one of the requirements.
想知道自己有几分把握?
thinka 是 DSE 学生在用的 AI 练习应用,提供无限量练习题、即时自动批改和详细解题步骤。超过 100,000 名学生用它确认自己是真的会,而不只是「以为会」。