Skip to content

Course home

Programming concepts

Programming concepts

EasyMediumHard
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
Question 43

Write a VB.Net program to check if a system has a sequence of five consecutive integers within its list of 150 recorded sensor readings.

When writing your program you should assume:

  • there is an array called pressures that contains the 150 integer sensor readings
  • pressures(0) contains the first value and pressures(149) contains the last value
  • the values in pressures are already stored in ascending numerical order
  • there is a Boolean variable called runDetected that has an initial value of False.

Your program should set runDetected to True if there is a valid run of five consecutive integers (for example: 102,103,104,105,106102, 103, 104, 105, 106102,103,104,105,106).

You should use meaningful variable name(s) and VB.Net syntax in your answer.

[6]
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