UNIT#4 PROGRAMMING
Q.1: How is information stored on computer?
A: Data is processed and stored in the form of information. Digital devices stored information in
binary arrangements in the form of (O and 1) s. These binary string can makeup images, videos
documents etc.
Q.2: Convert the following decimal numbers to binary numbers:
a) 13
b) 17
c) 21
d) 31
Q.3: Convert the following binary numbers to decimal numbers:
a) 1001
b) 1100
Binary number: 1 1 0 0
Power of 2: 23 22 21 20
(1100)2 = 1x23+1x22+0x21+0x20 = (12)10
c) 1000
Binary number: 1 0 0 0
Power of 2: 23 22 21 20
(1000)2 = 1x23+0x22+0x21+0x20 = (8)10
d) 1010
Binary number: 1 0 1 0
Power of 2: 23 22 21 20
(1010)2 = 1x23+0x22+1x21+0x20 = (10)10
Q.4: What is the difference in visual outcome of Move and Glide commands?
Move Glide
In Scratch, the "move" block allows you to The "glide" block is similar to the "move"
move a sprite a certain distance in the direction block, but instead of immediately moving the
it is facing. sprite to a new
location, it will smoothly transition the sprite
to the new location over a given period of time
Q.5: Differentiate Repeat and forever control commands. Give one example of problem for
each where they can be used.
A: Repeat Control Command
The "repeat" block allows you to repeat a set of instructions a certain number of times. For
example, you might use a "repeat 10" block to repeat a set of instructions 10 times.
Forever Control Command
The "forever" block allows you to repeat a set of instructions indefinitely, until the program is
stopped. Example: use the "forever" block to repeat the instructions.
Q.6: Write down the functions of the following commands if used with any sprite:
It is a Motion block that causes the sprite to move smoothly over a period of 3 seconds to the
current position of the mouse pointer. This block is typically used to make the sprite follow the
mouse pointer around the screen.
It is a Motion block that causes the sprite to move vertically on the screen (i.e., up or down). In
this case, the sprite will move downwards.
Q.7: What will the following two sets of codes do when flag is pressed? If possible try
running these sets of codes on a computer after your answer and compare.
A: This code will cause the sprite to continuously move towards the mouse pointer at a speed of
5 steps per iteration of the loop.
This code will cause the sprite to continuously rotate so that it is facing towards the mouse
pointer.
Q.8: Which of the following can be used to start a set of codes? Tick which are
appropriate.
A:
Q.9: What is the difference between the following two commands from Motion Category.
A: The "change y by 10" command will add 10 to the current value of the variable y. For
example, if the current value of y is 5, after this command is executed, the value of y will be
15.The "set y to 10" command will set the value of the variable y to 10, regardless of its current
value. For example, if the current value of y is 5, after this command is executed, the value of y
will be 10.
Q.10: Label the appropriate areasof the picture below using the given
words:
Stage, Sprite, Programming Area, Blocks Palette, Flag, Sprite Properties