2016-03-26 00:47:20 +01:00
|
|
|
# headbands quiz
|
|
|
|
|
2016-04-02 01:22:47 +02:00
|
|
|
create a charades game with a collection of strings.
|
2016-03-26 00:47:20 +01:00
|
|
|
|
|
|
|
## Name
|
|
|
|
|
|
|
|
## Directions
|
|
|
|
|
2016-04-13 17:27:45 +02:00
|
|
|
Use this activity document to guide your work in the [headbands tutorial](/lessons/headbands/activity).
|
2016-03-26 00:47:20 +01:00
|
|
|
|
|
|
|
Answer the questions while completing the tutorial. Pay attention to the dialogues!
|
|
|
|
|
|
|
|
## 1. What is the meaning of the term 'collection' in programming? What is a 'collection' of strings?
|
|
|
|
|
|
|
|
<br/>
|
|
|
|
|
|
|
|
<br/>
|
|
|
|
|
2018-11-10 00:36:46 +01:00
|
|
|
## 2. Write the line of code that will display the string "puppy" using `coll`.
|
2016-03-26 00:47:20 +01:00
|
|
|
|
2016-03-31 02:01:28 +02:00
|
|
|
```blocks
|
2018-11-10 00:36:46 +01:00
|
|
|
let coll: string[] = []
|
2016-03-26 00:47:20 +01:00
|
|
|
coll.push("puppy")
|
|
|
|
coll.push("clock")
|
|
|
|
```
|
|
|
|
|
|
|
|
<br/>
|
|
|
|
|
2018-11-10 00:36:46 +01:00
|
|
|
## 3. Write the line of code that will display the string "cat" using `coll`.
|
2016-03-26 00:47:20 +01:00
|
|
|
|
2016-03-31 02:01:28 +02:00
|
|
|
```blocks
|
2018-11-10 00:36:46 +01:00
|
|
|
let coll: string[] = []
|
2016-03-26 00:47:20 +01:00
|
|
|
coll.push("puppy")
|
|
|
|
coll.push("clock")
|
|
|
|
coll.push("cat")
|
|
|
|
```
|
|
|
|
|
|
|
|
<br/>
|
|
|
|
|
2018-11-10 00:36:46 +01:00
|
|
|
## 4. Write the five (5) lines of code that will add the following five words to `coll`: puppy, clock, night, cat, cow.
|
2016-03-26 00:47:20 +01:00
|
|
|
|
2017-02-25 14:38:18 +01:00
|
|
|
```typescript
|
|
|
|
let coll : string[] = [];
|
2016-03-26 00:47:20 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
<br/>
|
|
|
|
|
|
|
|
<br/>
|
|
|
|
|
|
|
|
<br/>
|
|
|
|
|
|
|
|
<br/>
|
|
|
|
|
|
|
|
## 5. Write the code to get a string from the collection at a random position.
|
|
|
|
|
|
|
|
<br/>
|
|
|
|
|
|
|
|
<br/>
|
|
|
|
|
|
|
|
<br/>
|
|
|
|
|
|
|
|
<br/>
|
|
|
|
|