Which of the following describes the benefit of using meaningful identifiers when writing a program?
Pearson Edexcel GCSE (9-1) · Computer Science (1CP2)
Develop code:练习题
5 道选择题即时批改,另有 4 道文字题附完整解题步骤,全部围绕「Develop code」。
A student writes a program to calculate the average of three numbers but accidentally uses the formula avg = a + b + c / 3. What type of error is this?
A developer is using abstraction to design a flight simulator. Which of the following would be an example of applying abstraction in this context?
A programmer wants to make their Python code easier for others to understand. Which of these techniques uses non-executable text to describe what a specific section of the code does?
Consider the following pseudocode segment:x = 10y = 5IF x > y THEN
x = x - yELSE
y = y - xENDIF
What is the final value of x?
A developer is refining a program to make it more maintainable. Identify two techniques mentioned in the specification that improve code readability.
先自己写一遍答案,再对照解题步骤。
A program crashes when a user enters a string instead of a number. Identify the type of error and suggest a technique to prevent it.
先自己写一遍答案,再对照解题步骤。
A developer needs to create a program that manages a 2D array representing a 3x3 grid for a game.
(a) Write a code statement to initialize a 3x3 2D array named grid with the character "X" in all positions.
(b) Explain how to access the element in the second row and third column.
(c) Write a nested loop structure to print all elements of the 2D array to the screen.
先自己写一遍答案,再对照解题步骤。
A robot moves on a coordinate plane. It starts at \((0,0)\). It receives a list of commands: "N", "S", "E", "W".
(a) Create an algorithm using a case/switch selection or nested IFs to update x and y coordinates based on a variable cmd.
(b) Use a loop to process a list of commands: ["N", "N", "E", "S"]. Show the final values of x and y.
(c) Explain how decomposition was used to solve this problem.
先自己写一遍答案,再对照解题步骤。
* thinka 提供的内容由 AI 生成,未必在任何情况下都完全准确或最新,请结合官方教材与教师指导使用。
想多做几道同类题目?立即开始练习这个课题,边做边批改。
立即练习