SAS Advanced Programming Certification Practice Exam

Session length

1 / 20

Which Perl regular expression correctly replaces 'PG3' with 'PG3M6'?

'r/PG3/PG3M6/'

's/PG3/PG3M6/'

The choice that correctly replaces 'PG3' with 'PG3M6' is represented by the syntax 's/PG3/PG3M6/'. This is because the 's' at the beginning indicates that this is a substitution operation in Perl's regular expression syntax. The full format of a substitution operation is 's/pattern/replacement/', which clearly identifies the pattern to match (in this case, 'PG3') and what to replace it with (in this case, 'PG3M6').

The other options employ either incorrect syntax for replacement or do not perform a substitution operation at all. The first option, while using 'r', does not conform to Perl's substitution rules. The third option represents a pattern matching operation rather than a replacement, and the fourth option would actually replace 'PG3M6' with 'PG3', which is the opposite of what is needed in this scenario. Thus, the substitution command with the 's' is the correct choice for performing the desired action of replacing 'PG3' with 'PG3M6'.

'm/PG3M6/PG3/'

's/PG3M6/PG3/'

Next question

Find the option that is right for you!

All options are one-time payments.

$25.99

30 day premium pass

All the basics to get you started

  • Ad-free experience
  • View your previous attempt history
  • Mobile app access
  • In-depth explanations
  • 30 day premium pass access
👑$59.99 $171.99 usd

6 month DELUXE pass (most popular)

Everything with the 30 day premium pass FOR 6 MONTHS! & the ultimate digital PDF study guide (BONUS)

  • Everything included in the premium pass
  • $171.99 usd value for $59.99! You save $106!
  • + Access to the ultimate digital PDF study guide
  • + 6 months of premium pass access
  • + Priority support
$15.99 $24.99

Ultimate digital PDF study guide

For those that prefer a more traditional form of learning

  • Available for instant download
  • Available offline
  • Hundreds of practice multiple choice questions
  • Comprehensive content
  • Detailed explanations
Image Description
Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy