Skip to content

Course home

String handling operations in a programming language

String handling operations in a programming language

EasyMedium
1234567891011121314151617181920
Question 10

A student is writing an automated system logging utility and defines three string variables:

service ← "Database"
status ← "Offline"
id ← "743"

The system generates a tracking code using the following expression:

result ← service.substring(0, 4) + status.substring(2, 3) + id.substring(1, 2)

What is the value of the variable result after this expression is evaluated?

(Assume that string.substring(startIndex, length) uses 0-based indexing and returns a substring of the specified length.)

A

"Datafli43"

B

"Dataffl74"

C

"Dataf4"

D

"Databfl43"

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