nerdexam
Python_Institute

PCEP-30-02 · Question #75

The + operator, when applied to strings, performs:

The correct answer is B. Concatenation. When the + operator is applied to strings, it performs concatenation - joining two or more strings end-to-end (e.g., "Hello" + " World" produces "Hello World"). Options A, C, and D (subtraction, multiplication, division) are arithmetic operations that apply to numbers, not…

Question

The + operator, when applied to strings, performs:

Options

  • ASubtraction
  • BConcatenation
  • CMultiplication
  • DDivision

How the community answered

(51 responses)
  • A
    2% (1)
  • B
    76% (39)
  • C
    8% (4)
  • D
    14% (7)

Explanation

When the + operator is applied to strings, it performs concatenation - joining two or more strings end-to-end (e.g., "Hello" + " World" produces "Hello World"). Options A, C, and D (subtraction, multiplication, division) are arithmetic operations that apply to numbers, not strings; most languages will either throw an error or produce unexpected results if you attempt these on string types. Option B is correct because + is overloaded in most programming languages to serve dual purposes: arithmetic addition for numbers and concatenation for strings. A handy memory tip: think of concatenation like gluing strings together - the + sign is the "glue," and just as you'd add building blocks in sequence, strings are joined in the order they appear.

Community Discussion

No community discussion yet for this question.

Full PCEP-30-02 Practice