Eleni Koutsomitopoulou - Ελένη Κουτσομητοπούλου
  • Home
  • Class material
    • Course Syllabus
    • Course Calendar
    • Sample Lecture
    • Sample Quiz
    • Additional Course Syllabi >
      • Corpus Linguistics
      • Machine Learning
      • Statistical NLP
  • Blog
  • Contact
SIL-UND 2010 COMPUTATIONAL SYNTAX AND MORPHOLOGY 
Week 7 Class 5
Quiz 
Multiple Choice: For each of the following questions, circle the letter of the answer that best answers the question.

  1. Which of the strings below return true: a. "\t ".isspace()

    b. "jkl xyz abc".lower()

    c. “abc abc”.isalnum()

    d. “abc”.isalnum()

2. Which of the following string transformations are produced by the function: rstrip("m") 


         A. "lemma" -> "lemma" 
         B. "anthem" -> "anthe" 
         C. "hi" -> "hello" 
         D. "theorem" -> "theor"


True or False: For each statement, circle True or False.

TRUE   FALSE   1.  
"pa" in "apple"

TRUE   FALSE   2.  In dictionary dic with the following pairs: {'box':'yellow', 'apple':'red', 'book':'blue'}, dic['pen'] is true.

TRUE   FALSE    3. Both simplistic morphological parsing as well as full-fledged parsing have their weaknesses. 

TRUE   FALSE    4. re.match(“c”, “abcdef”) returns a successful match

TRUE   FALSE    5. 
The find Python function returns the substring that was found in the original string. 


Question 1: Write a Python function that tells us how many o's are in the string “moustokoulouro”?


Question 2: How do you make this a proper title: 

"The unbearable lightness of being"


Question 3: Using Perl, produce the anagram 'hypnotic' of the string 'pythonic'.


Question 4: Using Python functions, first test whether the string “p h a n t a s t i c” is in title case and if it is not, convert it into that case. Then correct any spelling errors in the word. 



Question 5: Write a short python program that asks the user for a number and prints the number on standard output for validation. 


Question 6: Generate anagram "stunted" from original string "student" using sed and an equivalent python function.





Powered by Create your own unique website with customizable templates.