Skip to content

Course home

String handling operations in a programming language

String handling operations in a programming language

EasyMedium
1234567891011121314151617181920
Question 3

An agricultural research laboratory wants to create tracking codes for soil samples collected in the field.

The table below shows details of some of the samples:

sampleIDlocationsoilType
S9DEVONPEAT
S12YORKSHIRESILT
S15KENTSAND

A tracking code is made up of the:

  • sampleID
  • first letter and second letter of the location
  • first letter of the soilType

For example:

  • the tracking code for S9 in DEVON with PEAT would be S9DEP
  • the tracking code for S12 in YORKSHIRE with SILT would be S12YOS

Write a VB.NET program to create the tracking code for a soil sample.

The program should:

  • get the user to enter the sampleID, location, and soilType
  • create the tracking code according to the rules above
  • assign the tracking code to a variable called trackingCode

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

[4]
Markscheme

String handling operations in a programming language Questions

  1. GCSE
  2. /Computer Science
  3. /String handling operations in a programming language

89 exam-style questions on AQA GCSE Computer Science String handling operations in a programming language. Each one has a worked solution and a mark scheme showing where the marks go.

Question bank