Skip to main contentSkip to solution

State the output of the following query:

SELECT LEFT(RTRIM('$$PYTHON$$'),4);

WHERE '$' REPRESENTS BLANK SPACE.

Solution

✅ Correct Option: 1

RTRIM removes only the trailing blank spaces on the right. So $$PYTHON$$ becomes $$PYTHON, with the two leading spaces kept.

LEFT(string, 4) then returns the first 4 characters: two spaces, P and Y, which gives $$PY.


Option 2: this would need the leading spaces removed too (LTRIM or TRIM), but RTRIM does not touch the left side.

Options 3 and 4: these come from RIGHT, not LEFT. RIGHT on the original string gives ON$$, and RIGHT after RTRIM gives THON.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question