Course Content
Paper 2 – Problem Solving Approach -Practical
0/102
Past Paper-2 May/June 2025
Past Paper-1 May/June 2025
Download Files
0/1
Olevel : Computer Science 2210 / IGCSE 0478 : Recorded

Answer:

// Step 1: Setting and Declaration
DECLARE StudentNames : ARRAY[1:5] OF STRING
DECLARE SearchName : STRING
DECLARE Count : INTEGER
DECLARE Found : BOOLEAN

// Step 2: Input student names
FOR Count ← 1 TO 5
              OUTPUT “Enter name of student “, Count, “: “
              INPUT StudentNames[Count]
NEXT Count

// Step 3: Input name to search
OUTPUT “Enter the name to search: “
INPUT SearchName

// Step 4: Initialize Found as FALSE
Found ← FALSE

// Step 5: Linear Search
   FOR Count ← 1 TO 5
         IF StudentNames[Count] = SearchName THEN
         Found ← TRUE
         OUTPUT “Student found at position “, Count
    NEXT Count
ENDIF
NEXT Count

// Step 6: If not found
IF Found = FALSE THEN
       OUTPUT “Student not found”
ENDIF

You cannot copy content of this page