Navigation
Description This test assesses basic Rascal skills. In each exercise you have to select a choice or fill in a text field. Push the Give answer button when you have completed your answer.

When you make an error, you can push the I want another question button for a similar question (if available). You can repeat this until you have the right answer or you give up.

You pass when you have more than 60% of the questions right.
Pitfalls This assessment software is still experimental; please bear with us and take the following into account:
  • Answers are not recorded: show at the end of the session all your answers to the instructor.
  • Do not go to another page of the tutor since all your answers will be erased (precaution: record your answers yourself)
  • Always push the Give answer button when you are ready (a newline in the text box will not work).

    Be aware: in the web version, there are no questions visible: use the Eclipse version instead

Questions
Question [1]. Sets can be used to represent a sequence of values when




Question [2]. The type of a list is determined by:




Question [3].
The type of {"Prune"} is

Question [4].
The type of [9, -13, 15, -7] is

Question [5].
The type of ("Raspberry": false, "C-3PO": true) is

Question [6].
The type of {-19, } is set[int]

Question [7].
The type of ("Darth Sidious": ) is map[str,int]

Question [8].
The type of {-6, 17, 13, 2, -5} is

Question [9].
The type of {-16, "Countess Darling Von Darling", -16} is

Question [10].
The type of {<"J", -19, |file:///home/paulk/pico.trm|(0,1,<2,3>,<4,5>)>} is

Question [11].
The type of {<3, -12>} is

Question [12]. Determine the number of elements in a list
Given
import List;
text = ["abc", "def", "ghi"];
(text) == 3;

Question [13]. Determine the number of strings that contain "a".
Fill in
text = ["andra", "moi", "ennepe", "Mousa", "polutropon"];
public int count(list[str] text){
  n = 0;
  for(s <- text)
    if( := s)
      n +=1;
  return n;
}

and make the following true:
count(text) == 2;

Question [14]. Return the strings that contain "o".
Fill in
text = ["andra", "moi", "ennepe", "Mousa", "polutropon"];
public list[str] find(list[str] text){
  return 
    for(s <- text)
      if(/o/ := s)
        ;
}
and make the following true:
find(text) == ["moi", "Mousa", "polutropon"];

Question [15]. Complete this function that finds duplicates in a list of strings
Fill in
text = ["the", "jaws", "that", "bite", "the", "claws", "that", "catch"];
public list[str] duplicates(list[str] text){
    m = {};
    return 
      for(s <- text)
        if()
           append s;
        else
           m += s;
}
and make the following true:
duplicates(text) == ["the", "that"];

Question [16]. Complete this function that tests that a list of words forms a palindrome. A palindrome is a word that is symmetrical
Fill in
import List;
public bool isPalindrome(list[str] words){
  return words == ;
}
and make the following true:
isPalindrome(["a", "b", "b", "a"]) == true;



Is this page unclear, or have you spotted an error? Please add a comment below and help us to improve it. For all other questions and remarks, visit ask.rascal-mpl.org.