Click to reopen instructions.

This assessment consists of functions you need to write involving primarily string expressions. It is a closed book assessment. You should stay on this tab until you are done and there should be no talking. This assessment is about how much you understand. There are no automatic tests but you can use the REPL to test things yourself.

You can move through the questions with the arrows at the upper right next to the 1 of indicator so if you're not sure how to write one function move on to another one and come back if you have time at the end. I want to see how much you do know. Note: you can also click on thingsLikeThis in these instructions and the questions to copy them to the clipboard to avoid spelling mistakes. (I.e. click to copy and then ⌘-v to paste wherever you want.)

A useful method you might want to use in some of these questions:

When you are done, please click on your Github username above and submit a GitHub pull request of the branch and request me as a reviewer. Doing this correctly is part of the assessment. If you are unsure how to request a review, please ask for help!

Put definitions here.

Revisions:

Questions of

Write a function named upToX that takes a single string argument and returns a string consisting of the characters of the original string up to but not including the first 'x'. For instance upToX('quixotic') should return 'qui'.

Write a function named charactersAround that takes two arguments, a string and an index into the string and returns a string consisting of two characters, the one immediately before the character at the given index and one and the one immediately after the character at the given index. You can assume that those characters exist, i.e. the index is not at the beginning or end of the string. For instance charactersAround('programming', 4) should return 'ga'.

Write a function named middle that takes a single string argument and returns a sting consisting of the the middle of the argument, defined as the original string with the first and last quarter removed. You can assume the number of characters in the string is a multiple of four. For instance middle('abcdefgh') should return 'cdef'.

Write a function named pair that takes two string arguments and returns a single string consisting of the two arguments separated by the word and. For instance pair('peanut butter', 'jelly') should return peanut butter and jelly.

Write a function named containsX that takes a single string argument and returns true if it contains an 'x' and false if it does not. For instance containsX('flexible') should return true and containsX('smooth') should return false.

Write a function named slug that takes three string arguments and returns a “slug” consisting of the three strings joined together with hyphens and all in lower case. For instance slug('Foo', 'Bar', 'BAZ') would return 'foo-bar-baz'.

Write a function named capitalize that takes a single string argument and returns a string with the same characters but with the first character in upper case and all remaining characters in lower case. For instance capitalize('programming') should return 'Programming'.

Write a function named capitalizeName that takes a single string consisting of a first and last name separated by a space and returns a string with the first and last name separated by a space but capitalized using the capitalize function you just wrote. For instance capitalizeName('fred flintstone') should return 'Fred Flintstone'. Note: you must use capitalize in this function to get full credit.

REPL