Past-paper question · 2023 May-June · Paper 41 · Q1(d)(i)

Question 1(d)(i) 2023 · May-June · Paper 41 · 4 marks

Original past-paper question for 1(D)(I)
Original past-paper question for 1(D)(I)
Original past-paper question for 1(D)(I)
Reveal official mark-scheme answer Official mark-scheme answer for 1(D)(I)

Official answer for Question 1

Part (d)

(i)

Question 1

mark each

Question 4

✓
Prompt and reading input …
✓
…with validation for whole number between 0 and 100 inclusive
✓
Calling LinearSearch() with array and valid data input and storing/using return value
✓
Output of the message with return value
✓
Example program code:
✓
Java
✓
System.out.println("Enter a number to find");
✓
Integer DataToFind = -1;
✓
Scanner NewScanner = new Scanner(System.in);
✓
while(DataToFind < 0 || DataToFind > 100){
✓
DataToFind = Integer.parseInt(NewScanner.nextLine());
✓
}
✓
Integer NumberTimes = LinearSearch(DataArray, DataToFind);
✓
System.out.println("The number " + DataToFind + " is found " + NumberTimes + " times");
✓
VB.NET
✓
Console.WriteLine("Enter a number to find ")
✓
Dim DataToFind As Integer = -1
✓
Do Until DataToFind >= 0 And DataToFind <= 100
✓
DataToFind = Console.ReadLine()
✓
Loop
✓
Dim NumberTimes = LinearSearch(DataArray, DataToFind)
✓
Console.WriteLine("The number " & DataToFind & " is found " & NumberTimes & " times.")
✓
Python
✓
DataToFind = int(input("Enter a number to find "))
✓
while DataToFind < 0 or DataToFind > 100:
✓
DataToFind = int(input("Enter a number to find "))
✓
NumberTimes = LinearSearch(DataArray, DataToFind)
✓
print("The number", DataToFind, "is found", NumberTimes, "times")
✓
9618/41
✓
Cambridge International AS & A Level – Mark Scheme
✓
May/June 2023
✓
PUBLISHED
✓
Question
✓
Answer
✓
Marks

Mark scheme 9618_s23_ms_41.pdf →

Show text version of question

Question 1

Part (d)

(i)

Question 1

A program reads data from a file and searches for specific data.

(i)

Amend the main program to:

  • prompt the user to input a whole number between 0 and 100 inclusive
  • read and validate the input from the user
  • call LinearSearch() with DataArray and the validated input value
  • output the result in the format:

The number 7 is found 2 times.

Save your program.

Copy and paste the program code into part 1(d)(i) in the evidence document.

[4]
Topic relevance

Why this question appears here

71% assigned-topic match · Programming › Programming basics

Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.

Permanent source page: Educate A Change · From 9618_s23_qp_41.pdf

Keep practising this topic