The Joy of Computing Using Python: Assignment 1
The Joy of Computing Using Python: Assignment 1
Assignment 1
3. Choose the best command to be used at the start of your code, to locate the sprite at an initial position every
time you play the animation.
(a) change x to val
(b) set x to val / set y to val
(c) point in direction 90
(d) point towards mouse pointer
CORRECT ANSWER: (b)
4. Assume the sprite is a ball and predict the output of the following control structure.
1
5. Pick the snippet that helps the sprite to find the factorial of 5 as output.
Given:
Factorial(n)=1 x 2 x 3 x .. x (n-1) x n
(a)
(b)
(c)
2
(d)
(a) 1, 2, 3, . . , 19
(b) 1, 3, 5, . . , 19
(c) 3, 5, 7, . . , 19
(d) 1, 2, 3, . . , 20
3
7. Consider a road inclined at an angle of 30◦ and we have a car sprite to be driven over this road. Pick the code
that helps to perform the same. Hint: The initial direction of the sprite is 90◦ .
(a)
(b)
4
(c)
(d)
5
9. Pick out the scratch library that provides the functionality to switch backdrop?
(a) Motion
(b) Control
(c) Looks
(d) Sensing
CORRECT ANSWER: (c)
10. Imagine a Magic wand sprite and predict the output for the following set of instructions.
(a) The Magic wand flies to a random position takes 1 sec pause and then reaches another random position.
(b) The Magic wand flies to a random position in 1 sec and after a 0.25 sec pause, it repeats the same until
it is stopped.
(c) The Magic wand reaches all edges of the screen in a uniform pattern
(d) The Magic wand flies between the top and bottom edges repeatedly.