Cambridge International A Level · Computer Science (9618)

Programming: แบบฝึกหัด

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

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

Which statement correctly describes the effect of passing a parameter BYVAL (by value) to a procedure in Programming?

ข้อ 2
1 คะแนน

In Programming, which of the following is a primary advantage of using a CASE structure instead of multiple nested IF statements?

ข้อ 3
1 คะแนน

Consider the following Programming pseudocode intended to find the maximum value in an array Arr of \( n \) integers:

Max ← Arr[1]
FOR i ← 2 TO n
  IF Arr[i] > Max THEN
    Max ← Arr[i]
  ENDIF
NEXT i

Which of the following describes the most significant risk if this algorithm is implemented without further validation or stepwise refinement?

ข้อ 4
1 คะแนน

A programmer needs to write a routine that repeats a block of code exactly 100 times. Which type of loop structure is most appropriate for this task in pseudocode?

ข้อ 5
1 คะแนน

A programmer is developing a module using the following pseudocode algorithm:

PROCEDURE Process(BYVAL x, BYREF y)
\(x \leftarrow x + 10\)
\(y \leftarrow y + x\)
\(x \leftarrow x \times 2\)
ENDPROCEDURE

DECLARE a, b : INTEGER
\(a \leftarrow 5\)
\(b \leftarrow 15\)
Process(a, b)
OUTPUT a, b

What is the output of this algorithm?

ข้อ 6
3 คะแนน

Describe how the implementation of exception handling improves the robustness of a program during a file-read operation.

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

ข้อ 7
5 คะแนน

Explain the concept of polymorphism in Object-Oriented Programming and describe how it relates to inheritance.

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

ข้อ 8
4 คะแนน

Explain the difference between passing a parameter by value and by reference when calling a procedure in a high-level programming language.

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

ข้อ 9
4 คะแนน

A programmer is developing a simple application to manage a theater's ticket pricing. The standard ticket price is set at \( \$25 \). The system applies the following rules:
- Customers aged 12 or under receive a \( 40\% \) discount.
- Customers aged 65 or over receive a \( 20\% \) discount.
- All other customers pay the full price.

a) Identify the most appropriate data types for the following variables: Age, StandardPrice, and IsMember (a flag indicating if they have a loyalty card).

b) Write pseudocode using a selection structure to calculate the FinalPrice for a customer based on their Age.

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

ข้อ 10
5 คะแนน

Consider the following pseudocode snippet:
PROCEDURE UpdateValue(BYREF x, BYVAL y)
  x = x + 10
  y = y + 10
ENDPROCEDURE

If variables A = 5 and B = 5 are passed to UpdateValue(A, B):
a) State the values of A and B after the procedure call and justify your answer by explaining the difference between Passing by Value and Passing by Reference.
b) Describe the role of a Function Header in structured programming.
c) Explain why using parameters is preferred over using global variables within subroutines.

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

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

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

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

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

เริ่มฝึกเลย