高中 (HKDSE) · 資訊及通訊科技

程式編寫在現實生活的應用:練習題

5 條多項選擇題即時批改,另有 5 條文字題附完整解題步驟,全部圍繞「程式編寫在現實生活的應用」。

10 條題目31 免費,無需登記
第 1 題
1

A student is writing a program to control a smart fan. The program is designed to start the motor automatically when the ambient light sensor detects that a lamp in the room has been turned on. In the context of event-driven programming, what is the most appropriate term for the specific block of code that contains the instructions to start the motor?

第 2 題
1

In an event-driven program for a robotic arm, the system needs to respond to various inputs. Which of the following scenarios describes a sensor-based event rather than a user-action event?

第 3 題
1

When constructing a program that uses speech recognition to control a motor, why is it often necessary to implement asynchronous event handling rather than simple sequential polling of the audio input?

第 4 題
1

When developing a program to interact with specialized physical hardware such as an accelerometer or a speech recognition module, what is the primary advantage of using extended programming modules or libraries?

第 5 題
1

A student is developing a program for an automated greenhouse. The program must monitor the ambient brightness and trigger a motor to close the blinds when the light level exceeds a specific value. Which component of event-driven programming is primarily responsible for executing the code to close the blinds when this light threshold is reached?

第 6 題
3

A student is developing an event-driven program for an automatic street lighting system. Describe the event that would trigger the system to turn the lights on and name one physical output device that the program would control.

先自己寫一次答案,再對照解題步驟。

第 7 題
5

A high-tech fitness watch uses a built-in accelerometer and a vibration motor to assist users in maintaining a proper running pace. Describe the logical flow of an event-driven program for this device that triggers a tactile alert when the user's sudden acceleration exceeds a pre-defined threshold, and specify which component acts as the event source.

先自己寫一次答案,再對照解題步驟。

第 8 題
3

Consider a smart doorbell system designed to take a photo when motion is detected. Explain how an event handler would be structured to manage this functionality, identifying the specific event and the corresponding action.

先自己寫一次答案,再對照解題步驟。

第 9 題
8

A logistics company is developing an automated parcel sorting system that uses a robotic arm controlled by a microcontroller. The system includes a weight sensor, an accelerometer to detect if the platform is unstable, and servo motors to move parcels into different bins.


(a) Explain the difference between using a polling method and an event-driven method to monitor the accelerometer for instability. State one advantage of the event-driven approach in this real-life application.


(b) The developers use an extended programming library to control the motors. Describe two benefits of using such a library instead of writing low-level code to communicate with the hardware.


(c) The sorting logic is defined as follows:
- If the accelerometer detects a tilt where the vertical acceleration falls below a threshold, i.e., \( a_z < 9.0 \) \( m/s^2 \), the system must immediately call a function EmergencyStop().
- Otherwise, it reads the weight \( W \). If \( W \ge 5 \) kg, it triggers MoveArm(Bin_A). If \( 0.5 \le W < 5 \) kg, it triggers MoveArm(Bin_B). If \( W < 0.5 \) kg, the parcel is ignored.
Write a pseudocode segment for the event handler onWeightChange(W, az) that implements this logic.

先自己寫一次答案,再對照解題步驟。

第 10 題
7

A logistics warehouse uses a fleet of automated guided vehicles (AGVs) to transport goods. Each AGV is equipped with an accelerometer and a motor controller. The AGV program must automatically stop the motor if the vehicle detects a sudden impact or tilt beyond a safe threshold to prevent damage.


(a) Explain how the accelerometer acts as an input device for this real-life application and describe the specific type of data it would capture for the program.


(b) In the context of event-driven programming, identify the 'event' that would trigger the emergency stop and explain how an event handler would be used to manage this situation.


(c) The development team decides to use an extended programming module to interface with the AGV's hardware. State two advantages of using such a module instead of writing the hardware-level communication code from scratch.


(d) Suggest another physical device that could be integrated into the system using a similar programming approach to help the AGV avoid obstacles, and name the corresponding physical output action the program should perform when an obstacle is detected.

先自己寫一次答案,再對照解題步驟。

* thinka提供的內容由AI生成,可能並非總是準確或最新。請將其用作輔助資源,並與官方材料進行核實。

你已看過標準答案,接下來輪到批改你的答案。

這一頁可以告訴你好答案的樣子,卻無法指出你的答案欠缺什麼。thinka 按真實評分準則批改你的文字答案,約 15 秒完成。

想多做幾條同類題目?立即開始練習呢個課題,即做即批改。

立即練習