Which of the following pseudocode DECLARE statements correctly defines a variable to store a single symbol such as '%' or '?' according to the syllabus standards?
Cambridge IGCSE · Computer Science (0478)
Programming concepts:练习题
5 道选择题即时批改,另有 5 道文字题附完整解题步骤,全部围绕「Programming concepts」。
Evaluate the result of the following pseudocode expression using the library routine ROUND:
Value ← ROUND(7.625 * 2, 1)
Determine the final value of Total after the following nested loops are executed:
Total ← 0
FOR Outer ← 1 TO 3
FOR Inner ← Outer TO 3
Total ← Total + 1
NEXT Inner
NEXT Outer
Identify the most appropriate basic data type for a variable that stores whether a system alarm is currently 'ON' or 'OFF'.
Evaluate the result of the following pseudocode string handling operations:
Title ← "IGCSE2026"
Result ← SUBSTRING(UCASE(Title), 1, 5)
Identify the most appropriate basic data type for a variable that stores the number of items currently in a shopping basket (e.g., \( 12 \)).
先自己写一遍答案,再对照解题步骤。
A variable X has an initial value of \( 10 \). State the final value of Y after the following pseudocode is executed:
IF X > 5 THEN
IF X < 15 THEN
Y ← 20
ELSE
Y ← 30
ENDIF
ENDIF
先自己写一遍答案,再对照解题步骤。
Identify the resulting value and the final data type of the variable LogicFlag in the following statement:
LogicFlag ← (25 DIV 4) < (15 MOD 6)
先自己写一遍答案,再对照解题步骤。
A programmer is developing a software module to manage a sequence of temperatures. The system needs to process these values to identify trends and ensure data integrity.
(a) Write pseudocode for a function named FindThresholdCount. The function should:
- Accept two parameters: an ARRAY of 50 REAL numbers named TempData and a REAL value named Threshold.
- Iterate through the array and count how many temperatures are strictly greater than the threshold.
- Return the total count.
(b) The system needs to validate user input for a temperature reading. Write pseudocode for a procedure named GetValidTemp that:
- Repeatedly prompts the user to enter a temperature.
- Uses a post-condition loop to ensure the temperature is between \(-50.0\) and \(150.0\) inclusive.
- Stores the valid input in a global variable named CurrentTemp.
(c) Explain the difference between a function and a procedure in terms of how they provide results back to the calling part of the program.
先自己写一遍答案,再对照解题步骤。
A software developer is creating a routine to validate user inputs during the registration process.
(a) Define a FUNCTION called CheckLength that receives a string InputString and an integer MinLength as parameters. The function should return TRUE if the string length is greater than or equal to the minimum length, and FALSE otherwise.
(b) Write pseudocode to call this function within a REPEAT ... UNTIL loop that keeps asking the user for a password until it meets a minimum requirement of \(8\) characters.
先自己写一遍答案,再对照解题步骤。
* thinka提供的内容由AI生成,可能并非总是准确或最新。请将其用作辅助资源,并与官方材料进行核实。
想多做几道同类题目?立即开始练习这个课题,边做边批改。
立即练习