Course Topics for COS7 * grade 7 Computer Studies December

```EXAM REVIEW TOPICS:
Course:
Teacher:
Date:
Time:
Computer Science
Ms J. Burnham and Ms Y. Zhang
Thursday, Dec. 11, 2014.
12:30 p.m.
Course Code:
ICS20 (all sections)
Duration:
90 minutes
This exam is closed book. No computers, calculators, notes or books may be brought into the exam.
Bring a pencil for the multiple choice section. You will be using a scantron card.
TOPICS:
Alice programming
Web design and html coding
HOW TO STUDY:
Practice making storyboards for Alice programs we have completed during class.
Complete all the review as posted on the website.
Page 1 of 25
Practising ALICE
Nine Questions – Practical Alice Questions for Review
1.
Given is a textual storyboard. Implement the storyboard in Alice.
a)
Scenario:
place an alien into a world.
b)
Make this procedure.
alienRightStep – this is a world-level procedure
do together
alien moves forward 1 duration 2
do together
do in order
alien left leg hip joint turn forward .1 revolution
alien left leg hip joint turn backward .1 revolution
do in order
alien right leg hip joint turn backward .1 revolution
alien right leg hip joint turn forward .1 revolution
c)
Call this in the myFirstMethod
count 5 times
alienRightStep
2.
a)
Add alienLeftStep to your world. Exactly the same as Rightstep except everything is
reversed.
do together
alien moves forward 1 duration 2
do together
do in order
alien right leg hip joint turn forward .1 revolution
alien right leg hip joint turn backward .1 revolution
do in order
alien left leg hip joint turn backward .1 revolution
alien left leg hip joint turn forward.1 revolution
b)
Call it in myFirstMethod
Page 2 of 25
count 5 times
alienRightStep
alienLeftStep
1. a)
Write the storyboard for this Alice program given. The objects that have been
added (instantiated) into the world are the marchHare and the madHatter. Both Alice in
Wonderland characters.
Page 3 of 25
b)
4.
a)
What happens when this program is run (executed)?
Write a textual storyboard to create a method called swim.
Senario:
A fish is placed into a world. In order to swim forward it needs to swim simultaneously up (a
positive or minus value) and forward.
Page 4 of 25
e.g. If the fish moves up 1 and forward 1 both at the same time
If the fish moves up -1 (it actually moves down) and forward at the same time
b)
times.
5.
Change your storyboard for the previous question in order to cause more than one fish to
use this swim method. Call this parameter whichFish and make its type Swimmer.
Implement this in Alice and call it for multiple fish.
6.
Add two more parameters to the method swim in the previous question.
howFarUp type decimal and
howFarForward type decimal.
Implement this in Alice and call it for multiple fish for multiple distances.
Page 5 of 25
Extension Exercise. Have the fish move up and forward a random number between 0 and 2.
7.
Write a storyboard and Alice program to move an character in a figure 8 around 2
objects. Use the “as seen by” option.
8.
Write a textual storyboard and an Alice program to write movement methods.
(walk, or run, or hop)
Choose an animal or person that has the ability to move, turn and roll and can use
their legs, arms or wings. Write this as a method that is called in myFirstMethod.
Page 6 of 25
OTHER QUESTIONS (SOME MULTIPLE CHOICE, SOME FILL IN)
1..
A section of code that checks a condition or computes a value is called a(n):
a)
b)
c)
d)
question
parameter
function
none of the above
2.
To make an object invisible in ALICE, you may:
a)
b)
c)
d)
make the opacity of the object = 1
make the opacity of the object = 0
set the invisibility of the object = true
none of the above
3.
Six relational operators exist in Alice. Which of the following represents “greater than or equal to”
a)
b)
c)
d)
=&lt;
&lt;=
=&gt;
&gt;=
4.
One tool for copying a set of instructions from one place to another in the editor is to use the
_____________.
a)
b)
c)
d)
trash can
clipboard
play button
5.
The keyword(s) _____________ signals the presence of sequential execution
a)
b)
c)
d)
DO IN ORDER
DO TOGETHER
IF/ELSE
NOW
6.
a)
b)
c)
d)
Which of the following describes a primitive method or procedure in ALICE?
say
move
a) and b) above
none of the above
Page 7 of 25
7.
One reason a programmer creates her own procedures is to _____________.
a)
b)
c)
d)
divide a program into small manageable pieces that work together to create a meaningful whole
allow two different objects to be instantiated from the same class
allow non-interactive code to execute differently each time an Alice world is run
create a distinction between built-in Alice objects and modified Alice objects
8.
A comment in an Alice program is:
a)
b)
c)
d)
an instruction that causes an action to take place
an explanation of what the program does
an expression that holds a value when the program runs
A special property that all objects have
9.
Which statement is an example of a repetition control structure?
a)
b)
c)
d)
Do together statement
If/Else statement
Do in order statement
Loop statement
10
A boolean value is ____________.
a)
b)
c)
d)
a number
a string
either true or false
the value 0, 1, or -1
11.
What does it mean to say that the “cat's vehicle is the horse”?
a)
b)
c)
d)
This statement synchronizes the movement of the cat and the horse.
This statement makes the cat and the horse face in the same direction.
This statement creates a world-level procedure.
a) and b)
Page 8 of 25
PARTB
12. Match each term, appearing in the left column, with its definitions, appearing in the right column. The first
answer is done for you as an example.
B
property (of an object)
A.
a step by step list of instructions
implement
B.
features or characteristics of an object ie the snowwoman’s head is pink
method or procedure
C.
the time in seconds that an instruction is performed
function
D.
a list of actions to perform a task
duration
E.
asking a question to produce a result
algorithm
F.
A single “thing” in a virtual world. It has been made according to plan (or class)
bug
G.
error in a program
simultaneous
H.
a single line of code
computer program
I.
a set of instructions written in a programming language
storyboard
J.
A 3-D environment that can contain objects. These objects can perform tasks.
elegant (when talking
flowchart
K.
One after another
L.
Taking place at the same time as another thing
object
M. The scene which is to be created and the general purpose of the program
instruction
N.
Change your storyboard into program code
runtime
O.
A pictorial representation of a plan for a program or a movie
virtual world
P.
The program is efficient and clear
nesting
Q.
argument
R.
A pictorial plan of action which uses standard diagram shapes for different
action.
A measure of how visible or invisible an object is
comment (in a program)
S.
control structure
T.
A statement that is included in a program which explains the program and gives
credit to the author.
The time when the program is executing or running.
sequential
U.
When one block of code is completely inside another
trial and error
V.
Write a line of code – test it – amend it if necessary test again
scenario
W. These are programming blocks which direct the flow of execution of the
program. E..g do together
X. A “basket” or place holder for a value which is passed to a procedure e.g.
WhichToy
Y. The actual value that is passed to a procedure. whichToy = bunny. Bunny is tha
actual value which is passed.
Z. An instance of a class which is placed in a world.
parameter
opacity
class
AA. A gallery item
BB. A characteristic of an object
13.
How do you know whether a computer program has a bug?
Page 9 of 25
14.
15. Control structures
(b) What Alice control structure would you use to :
1. Have two skaters skate side by side _____________________________
2. Make a dump truck pick up a pile of dirt and move it to another pile
______________________________________
3. Make a snowman nod his head 3 times ___________________________
Page 10 of 25
16.
What happens when the following program is executed?
Page 11 of 25
17. What happens when the following ALICE program is executed?
Page 12 of 25
18.
In the program above, what logical error has the programmer made? What can they
do to fix it?
19.
Imagine a program where a rider sits on a horse.
Should the horse be the vehicle of the rider? Or should the rider be the vehicle of the horse?
20.
What property will make an object invisible?
21.
Two fish are in the world as follows
a) What happens when the following program is executed?
Page 13 of 25
22.
Alice the a astronaut and the alien are on Mars. There is a mysterious cave on the red planet.
a)
If the alien is closer to the cave, what happens when this program is executed?
b)
If Alice is closer to the cave, what happens when this program is executed?
c)
If they are the same distance from the cave, what happens then when this program is
executed?
Page 14 of 25
23. If the witch is facing the cauldron and is 14 m away from it, what happens
when the following program is executed?
24.Consider the following world
Page 15 of 25
Write a storyboard for a procedure jumpOver to cause a bunny to jump an object we do not
know how high the object is, but we can use a function “height” to find out.
(Do not move the bunny’s legs for this question.)
myFirstMethod
Do in order
You might want to try out your storyboard in ALICE to check it over.
Page 16 of 25
1c 2b 3d 4b 5a 6c 7a 8b 9d 10c 11a
12
a step by step list of instructions
algorithm
features or characteristics of an object ie the snowwoman’s head is
pink
property
the time in seconds that an instruction is performed
duration
a list of actions to perform a task
method or procedure
asking a question to produce a result
function
A single “thing” in a virtual world. It has been made according to
plan (or class)
object
error in a program
bug
a single line of code
instruction
a set of instructions written in a programming language
code / computer program
A 3-D environment that can contain objects. These objects can
virtual world
One after another
sequentially
Taking place at the same time as another thing
simulataneous
The scene which is to be created and the general purpose of the
program
senario
Change your storyboard into program code
implement
A pictorial representation of a plan for a program or a movie
storyboard
The program is efficient and clear
elegant
A pictorial plan of action which uses standard diagram shapes for
different action. flowchart
A measure of how visible or invisible an object is opacity
A statement that is included in a program which explains the
program and gives credit to the author. Comment
Page 17 of 25
The time when the program is executing or running.
Runtime
When one block of code is completely inside another nested
Write a line of code – test it – amend it if necessary test again trial
and error
These are programming blocks which direct the flow of execution of
the program. E..g do together control structures
A “basket” or place holder for a value which is passed to a procedure
e.g. WhichToy parameter
The actual value that is passed to a procedure. whichToy = bunny.
Bunny is tha actual value which is passed. Argument
An instance of a class which is placed in a world.
object
A gallery item
class
A characteristic of an object
property
13
A program has a bug when the pop-up menu signals that you have a bug, or when the
program does not do what you, the programmer, think it should do.
14.
Comments give credit to the programmer. They explain the general purpose of the
program and they explain different sections of the code for future reference.
15.a) If/else is a decision
do in order is sequence
loop is repetition
b)
1.do together
2. Do in order
3. Count
16.
First the fish swims in a circle in front of the island
Then the fish swims around the outside of the island.
17.
alien jumps up and down twice
18.
In the method jump the programmer forgot to replace this.alien with the parameter
whichBiped.
19.
If you make the horse the vehicle of the rider, then the rider will move and the horse
If you make the rider the vehicle of the horse, then the horse will move and the rider
will folloemw along.
In all cases the movement of the horse and the rider are SYNCHRONIZED.
20. opacity
Page 18 of 25
21.
The clownFish circles around the pajamaFish and then the pajamaFish circles around
the clownFish.
22.
a)
alien thinks “Cool Cave!”
b)
Alice thinks “Cool Cave!”
c)
alien thinks “Cool Cave!”
23.
The witch moves 1 m at a time towards the cauldron,. When she reaches the cauldron,
he just stays close until the count loop is finished counting to 20.
24.
Notice how I have indented!!!!!
myFirstMethod
Do in order
bunny turns to face the bowling pin
bunny moves forward distance to bowling pin – 3
do together
bunny moves forward 3
bunny moves up height of bowling pin + .5
do together
bunny moves forward 3
bunny moves down height of bowling pin + .5
NOW, Practice writing storyboards for some of the programs you have already completed in
class.
Page 19 of 25
WEB PAGE REVIEW - LOOK OVER YOUR NOTES YOU MADE FROM COMPLETING THE ONLINE
COURSES.
&lt;html&gt;
&lt;title&gt; yourname web page review&lt;/title&gt;
&lt;body&gt;
1.
Show the tags in the body of the web page above, which will:
 type your name in the top of the body of the web page. Bold it and center it.
 change the background color to yellow;
 add a simple table of 2 rows and 3 columns.
Change each cell of the table to have the font colour the same as the name of the
colour.
e.g.
Red
Green
Blue
Orange
Pink
White (change the
background so that you
can see the text)
Page 20 of 25
2.
The student has made an html page using the codes
Circle 5 errors
&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot;&gt;
&lt;!
Author: Ms Zhang and Ms Burnham
Purpose: HTML Lab 2:
Date: September 22
--&gt;
&lt;title&gt;Computer History/Inventions&lt;/title&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;font size=&quot;16&quot;&gt;
&lt;b&gt;Computer History/Inventions&lt;/b&gt;
&lt;/font&gt;
&lt;hR&gt;
&lt;img src=&quot;invention_eggbed.jpg&quot; size=&quot;250&quot; alt=&quot;egg_bed&quot;&gt; &lt;br&gt;
&lt;a href=&quot;http://internet-browser-review.toptenreviews.com&gt;Internet Browser
Review&lt;/a&gt;
&lt;/div&gt;
&lt;/body&gt;
3.
A student has made the following code to show an image, but all that shows on her
browser is a broken link. What could possibly be the error? List three possibilities.
&lt;img src=”pic.bmp”&gt;
4.
A student makes all the code for a webpage change, but when she views the page,
nothing seems changed. What is the likely reason?
5.
Why did we use CSS for our web pages?
Page 21 of 25
&lt;html&gt;
&lt;title&gt; yourname web page review&lt;/title&gt;
&lt;body bgcolor=”yellow”&gt;
&lt;div align=”center”&gt;
&lt;b&gt;
Ms Burnham or Ms Zhang
&lt;/b&gt;
&lt;/div&gt;
&lt;a href=”http://www.scs.on.ca”&gt;St. Clement’s School&lt;/a&gt;&lt;br&gt;
&lt;table bgcolor=”000000” border=”1”&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;font color=”red”&gt;
Red
&lt;/font&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;font color=”green”&gt;
Green
&lt;/font&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;font color=”blue”&gt;
Blue
&lt;/font&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;font color=”orange”&gt;
Orange
&lt;/font&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;font color=”pink”&gt;
Pink
&lt;/font&gt;
&lt;/td&gt;
&lt;td bgcolor=”FFFFFF”&gt;
&lt;font color=”000000”&gt;
White
&lt;/font&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/body&gt;
Page 22 of 25
&lt;/html&gt;
Page 23 of 25
1.
2.
The student has made an html page using the codes
I have highlighted the errors
&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot;&gt;
&lt;!
Author: Ms Zhang and Ms Burnham
Purpose: HTML Lab 2:
Date: September 22
--&gt;
&lt;title&gt;Computer History/Inventions&lt;/title&gt;
be body
&lt;div align=&quot;center&quot;&gt;
&lt;font size=&quot;16&quot;&gt;
&lt;b&gt;Computer History/Inventions&lt;/b&gt;
&lt;/font&gt;
&lt;hR&gt; should be &lt;hr&gt;
&lt;img src=&quot;invention_eggbed.jpg&quot; size=&quot;250&quot; alt=&quot;egg_bed&quot;&gt; &lt;br&gt;
&lt;a href=&quot;http://internet-browser-review.toptenreviews.com&gt;Internet Browser
Review&lt;/a&gt; missing “ mark
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt; missing
3.
A student has made the following code to show an image, but all that shows on her
Page 24 of 25
browser is a broken link. What could possibly be the error? List three possibilities.
&lt;img src=”pic.bmp”&gt;
The image might be spelled differently e.g. pic.jpg
The picture may not be saved in the same folder as the html file.
The picture may not be in a format that can be viewed on a webpage.
4.
A student makes all the code for a webpage change, but when she views the page,
nothing seems changed. What is the likely reason?
The student may have saved her html file as a txt file by mistake.
The student may not have saved the file in the correct folder so she may be changing the
html file in one folder and viewing a similar file form another folder location.
5.
Why did we use CSS for our web pages?
We used CSS so we could easily change the formatting of multiple pages and portions of
pages.
The following is a summary of good design using web pages
The website is interesting to read and holds the visitor's attention. Writing
is simple, clear, direct, and in an active voice. Paragraphs are well structured
and there is a logical flow from one paragraph to the next, and from one page
to the next.
Images and other graphical elements make a valuable contribution to the
appearance, are used consistently on most pages, and contribute to the
overall flow of the information.
The pages show an exceptional attention to the visual elements (contrast,
consistency, simplicity, style). The page loads quickly.
The website is clear and easy to navigate.
Page 25 of 25
```