You are on page 1of 3

5 TEACHER’S RESOURCE

Chapter 5 KTurtle Loops and Learns!

OBJECTIVE TYPE QUESTIONS

1. a. ii. break b. ii. exit c. iv. if d. iii. repeat e. i. and

DESCRIPTIVE TYPE QUESTIONS


1. a. The for command, also called the counting loop, is the command that keeps the count for the loop. After
every loop, the number is increased by 1 by default. In case the step size is given, the loop increases or
decreases by the specified number. Yes, a variable can be used instead of a number.
b. Loops are used in programming when we want the computer to run a set of commands repeatedly till
a certain condition is met. This is effective, especially when we want to listen to something repeatedly
or watch something many times.
c. The advantage of using Boolean values is that they show whether the given values are true or false.
The system checks whether the relationship of a statement to the truth is Yes or No.
d. Let us suppose the variables contain numbers: $a = 6 and $b = 8. Look at the table for a better
understanding of the use of comparing operators.

Operators Result
$a == $b False
$a != $b True
$a > $b False
$a < $b True
$a >= $b False
$a <= $b True
e. The REPEAT loop is repeated as many times as the given number whereas the WHILE loop is repeated
till the Boolean value is true. Once the Boolean value becomes false, the execution of the program
stops.
f. I will use the Exit command when I want to finish executing the program, as opposed to the Break
command which will only go on to stop the current loop and transfer control to the statement
following the loop.
g A sample command is given below.
learn box $x {
repeat 36 {
forward $x
turnleft 10 } }
For example,
$a = ask (“Enter your age”)
if $a >= 18 {
message “You are eligible to vote”
}
else {
message “You are not eligible to vote”
}

1
TEACHER’S RESOURCE 5

APPLICATION-BASED QUESTIONS

iii. The turtle moves to the top-left corner of the canvas.


b. i. 7 times
ii. reset
for $a = 5 to 35 step 5{
repeat 36 { fw $a tr 10 }}

iii.

c. i. ii. iii.

IN THE LAB
1. reset
$a = ask ( “Enter a number” )
if $a < 5 {message “The number is less than 5”}
if $a > 5 {message “The number is greater than 5”}
if $a == 5 {message “The number is equal to 5”}
exit

1
5 TEACHER’S RESOURCE

exit
2. a. reset b. reset
$a = 1 for $a = 1 to 10 step 2{
while $a <= 10 { print $a
print $a forward 10 }
forward 10
$a = $a + 2 }

3. a. reset b. reset
$a = ask (“Enter a number”) $a = ask (“Enter a number”)
$i = 1 for $i = 1 to 10 {
print $a * $i
forward 10 }
forward 10
$i = $i + 1
}
4. Create a command square using the learn command :
learn square $length {
repeat 4 { fw $length tr 90 }
}
a. Drawing a square of size 50 points: square 50
b. Drawing a square of side 90 points: square 90

GROUP PROJECT
Ask the children to make different shapes with KTurtle. They can combine the shapes to make a new school
logo.
Triangle (3 sides): repeat 3{fw 100 tr 120}
Square (4 sides): repeat 4{fw 100 tr 90}
Pentagon (5 sides): repeat 5{fw 100 tr 72}
Hexagon (6 sides): repeat 6{fw 100 tr 60}
Septagon (7 sides): repeat 7{fw 80 tr 51}
Octagon (8 sides): repeat 8{fw 70 tr 45}
A full circle is drawn with 360 degrees and a semicircle with 180 degrees.
A circle can be drawn using the repeat command, i.e. repeat 360 times.

You might also like