### SOLNS

```CSIS 1
Test 3 Study Guide Chapters 18-21
30 Points
Closed book, but you may bring one sheet of notes. About 20 questions will be
taken from the textbook end of chapter exercises (multiple choice and short answer).
Remember if you need a textbook, there is one on reserve in the library, ask for
Snyder, "Fluency With Information Technology". Check the glossary in the back of
the book, and the answers to selected questions immediately following the glossary.
To prepare, you should review the following questions. Many of the answers can also
be found in the laboratory handouts 4.1 – 4.4 you completed and the powerpoint
slides.
Multiple Choice Questions
Chapter
Chapter
Chapter
Chapter
18: 1,2, 3, 4, 7, 8, 9, 12
19 (we skipped most of this chapter):
20: 1, 3, 7
21: 1, 4, 5, 6, 7, 8
2 – 5 (primarily HTML questions)
Chapter 18: 1, 2, 4, 7, 8, 10, 11, 12, 13, 15
Chapter 19: none apply
Chapter 20: 1, 3, 6, 12
Chapter 21: 1, 2, 3, 4, 5, 7
SKILL – Remaining 10 Points
Be prepared to answer questions similar to the ones appearing below.
Ch18 and Lab 4.1
1) Reading and following instructions expressed in a simple JavaScript program
Ex: after these statements execute, what value is in variables x, y, and z?
x=4; y=5; z=6;
x=y + z + 1;
y= 4 + x / 2;
z= z + 2;
x holds the value 11
y holds the value 9.5 ( 4 + 11/2 ) uses most recent value of x
z holds the value 8
2) Reading and following instructions expressed in a JavaScript if statement. What is
written to the screen after the following statements execute:
temp= 90;
if (temp > 90)
document.write("Too Hot");
if (temp <=90)
document.write("Fine");
Writes the message “Fine” to the screen
Turtle Graphics (Labs 4.2 – 4.4)
3) Drawing a picture from turtle commands given
a)
home(); forward(50);
the picture is a
b)
right(90); forward(50); backward(100);
“T”
home(); left(45); forward(50);
right(90); forward(50);
right(90); forward(50);
4) writing instructions to draw an image given to you (assume you start in center and
image is in center)
forward(50); right(90);
forward(50); left(90);
forward(50);
Ch20 (mostly see Lab 4.3)
5) Following (tracing) a program function call and determining its result
function squiggle( a , b )
squiggle(20,40);
{
squiggle(40,20);
forward(a);
right(90);
forward(b);
left(90);
}
A: The picture drawn is
Ch 21 (mostly see Lab 4.4) Iteration
6) Writing what happens when a loop runs:
for (i = 0; i <5; i = i+1)
{
document.write("i = " + i );
}
for (i = 0; i <4; i++)
{
forward(50); square(10);
backward(50); right(90);
}
i=0
i=1
i=2
i=3
i=4
Technically, said Pat, it looks like this:
i = 0i = 1i = 2i = 3i = 4
– I’ll accept either
Depends on Square Function
(whatever fn you need will be
provided on test)
assume square is:
function square(size)
{
forward(size); right(90);
forward(size); right(90);
forward(size); right(90);
forward(size); right(90);
}
Extra Credit:
using turtle graphics and a for-loop to draw a picture given to you
```