Microsoft Certified Solutions Developer (MCSD) Certification Practice Test

Disable ads (and more) with a membership for a one time $2.99 payment

Prepare for the Microsoft Certified Solutions Developer Certification Test. Use multiple choice quizzes with hints and explanations to boost your readiness. Excel on your test!

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


Which Regular Expression pattern correctly matches a 7-digit phone number?

  1. ^\d{7}$

  2. ^[2-9][0-9]{2}-\d{4}$

  3. ^[0-9]{3}-\d{4}$

  4. ^\d{3}-\d{4}|\d{7}$

The correct answer is: ^[2-9][0-9]{2}-\d{4}$

The most suitable choice for matching a 7-digit phone number is based on the pattern represented. In this case, the correct answer focuses specifically on the requirements for a standard 7-digit number format, which can be simplified for practical uses. The established pattern ensures that it begins with any digit from 2 to 9 for the first digit, given that phone numbers typically do not start with 0 or 1. It then includes any digit from 0 to 9 for the next two digits, followed by a hyphen, and concludes with another set of four digits. This structure accurately represents a common format for a 7-digit phone number, typically broken into two segments. Other options don't meet the criteria for a standard 7-digit phone number format. For example, some options either expect additional formatting such as hyphens or are structured too loosely to pinpoint a 7-digit sequence. The chosen pattern is the most precise representation reflecting the organization and restrictions commonly found in telephone numbering conventions.