RascalTutor
Synopsis

Test Case

Description

VERSIE 3

1. Questions

Question 1

Which means of transportation is faster:

Apache Helicopter
High-speed train
Ferrari F430
Hovercraft
Question 2

Replace the text box by the result of the multiplication and make the test true:

module Question2

test bool multiplication() =
     3 * 3 == 
;
Question 3

Replace the text box by the result of the intersection and make the test true:

module Question3

test bool setIntersection() =
     {7,-45,-61} & {35,68,67,46,15} == 
;
Question 4

Replace the text box by a function name and make the test true:

module Question4
import List;

test bool listFunction() =
 
([-2, -19, -22, 74, 43, 6, 46, -98, 49]) == 9;
Question 5

Click on all identifiers in this code fragment:

x = 1;
if(x){
   y = x + 2;
}
Question 6

Create a function to print squares by placing all code fragments in the grey box in the right order with the right indentation:

}
for(int i <- [1 .. n + 1])
println("Squares from 1 to " + n);
println(i + " squared = " + (i * i));
void squares(int n){
Question 7

Create a function to print squares by placing all code fragments in the grey box in the right order with the right indentation (and avoid decoys!):

void squares(int n){
println(i + " squared = " + (i + i));
i = 0;
}
println("Squares from 1 to " + n);
i += 1;
println(i + " squared = " + (i * i));
for(int i <- [1 .. n + 1])
Question 8

Reorder the following items and make all statements true:

  • 123
  • [1,2,3]
  • {1,2,3}
  • "abc"
  • is a list[int]
  • is an int
  • is a str
  • is a set[int]