Cambridge International AS Level · Computer Science (9618)

Algorithm Design and Problem-solving: แบบฝึกหัด

ข้อปรนัย 5 ข้อ ตรวจให้ทันทีที่ตอบ และข้อเขียน 5 ข้อ พร้อมวิธีทำละเอียด ทั้งหมดจากเรื่อง Algorithm Design and Problem-solving

10 ข้อ25 คะแนนฟรี ไม่ต้องสมัคร
ข้อ 1
1 คะแนน

A programmer needs to document an algorithm that calculates the area of a circle. The requirements are:
1. Input the radius (\(r\)).
2. Check if \(r\) is greater than 0.
3. If valid, calculate \(Area = 3.14159 \times r^{2}\).
4. Output the result.

Which tool uses standard geometric symbols such as parallelograms for input/output and diamonds for decisions to represent this logic?

ข้อ 2
1 คะแนน

Study the following pseudocode snippet:

Total ← 0
FOR i ← 1 TO 5
  INPUT Value
  IF Value > 10 THEN
    Total ← Total + 1
  ENDIF
NEXT i


If the input values are 5, 12, 10, 15, and 8, what will be the final value of Total?

ข้อ 3
1 คะแนน

Consider the following pseudocode intended to find the smallest value in an array List with indices from 1 to 10:

Min ← List[1]
FOR Index ← 2 TO 10
  IF List[Index] < Min THEN
    Min ← List[Index]
  ENDIF
NEXT Index


If List contains the values [40, 30, 50, 20, 20, 10, 60, 5, 80, 100], how many times will the assignment Min ← List[Index] be executed?

ข้อ 4
1 คะแนน

An algorithm is being developed using stepwise refinement. Which of the following best describes this process?

ข้อ 5
1 คะแนน

A programmer is designing an algorithm to process a list of 500 employee names stored in a 1D array. The names are currently unsorted. The goal is to find the position of a specific name, "Zackary", within the array.

Which search algorithm must be used in this scenario, and what is the maximum number of comparisons required to determine if the name is not in the list?

ข้อ 6
2 คะแนน

In the context of Algorithm Design and Problem-solving, identify the computational thinking technique that involves hiding unnecessary details to focus on the essential characteristics required for a specific purpose.

ลองเขียนคำตอบด้วยตัวเองก่อน แล้วค่อยเทียบกับวิธีทำ

ข้อ 7
3 คะแนน

Consider the following pseudocode snippet that performs a linear search on an array Data[1:5] containing the values [12, 7, 25, 14, 9]:

Found ← FALSE
Index ← 1
WHILE Index <= 5 AND NOT Found
  IF Data[Index] = 14 THEN
    Found ← TRUE
  ELSE
    Index ← Index + 1
  ENDIF
ENDWHILE


What is the final value of Index when the loop terminates?

ลองเขียนคำตอบด้วยตัวเองก่อน แล้วค่อยเทียบกับวิธีทำ

ข้อ 8
5 คะแนน

A linked list is implemented using a 1D array of records. The list contains three nodes with StartPointer = 2:
- List[1]: Data = "Cat", NextPointer = -1
- List[2]: Data = "Apple", NextPointer = 3
- List[3]: Data = "Banana", NextPointer = 1

What is the third data value accessed when traversing the linked list from the start pointer?

ลองเขียนคำตอบด้วยตัวเองก่อน แล้วค่อยเทียบกับวิธีทำ

ข้อ 9
6 คะแนน

A software developer is creating a computerized model of a city's public transport system. During the design phase, the developer applies abstraction and decomposition.

(a) Explain the purpose of abstraction when creating this model. (2 points)

(b) Suggest two details that would be essential to include in the model and two details that could be ignored through abstraction. (2 points)

(c) The task "Calculate Journey Time" needs to be broken down. Use decomposition to identify two sub-tasks that would be required to calculate the total travel time between two bus stops. (2 points)

ลองเขียนคำตอบด้วยตัวเองก่อน แล้วค่อยเทียบกับวิธีทำ

ข้อ 10
4 คะแนน

Consider the following pseudocode function:


FUNCTION CalculateScore(Data[1:4] : INTEGER) RETURNS INTEGER
  DECLARE Result : INTEGER
  Result ← 0
  FOR i ← 1 TO 4
    IF Data[i] MOD 2 <> 0 THEN
      Result ← Result + (Data[i] * 2)
    ELSE
      Result ← Result + (Data[i] DIV 2)
    ENDIF
  NEXT i
  RETURN Result
ENDFUNCTION


If the array passed to the function contains the values [3, 8, 5, 4], what is the value returned by the function?

ลองเขียนคำตอบด้วยตัวเองก่อน แล้วค่อยเทียบกับวิธีทำ

* เนื้อหาของ thinka สร้างโดย AI อาจไม่ถูกต้องสมบูรณ์ในทุกกรณี กรุณาใช้เป็นสื่อเสริมและตรวจสอบกับเอกสารอ้างอิงอย่างเป็นทางการ

คุณเห็นเฉลยแล้ว ทีนี้มาตรวจคำตอบของคุณบ้าง

หน้านี้บอกได้ว่าคำตอบที่ดีเป็นอย่างไร แต่บอกไม่ได้ว่าคำตอบของคุณขาดอะไร thinka ตรวจข้อเขียนของคุณตามเกณฑ์ให้คะแนนจริงในราว 15 วินาที

อยากฝึกโจทย์แบบนี้เพิ่มไหม เริ่มฝึกหัวข้อนี้ได้เลย ตรวจให้ทันทีทุกข้อ

เริ่มฝึกเลย