SA SA SA SA2 2 2 2 Programming Programming Programming Programming
SA SA SA SA2 2 2 2 Programming Programming Programming Programming
SA2 PROGRAMMING
REVISION MANUAL ANSWER SCHEME
1
MUF0051 ICT UNIT 1 REVISION MANUAL SA2 – SCRATCH PROGRAMMING
2
MUF0051 ICT UNIT 1 REVISION MANUAL SA2 – SCRATCH PROGRAMMING
10. The application must contain a timer and three levels' will appear in which stage?
a. Development
b. Design
c. Evaluation
d. Requirements
3
MUF0051 ICT UNIT 1 REVISION MANUAL SA2 – SCRATCH PROGRAMMING
16. The programming construct ITERATION such as the Forever block in Scratch refers to:
a. performing an action if a certain condition is true
b. comparing the values in two variables
c. branching from one part of a program to another
d. repeating a sequence of instructions
17. An advantage of a custom block is:
a. it creates more work.
b. it makes programming harder.
c. it can condense a number of blocks into one block.
d. it takes longer to code the application.
18. A variable’s data type
a. changes as the program executes
b. determines the kind of operations may be performed on the variable
c. determines the type of comment that can be included in the variable’s documentation
d. none of the above
19. The features required in an application are listed in which stage?
a. Debugging and testing
b. Application design
c. Application evaluation
d. Application requirements
20. Storyboards are created in which stage?
a. Design
b. Evaluation
c. Requirements
d. d. Development
21. The programming construct ITERATION refers to:
a. performing an action if a certain condition is true
b. comparing the values in two variables
c. branching from one part of a program to another
d. repeating a sequence of instructions
4
MUF0051 ICT UNIT 1 REVISION MANUAL SA2 – SCRATCH PROGRAMMING
5
MUF0051 ICT UNIT 1 REVISION MANUAL SA2 – SCRATCH PROGRAMMING
28. Why is a syntax error relatively easier to identify compared with a logic error?
a. It is because a syntax error would not affect the functionalities of a program and can often
be ignored
b. It is because a logic error can be recognized by compiler at compilation time while
identifying a syntax error can potentially involve comparing all the possible results
generated by the program against the expected results
c. It is because a syntax error can be recognized by a compiler at compilation time while
identifying a logic error can potentially involve comparing all the possible results generated
by the program against the expected results.
d. None of the above
29. Which programming construct should be used if portions of code need to be selectively executed
or skipped based on certain condition(s)?
a. Sequence construct
b. Branching construct
c. Repetition construct
d. Exception construct
30. In the following pseudocode, what is the value of the variable index at the end of the procedure?
set number1 to 1
set index to 1
repeat until index > 5
set index to index + number1
a. 1
b. 4
c. 5
d. 6
31. Referring to the pseudocode in Question 18, what is the value of the variable number1 at the end
of the procedure?
a. 1
b. 4
c. 5
d. 6
6
MUF0051 ICT UNIT 1 REVISION MANUAL SA2 – SCRATCH PROGRAMMING
7
MUF0051 ICT UNIT 1 REVISION MANUAL SA2 – SCRATCH PROGRAMMING
39. When the following pseudocode is executed with variables Age and NewAge in the Scratch
pseudocode below, what is the result displayed for a user who is 17?
8
MUF0051 ICT UNIT 1 REVISION MANUAL SA2 – SCRATCH PROGRAMMING
9
MUF0051 ICT UNIT 1 REVISION MANUAL SA2 – SCRATCH PROGRAMMING
47. Below is a script from a Scratch application. What type of shape will be drawn after the script is
executed
a. Square
b. Triangle
c. Rectangle
d. Circle
48. ____________ is a software that is used to create a series of instructions that will control the
behaviour of a computer
a. Instructions
b. Programming language
c. System Software
d. Application Software
49. __________________ is a series of connected instructions or blocks
a. Blocks
b. Scripts
c. Functions
d. Iteration
10
MUF0051 ICT UNIT 1 REVISION MANUAL SA2 – SCRATCH PROGRAMMING
50. Below is a script from a Scratch application. What type of shape will be drawn after the script is
executed
a. Square
b. Triangle
c. Rectangle
d. Circle
51. Below is a script from a Scratch application. What type of shape and colour will be drawn after
the script is executed
11
MUF0051 ICT UNIT 1 REVISION MANUAL SA2 – SCRATCH PROGRAMMING
a. Rectangle
b. Red Square
c. Red Rectangle
d. Circle
52. Identify the type of event used in Question 51
a. When this sprite is clicked
b. When flag clicked
c. When I receive move
d. When backdrop switch to Shapes
53. Identify the category of blocks used in the Question 51
a. Events, Motion, Pen
b. Iteration, Sequence, Selection
c. Motion and Pen
d. Events, Motion, Pen, and Control
54. ____________________ is a group of instructions can be combined into single custom block
which save time and effort
a. Functions
b. Scripts
c. Block
d. Stage
55. When the following pseudocode is executed
When green flag is clicked
Set X to 5
Set X to X + 1
Set Y to X + 3
Say Y
The value stored in the variable Y will be
a. 0
b. 5
c. 8
d. 9
12
MUF0051 ICT UNIT 1 REVISION MANUAL SA2 – SCRATCH PROGRAMMING
56. Below is the script from a Scratch Application. What will be the result of the following script if the
number 5 is entered?
a. 5
b. 20
c. 15
d. 10
57. Below is the script from a Scratch Application. What is the value of final value of counter and
results
a. 5 and 15
b. 10 and 5
c. 15 and 5
d. 15and5
13
MUF0051 ICT UNIT 1 REVISION MANUAL SA2 – SCRATCH PROGRAMMING
58. Below is the script from a Scratch Application. What is the value of final value of x and y
a. 31 and 12
b. 31,12
c. 12 and 31
d. None of the above
59. ______________ is a single line of code which instructs CPU to perform task in Scratch, blocks
are used.
a. Internal documentation
b. Instruction
c. Stage
d. Backdrop
14
MUF0051 ICT UNIT 1 REVISION MANUAL SA2 – SCRATCH PROGRAMMING
61. Below is the script from a Scratch Application. What is the value of final value of a and i
a. 7, 5
b. 5 and 7
c. 5,7
d. 7 and 5
15
MUF0051 ICT UNIT 1 REVISION MANUAL SA2 – SCRATCH PROGRAMMING
63. Below is the script from a Scratch Application. What is the value of final value of a
a. 11
b. 21
c. 20
d. 5
16
MUF0051 ICT UNIT 1 REVISION MANUAL SA2 – SCRATCH PROGRAMMING
64. Below is the script from a Scratch Application. What is the value of final value of a
a. 25
b. 20
c. 35
d. 50
17
MUF0051 ICT UNIT 1 REVISION MANUAL SA2 – SCRATCH PROGRAMMING
66. Below is the script from a Scratch Application. What is the value of final value of a
a. 26
b. 21
c. 35
d. 20
67. A single environment where all the development of an application occurs
a. Integrated Development Environment (IDE)
b. Internal Documentation
c. Function
d. Scripts
68. A sprite is an object that can move. A sprite can also be re-sized, unlike a backdrop.
a. True
b. False
18
MUF0051 ICT UNIT 1 REVISION MANUAL SA2 – SCRATCH PROGRAMMING
19
MUF0051 ICT UNIT 1 REVISION MANUAL SA2 – SCRATCH PROGRAMMING
78. Identify the output produced by the application if the test data of 100 was input.
a. Weight
b. Weight out of range.
c. You are a healthy weight.
d. You are a very healthy weight.
79. Which of the following lines of code in the pseudocode contains an operator?
a. Else
b. Input Weight
c. If Weight > 100 Then
d. Print “You are a very healthy weight”
20
MUF0051 ICT UNIT 1 REVISION MANUAL SA2 – SCRATCH PROGRAMMING
21
MUF0051 ICT UNIT 1 REVISION MANUAL SA2 – SCRATCH PROGRAMMING
22
MUF0051 ICT UNIT 1 REVISION MANUAL SA2 – SCRATCH PROGRAMMING
Structured Questions
1. A program is created to accept input and display the Name and YearOfBirth and Gender of
a student. The input into this program should be validated.
For example, Name might be entered as “John Doe”, YearOfBirth might entered as 1998
and Gender might be entered as “M”.
a. What is the importance of validation in programming?
Validation only allows data defined to be input into a program. This is to ensure
accuracy and consistency for any of various kinds of user input in a program.
b. Give an example of how validation can be done in the above program.
Validation can be done on Gender, ie-to only accept “M” or “F” as input OR
Validation can be done on YearOfBirth, ie- to only accept numeric values and no leading
zeros
[2 marks]
2. In Scratch, when the sprite called Cat is clicked, the Cat is made to repeatedly move 5 steps
forward and 5 steps backward 100 times and then say “That’s tiring”.
a. Write the Scratch codes to achieve the above (using iteration).
[5 marks]
When Cat is clicked
Repeat 100 times
Move 5 steps
Move -5 steps
End repeat
Say “That’s tiring”
or
When Cat is clicked
Repeat 100 times
Change x by 5
Change x by -5
End repeat
Say “That’s tiring” and wait
c. Explain how the iteration works.
Iteration (Repeat in the pseudocode) above is used to repeat a sequence of
forward and backward steps 100 times
[2 marks]
3. Determine the value stored in variable x and variable y at the end of the execution of these
scripts.
set x to 4
set y to 2
repeat until y =0
set x to x-1
set y to x-2
Variable x = 2
Variable y = 0
23
MUF0051 ICT UNIT 1 REVISION MANUAL SA2 – SCRATCH PROGRAMMING
[2 marks]
4. Determine the output at the end of the execution of these scripts.
set b to 10
set a to 20
set b to b + a
if a * 4 > b * 2 Then
say b
else
say a
Output = 30
[2 marks]
5. Why are variable types important in programming? Explain your answer with examples to
support your explanation.
Variable types are used to represent different entities or types of input/output values and
what operations can be performed on them.
Text or string variable type could represent people or places (eg-Name, City);
Numeric variable type could represent a numeric value which may be used in calculations
(eg-Radius, Width, Length, Score);
Boolean variable type can be used to represent a logical state of True or False
(eg-HasWonGame, IsFull)
[2 marks]
1. List and briefly describe the Project Stages
Application requirements – programmer will list out what must be included in an
application. This acts as a checklist of things to do.
Application design – programmer will design and plan how the application will function.
This includes the purpose of the application, the assets required, how they function and
a stage storyboard.
Application development – programmer will use a programming language (eg Scratch) to
create (or develop) the application based on the planned design. The application is also
tested and all errors are debugged.
Application evaluation – programmer will create an evaluation report to explain if all of
the application requirements are met and how the requirements were achieved.
[6 marks]
9. Describe the three types of programming errors with examples?
Syntax errors are caused by the code written not conforming to the syntax of the programming
language being used. It can be recognized by compiler at compilation time. Example: If the
programming code is <Repeat until> and the programmer types <Repeat uptil> instead
Logic errors are caused by misuse of logic when coding the program that leads the program to
produce unintended or undesired output or other behaviour.
Example: the expected output should display the area of a circle, but the actual output displays
the circumference of a circle
Run-time errors are those that appear only after you compile and run your code.
These involve code that may appear to be correct in that it has no syntax errors, but
that will not execute.
Example: division by zero
24
MUF0051 ICT UNIT 1 REVISION MANUAL SA2 – SCRATCH PROGRAMMING
[6 marks]
10. Trace the following lines of Scratch codes and fill in the values of the variables in the tables below
when these codes are executed.
1 set z to 3
2 set y to 1
3 set x to 2
4 repeat until x > 15
5 change x by 3
6 set z to x + y
7 set y to z + 2
VARIABLES
Lines executed
x y z
1, 2, 3 2 1 3
4-7
5 8 6
4-7
8 18 16
4-7
11 31 29
4–7
14 47 45
4-7
17 66 64
25
MUF0051 ICT UNIT 1 REVISION MANUAL SA2 – SCRATCH PROGRAMMING
VARIABLES
Lines executed
bob cat x
1, 2, 3 true 10 2
26
MUF0051 ICT UNIT 1 REVISION MANUAL SA2 – SCRATCH PROGRAMMING
15. What are programming languages? Give an example of a low-level programming language and an
example of a high-level programming language.
Programming languages are tools used by programmers to create software/applications/programs.
Example of low-level programming language: Assembly language, machine language
Example of high-level programming language: Scratch, VB.net, Java
[2 marks]
10. How are low-level and high-level programming languages different in terms of complexity and
portability?
Low-level programming languages (such as machine language/assembly language) consists of
codes which are complex and difficult to understand and are less portable (machine
dependent). High-level programming languages (such as Scratch/VB.net) are less complex and
easier to understand as they consist of short English-like statements and are portable (machine
independent)
[2 marks]
11. Explain the difference between non-array variables and lists (arrays). Provide an example of a
programming situation where a list (array) would be appropriate.
A variable (non-array) holds a single data item (eg- Score, Name, Area) whereas a list (array) holds
multiple data items (eg- ListOfPlayers, HighScoreHistory).
A situation where a list (array) would be appropriate is when operations to be performed
include adding, updating and removing items.
[3 marks]
12. List and briefly describe the three core constructs of a computer program
Sequence - The control structure sequence occurs when each instruction (or block) is executed
one after the other, in the order that they appear in the Scripts Area.
Iteration / Repetition / Looping - The control structure repetition executes instructions over and
over again.
Selection / Branching / Decision - The control structure selection allows instructions or blocks
to be executed only if a condition is true.
[3 marks]
13. Outline the purpose of backdrop in Scratch
A backdrop is an image to be added to the stage.
[3 marks]
14. Outline the purpose of sprite in Scratch
A sprite is an object that can move. A sprite can also be re-sized, unlike a backdrop.
[3 marks]
15. Describe TWO differences between backdrop and sprite
Backdrops cannot move
Backdrop cannot be resized
A sprite can be moved and resized
[3 marks]
16. Outline what us the purpose of stage
27
MUF0051 ICT UNIT 1 REVISION MANUAL SA2 – SCRATCH PROGRAMMING
Repeat
All of the instructions within the repeat block will be executed in the order shown, by the
number of times indicated in the repeat block.
Example
When green flag clicked
Repeat 4
Move 10 steps
Turn 90 degrees
Repeat until
Similar to the Repeat block the instructions within a ‘Repeat until’ block will execute over
and over again. But unlike a repeat block, the number of times the instructions are
repeated is based on a condition, not a fixed number.
Example
Set a to 1
Set b to 2
Repeat b > 6
Set a to a + b
Set b to a + b
28
MUF0051 ICT UNIT 1 REVISION MANUAL SA2 – SCRATCH PROGRAMMING
Forever
Blocks within the forever block are executed over and over again as long as the project is
running.
29
MUF0051 ICT UNIT 1 REVISION MANUAL SA2 – SCRATCH PROGRAMMING
Stop All
Else
Stop All
[4 marks]
c. Identify the operators used in the script above. Explain the purpose of the operator
IF Age >21 Then
Operators are blocks that are mainly used to allow mathematical equations to occur within
a project, while some allow text manipulation.
[3 marks]
d. Explain the purpose of variable in programming. Give an example of block that contains a
variable
Variable is a container (or box) that is used to store data. The value stored in the variable can
change as an application is running. You can make a variable in the Data Scripts group.
[3 marks]
e. List the block in your script that contain the variable
Set Name to Answer
[3 marks]
f. List and describe one block that was used to create the conversation in between the Scratch Cat
and User
Ask … and wait
Say Block
Ask .. and wait provide a textbox that allows users to enter a text to be accepted and the Say
block provides a speech bubble that allows text to be displayed that appears to be spoken by
the sprite
30
MUF0051 ICT UNIT 1 REVISION MANUAL SA2 – SCRATCH PROGRAMMING
[3 marks]
You realise that your script contains error
When you enter 22 you realise that the program displays the greeting Hi There <name> and not the
message “You are eligible to vote”
31