1. Clunker Motors Inc. is recalling all vehicles in its Extravagant line from model years 1999-2002 as well all vehicles in its Guzzler line from model years 2004-2007. Given variables model Year and modelName write a statement that assigns True to recalled if the values of model Year and modelName match the recall details and assigns False otherwise.

2. Assume that c is a variable that has assigned a string value. Write an expression whose value is true if and only if c is a newline character.

3. Assume that c is a variable has been assigned a string value. Write an expression whose value is true if and only if c is a tab character.

4. Given the variable c, whose associated value is a str, write an expression that is True if and only if c is not equal to a string consisting of a single blank.

5. Associate two String variables named background and selection Color with the values "white" and "blue" respectively.

6. Associate the variable foreground with the value "red".

7. Write an expression that is the concatenation of the strings "Hello" and "World".

8. Write an expression that is the concatenation of two strings s1 and s2".

9. Write an expression whose value is the concatenation of the three strigs name1, name2, and name3, separated by commas. So if name1, name2, and name 3, were (respectively) "Neville", "Dean", and "Seamus", your expression's value would be "Neville, Dean, Seamus".

10. Given a String variable address, write a String expression consisting of the string "http://" concatenated with the variable's String value. So, if the variable refers to "www.turingscraft.com", the value of the expression would be "http://www.turingscraft.com".

11. Write an expression that concatenates the String variable suffix onto the end of the String variable prefix

12. Given a variable word that has been assigned a string value, write a string expression that parenthesizes the value of word. So, if word contains "sadly", the value of the expression would be the string "(sadly)"

13. Write an expression that evaluates to True if and only if s refers to the string "end".

14. Write an expression that evaluates to True if the string associated with s1 is greater than the string associated with s2.

15. Write an expression that evaluates to True if the variable last name refers to a str that is greater than the str "Dexter".

16. Write an expression that evaluates to True if and only if the variable s does not refer to the string "end".

17. Given the variables name1 and name2, write a fragment of code that assigns the larger of their associated values to first. (NOTE: "larger" here means alphabetically larger, not "longer". Thus, "mouse" is larger than "elephant" because "mouse" comes later in the dictionary than "elephant"!)

18. Clunker Motors Inc. is recalling all vehicles in its Extravagant line from model years 1999-2002. Given variables model Year and modelName write a statement that assigns True to recalled if the values of model Year and modelName match the recall details and assigns False otherwise.

19. Write an expression whose value is the character at index 3 of string s.

20. Write an expression whose value is the last character in string s.

21. Write an expression whose value is the str that consists of the second to last character of the str associated with s.

22. Write an expression whose value is the str that consists of the third to last character of the str associated with s.

23. Assume that name is a variable of type string that has been assigned a value. Write an expression whose value is a string containing the first character of the value of name. So if the value of name were "Smith" the expression's value would be "S".

24. Write an expression whose value is the string that consists of the first four characters of string s.

25. Write an expression whose value is the string that consists of the second through fifth characters of string s.

26. Write an expression whose value is the string consisting of all the characters (starting with the sixth) of string s.

27. Given that s refers to a string, write an expression that evaluates to a string that is a substring of s and that consists of all the characters of s from its start through its ninth character.

28. Given a variable s associated with a str, write an expression whose value is a str that is identical except that all the letters in it are upper-case. Thus, if the str associated with s were "McGraw 15", the value of the expression would be "MCGRAW15".

29. Write an expression whose value is the same as the str associated with s but with all lower case letters. Thus, if the str associated with s were "McGraw 15", the value of the expression would be "mcgraw 15".

30. Write an expression whose value is True if all the letters in string s are all lowercase.

31. Write an expression whose value is True if all the letters in string s are uppercase.

32. Write an expression that evaluates to True if string s starts with "p".

33. Write an expression that returns False if the str associated with s begins with "ecto".

34. Write an expression that returns True if string s ends with "ism".

35. Assume that sentence is a variable that has been associated with a string consisting of words separated by single space characters with a period at the end. For example: "This is a possible value of sentence."

Write the statements needed so that the variable second Word is associated with the second word of the value of sentence. So, if the value of sentence were "Broccoli is delicious." your code would associate second Word with the value "is".

36. Write a sequence of statements that finds the first comma in the string associated with the variable line, and associates the variable clause the portion of line up to, but not including the comma.

37. Given variables first and last, each of which is associated with a string, representing a first and a last name, respectively. Write an expression whose value is a string that is a full name of the form "Last, First". So, if first were associated with "alan" and last with "turing", then your expression would be "Turing, Alan". (Note the capitalization! Note: no spaces!) And if first and last were "Florean" and "fortescue" respectively, then your expression's value would be "Fortescue,Florean".

38. Write an expression whose value is the same as the str associated with s but with reversed case. Thus, if the str associated with s is "McGraw", the value of the expression would be "mCERAW".

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.