Which term describes extracting a portion of text by selecting a start and end position?

Prepare for the IGCSE Algorithms and Pseudocode Exam. Study with comprehensive questions covering key algorithms and pseudocode techniques. Access hints and explanations to gear up for your exam success!

Multiple Choice

Which term describes extracting a portion of text by selecting a start and end position?

Explanation:
The operation is called a substring: it describes taking a contiguous portion of a string by choosing where it starts and where it ends. This produces a new string consisting of the characters in that range. In many languages, the end position is exclusive, so you include characters from the start index up to (but not including) the end index. For example, from "abcdef" with a start of 1 and an end of 4 you’d get "bcd" in the end-exclusive convention. The other terms don’t fit this idea: lower/upper relate to changing letter case, and length is just the total number of characters in the whole string.

The operation is called a substring: it describes taking a contiguous portion of a string by choosing where it starts and where it ends. This produces a new string consisting of the characters in that range. In many languages, the end position is exclusive, so you include characters from the start index up to (but not including) the end index. For example, from "abcdef" with a start of 1 and an end of 4 you’d get "bcd" in the end-exclusive convention. The other terms don’t fit this idea: lower/upper relate to changing letter case, and length is just the total number of characters in the whole string.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy