Salesforce Certified Marketing Cloud Engagement Developer Practice Questions

Salesforce Certified Marketing Cloud Engagement Developer exam preparation

Salesforce Certified Marketing Cloud Engagement Developer practice questions in English: 180 questions with explanations. The mock exam has 60 questions and 105 minutes.

Salesforce Certified Marketing Cloud Engagement Developer free question 4 / 10 · Domain 2: Programmatic Languages

A developer sets @code to "0312F-Gold" and outputs Substring(@code, 7) with no third parameter. What is printed?

  1. G, as the function returns a single character when a length is not given
  2. 0312F-, as the function returns the part of the string before the start position
  3. Gold, as the substring starts at position 7 and runs to the end of the string
  4. -Gold, as the first character of the string is position 0
Show the answer and explanation

Answer: C

Why this is correct
Substring() has a required start position and an optional length. In "0312F-Gold" the positions 1 to 6 are "0312F-", and position 7 is the letter G. With no length, the substring continues to the end of the string, so the output is "Gold".

Why the other options are wrong
"G, as the function returns a single character when a length is not given" … The page says that without a length the substring continues to the end of the string, so the result is not limited to one character.
"-Gold, as the first character of the string is position 0" … Positions are counted from 1, so position 7 is the letter G and the dash is position 6.
"0312F-, as the function returns the part of the string before the start position" … The function returns the portion of the string that begins at the start position. It does not return the part before it.

Key point
Without a length, Substring() runs from the start position to the end.

Go to the Salesforce Certified Marketing Cloud Engagement Developer practice app (10 free questions; purchase unlocks all questions)

See the full practice set