---
title: "String Concatenation — AP CSP Definition & Exam Guide"
description: "String concatenation joins two or more strings end-to-end to make a new string (EK AAP-2.D.1). Learn how AP CSP tests it in Topic 3.4 and how it differs from substring."
canonical: "https://fiveable.me/ap-comp-sci-p/key-terms/string-concatenation"
type: "key-term"
subject: "AP Computer Science Principles"
unit: "Unit 3"
---

# String Concatenation — AP CSP Definition & Exam Guide

## Definition

String concatenation is the operation that joins two or more strings end-to-end to create a new string, like combining "Hello" and "World" into "HelloWorld". On the AP CSP exam it falls under Topic 3.4 (Strings) and learning objective 3.4.A, evaluating expressions that manipulate strings.

## What It Is

String concatenation joins two or more [strings](/ap-comp-sci-p/unit-3/strings/study-guide/0bMtDyDHxqMcwyDgQkjw "fv-autolink") end-to-end to make a brand new [string](/ap-comp-sci-p/unit-3/data-abstraction/study-guide/kMMTClSiHohfiaHMGFFE "fv-autolink"). That's the exact wording of EK AAP-2.D.1, and the "end-to-end" part matters. Concatenation doesn't merge, sort, or interleave anything. It just glues string B onto the end of string A, in order.

Think of it like snapping train cars together. `"Hello"` + `"World"` gives you `"HelloWorld"` (no space, because you never added one). In most languages you'll see, the `+` symbol does the joining, which is the same symbol as addition. That's why `3 + 4` gives `7` but `"3" + "4"` gives `"34"`. The operation depends on the [data type](/ap-comp-sci-p/key-terms/data-type "fv-autolink"), not the symbol. One more detail worth locking in: concatenation produces a *new* string. The originals don't change.

## Why It Matters

Concatenation lives in Topic 3.4 (Strings) inside [Unit 3](/ap-comp-sci-p/unit-3 "fv-autolink"): Algorithms and Programming, and it directly supports learning objective [AP Comp Sci P](/ap-comp-sci-p "fv-autolink") 3.4.A, which asks you to evaluate expressions that manipulate strings. The CED pairs it with substring (EK AAP-2.D.2) as the two core string operations you're expected to know. Beyond Topic 3.4, concatenation shows up everywhere you build output for a user. Generating a username, formatting a message, or assembling a result inside a loop all lean on it. If you can trace a concatenation expression character by character, you can handle most string questions the exam throws at you.

## Connections

### [Substring (Unit 3)](/ap-comp-sci-p/key-terms/substring)

[Substring](/ap-comp-sci-p/key-terms/substring "fv-autolink") and concatenation are opposites in the CED. A substring pulls a piece *out* of an existing string, while concatenation glues strings *together*. Exam questions love combining them, like extracting a first initial with a substring operation and then concatenating it onto a last name.

### Concatenation Operator (+) (Unit 3)

The `+` symbol is how most languages write concatenation, which means it does double duty with arithmetic. `5 + 5` is `10`, but `"5" + "5"` is `"55"`. Knowing which behavior fires depends entirely on whether the operands are numbers or strings.

### String Manipulation (Unit 3)

Concatenation is one tool in the broader string manipulation toolbox that 3.4.A covers. Real programs chain operations, like taking a substring of an [input](/ap-comp-sci-p/unit-1/program-function-purpose/study-guide/8hL8KatG4rAWTwZSglGB "fv-autolink") and concatenating it into a new output string.

### [Algorithm (Unit 3)](/ap-comp-sci-p/key-terms/algorithm)

Concatenation often appears inside iteration, where an [algorithm](/ap-comp-sci-p/key-terms/algorithm "fv-autolink") builds a result string one piece at a time through a loop. Tracing what the string looks like after each pass is a classic Unit 3 skill.

## On the AP Exam

Concatenation shows up in multiple-choice questions where you evaluate string expressions or pick the code segment that produces a target output. A typical stem gives you a real task, like building a username from a first initial, last name, and birth year, and asks which code segment correctly concatenates the pieces. Other questions flip it around and ask which operation *counts* as concatenation, so you need to recognize the definition itself (joining strings end-to-end, per EK AAP-2.D.1). The most common trap is the number-versus-string distinction. Watch whether values are in quotes, because `"3" + "4"` and `3 + 4` give very different answers. Also pay attention to order and spacing; concatenation preserves the exact order you write and adds nothing you didn't include. The Create Performance Task is another place this matters, since programs that format output or build messages almost always use concatenation somewhere.

## String Concatenation vs Substring

They're paired in the CED but move in opposite directions. Concatenation (EK AAP-2.D.1) combines strings into a longer new string, while a substring (EK AAP-2.D.2) is a piece taken from inside an existing string. Concatenation builds; substring extracts. If a question's output is longer than its inputs, you're looking at concatenation. If it's a slice of one input, that's a substring.

## Key Takeaways

- String concatenation joins two or more strings end-to-end to create a new string, which is the exact definition in EK AAP-2.D.1.
- Concatenation creates a new string and does not modify the original strings.
- The same + symbol means addition for numbers and concatenation for strings, so "3" + "4" is "34" while 3 + 4 is 7.
- Concatenation adds nothing extra, so "Hello" + "World" is "HelloWorld" with no space unless you concatenate one in yourself.
- Concatenation builds strings up while substring pulls pieces out, and the exam frequently combines both in a single expression.
- This term lives in Topic 3.4 (Strings) under learning objective 3.4.A, which asks you to evaluate expressions that manipulate strings.

