Interview Questions: Describing Code (Braces)

One of the most frustrating things during interview can be coding on paper then having to reiterate what you’ve written to an interviewer.  One frustration I’ve found was discerning the differences between the names of the braces used in programming.  Here’s a list to help with that:

  • ( ) – Parenthesis, aka open-bracket (used when defining ranges in math), or round-bracket
  • [ ] – Square brackets, or closed-bracket (used when defining ranges in math)
  • { } – Curly brackets
  • < > – Angle brackets, aka inequality signs, or just “brackets”

When describing them from left to right, ( is the “open parenthesis”, ) the “close/closing parenthesis”.

Example:

[(d{1,4}),(d{1,2})]

Would be “Backslash open-square-bracket open-parenthesis back-slash d open-curly-brace one comma four closing-curly-brace closing-parenthesis comma open-parenthesis backslash d open-curly-brace one comma two closing-curly-brace closing-parenthesis backslash closing-square-brace”.  This is why telling an interviewer a regular expression is a terrible experience.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: