HTTP/1.0 200 OK Content-type: text/html Test 13 -- Strings

,6/13 12:14 CDT,Due date-->9/20/2004 10:00 CDT

  1. What character is used to bracket a string constant?
    1) [ 2) " 3) ' 4) (

  2. What is the length of the shortest string?
    1) 0 2) 1 3) -1 4) 2

  3. How do you specify non-printing characters like TAB in a string?

  4. Character codes are numbered starting at what value?

  5. For s="23456789abc" what character is at position 4?

  6. For s="23456789abc" what character is at position -7?

  7. What is the operator for string concatenation?
    1) + 2) cat 3) & 4) ..

  8. What is the result of print("44".."33"); ?
    1) syntax error 2) runtime error 3) prints 77 4)prints 4433

  9. What is the result of print(44..33); ?
    1) syntax error 2) runtime error 3) prints 77 4)prints 4433

  10. Investigate your compiler. Is there a length limit on string constants? What is it?

  11. What string operator returns the number of characters in a string?

  12. What is the length of the string "3457 20"?

  13. What module contains string manipulation functions?

  14. The following questions use the assignment t="foobar";.
  15. What is the index of the 'b' character?

  16. What is the index of the first 'o' character?

  17. What is the index of the 'a' character?

  18. What is the value returned by t>"FOOBAR"?

  19. What is the value returned by t<"foo"?

  20. What is meant by the term collating sequence?

  21. What is the value returned by t:upper()=="FOOBAR"?

  22. What is the value returned by t:reverse()?

  23. What string method finds the position of one string within another?

  24. What is the index of the first match for t:find("b")?

  25. What is the index of the first match for t:find("oo")?

  26. What is the output for print(t:find("oob"))?

  27. What is the value returned for t:find("fO")?

  28. What is the output for print(t:rep(2))?

  29. What string method retrieves a sequence of characters within a string?

  30. For s="0123456789abc", what is the value of s:sub(6,9)?

  31. For s="0123456789abc", what is the value of s:sub(9)?

  32. For s="0123456789abc", what is the value of s:sub(-6)?

  33. For s="0123456789abc", what is the value of s:sub(-6, -3)?

  34. For s='foobar', what is the value of s:gsub('o', '99')?

  35. For s="foobar", what is the value of s:gsub("o", "")?

  36. For s="foobar", what is the output for print(s:gsub("o", ""))?

  37. What name describes a phrase that reads the same when reversed?

  38. What was Adam's famous palindromic statement to Eve?

  39. Find the longest sensible English palindrome word?