## FAQs

### What is string concatenation in AP Computer Science Principles?

It's the operation that joins two or more strings end-to-end to create a new string, straight from EK AAP-2.D.1 in Topic 3.4. For example, concatenating "Hello" and "World" produces "HelloWorld".

### Does concatenation change the original strings?

No. Concatenation always produces a brand new string and leaves the originals untouched. If a question asks what a variable holds after a concatenation it wasn't assigned to, the answer is its original value.

### What's the difference between string concatenation and substring?

Concatenation combines strings into a longer new string, while a substring is a piece extracted from inside an existing string (EK AAP-2.D.2). The CED lists them side by side as the two string operations you need under learning objective 3.4.A.

### Why does "3" + "4" give "34" instead of 7?

Because both values are strings, the + operator concatenates them end-to-end instead of adding them. The same expression without quotes, 3 + 4, evaluates to 7. Spotting this difference is one of the most common MCQ traps.

### Does concatenation automatically add spaces between strings?

No. Concatenation joins strings exactly as written, so "Hello" + "World" is "HelloWorld". To get "Hello World" you have to concatenate a space yourself, like "Hello" + " " + "World".

## Related Study Guides

- [Big Idea 3: Algorithms and Programming](/ap-comp-sci-p/unit-3/review/study-guide/eOWMqAJUdtnmttaCSlis)

## Structured Data

```json
{"@context":"https://schema.org","@graph":[{"@type":"LearningResource","@id":"https://fiveable.me/ap-comp-sci-p/key-terms/string-concatenation#resource","name":"String Concatenation — AP CSP Definition & Exam Guide","url":"https://fiveable.me/ap-comp-sci-p/key-terms/string-concatenation","learningResourceType":"Concept explainer","educationalLevel":"AP® / High School","about":{"@id":"https://fiveable.me/ap-comp-sci-p/key-terms/string-concatenation#term"},"audience":{"@type":"EducationalAudience","educationalRole":"student"},"dateModified":"2026-06-11T00:50:13.431Z","isPartOf":{"@type":"Collection","name":"AP Computer Science Principles Key Terms","url":"https://fiveable.me/ap-comp-sci-p/key-terms"},"publisher":{"@type":"Organization","name":"Fiveable","url":"https://fiveable.me"}},{"@type":"DefinedTerm","@id":"https://fiveable.me/ap-comp-sci-p/key-terms/string-concatenation#term","name":"String Concatenation","description":"String concatenation is the operation that joins two or more strings end-to-end to create a new string, like combining \"Hello\" and \"World\" into \"HelloWorld\". On the AP CSP exam it falls under Topic 3.4 (Strings) and learning objective 3.4.A, evaluating expressions that manipulate strings.","url":"https://fiveable.me/ap-comp-sci-p/key-terms/string-concatenation","inDefinedTermSet":{"@type":"DefinedTermSet","name":"AP Computer Science Principles Key Terms","url":"https://fiveable.me/ap-comp-sci-p/key-terms"},"educationalAlignment":[{"@type":"AlignmentObject","alignmentType":"educationalSubject","educationalFramework":"AP® Course and Exam Description","targetName":"AP® Computer Science Principles Unit 3, Topic 3.4, LO 3.4.A"}]},{"@type":"FAQPage","mainEntity":[{"@type":"Question","name":"What is string concatenation in AP Computer Science Principles?","acceptedAnswer":{"@type":"Answer","text":"It's the operation that joins two or more strings end-to-end to create a new string, straight from EK AAP-2.D.1 in Topic 3.4. For example, concatenating \"Hello\" and \"World\" produces \"HelloWorld\"."}},{"@type":"Question","name":"Does concatenation change the original strings?","acceptedAnswer":{"@type":"Answer","text":"No. Concatenation always produces a brand new string and leaves the originals untouched. If a question asks what a variable holds after a concatenation it wasn't assigned to, the answer is its original value."}},{"@type":"Question","name":"What's the difference between string concatenation and substring?","acceptedAnswer":{"@type":"Answer","text":"Concatenation combines strings into a longer new string, while a substring is a piece extracted from inside an existing string (EK AAP-2.D.2). The CED lists them side by side as the two string operations you need under learning objective 3.4.A."}},{"@type":"Question","name":"Why does \"3\" + \"4\" give \"34\" instead of 7?","acceptedAnswer":{"@type":"Answer","text":"Because both values are strings, the + operator concatenates them end-to-end instead of adding them. The same expression without quotes, 3 + 4, evaluates to 7. Spotting this difference is one of the most common MCQ traps."}},{"@type":"Question","name":"Does concatenation automatically add spaces between strings?","acceptedAnswer":{"@type":"Answer","text":"No. Concatenation joins strings exactly as written, so \"Hello\" + \"World\" is \"HelloWorld\". To get \"Hello World\" you have to concatenate a space yourself, like \"Hello\" + \" \" + \"World\"."}}]},{"@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"AP Computer Science Principles","item":"https://fiveable.me/ap-comp-sci-p"},{"@type":"ListItem","position":2,"name":"Key Terms","item":"https://fiveable.me/ap-comp-sci-p/key-terms"},{"@type":"ListItem","position":3,"name":"Unit 3","item":"https://fiveable.me/ap-comp-sci-p/unit-3"},{"@type":"ListItem","position":4,"name":"String Concatenation"}]}]}
```
