Skip to content

Course home

Programming concepts

Programming concepts

EasyMediumHard
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
Question 31

Write a C# program to check if a deep-space radio-telescope frequency log contains a valid consecutive sequence of five signals within a batch of 200 telemetry records.

When writing your program you should assume:

  • there is an array called telemetrySignals that contains the integer frequencies of the 200 records
  • telemetrySignals[0] contains the frequency of the first record and telemetrySignals[199] contains the frequency of the last record
  • the frequencies in telemetrySignals are stored in ascending numerical order
  • there is a Boolean variable called hasAnomalyRun that has an initial value of false

Your program should set hasAnomalyRun to true if there is a valid consecutive sequence of five records (where each adjacent frequency increases by exactly 1).

You should use meaningful variable name(s) and C# syntax in your answer.

Sequence Examples:

  • Valid run of five: ..., 101, 102, 103, 104, 105, ...
  • Invalid run of five (gap): ..., 45, 46, 48, 49, 50, ...
  • Invalid run of five (duplicate): ..., 80, 81, 81, 82, 83, ... (The duplicate frequency 81 breaks the continuous progression of five unique adjacent elements)
[7]
Markscheme

Programming concepts Questions

  1. GCSE
  2. /Computer Science
  3. /Programming concepts

298 exam-style questions on AQA GCSE Computer Science Programming concepts. Each one has a worked solution and a mark scheme showing where the marks go.

Question bank