String handling operations in a programming language

EasyMedium
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
Question 40
Easy

The POSITION_OF subroutine returns the 1-based index representing the first occurrence of a character in a string.

For example:

  • POSITION_OF("ATCGATTACG", "G") would return 4
  • POSITION_OF("ATCGATTACG", "C") would return 3

targetBase and geneSequence are variables used in the algorithm below.

geneSequence ← "ATCGATTACG"
organism ← "E. coli"
OUTPUT "Enter a nucleotide base to search for: "
targetBase ← USERINPUT

Complete the pseudo-code statement to find the first occurrence of the character stored in targetBase within geneSequence and store this position in the variable index.

You must use the POSITION_OF subroutine in your answer.

index ← _______

[1]

String handling operations in a programming language Questions

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