Professional Documents
Culture Documents
Chapter 2 questions:
1. Assignment: number1 = 29
Selection:
If number1 > 30 then
Output = “larger than 30”
End of
Iteration:
For counter = 1 to 50
Output = “Happy birthday”
Next
2. Website HTML code that tells the browser to repeatedly refresh the page until the user
clicks something or an algorithm that tells the computer to repeatedly change the order of
letters until all the different combinations have been formed.
3. A definite iteration is a process that repeats until a set number of times, while an
indefinite iteration is a process that repeats until a specific condition is met.
4. A nested statement is placing a set of instructions within another set of instructions
5. The sequence of programing statements is important because the instructions need to be
carried out in the correct order otherwise the results of the program will be inaccurate or
wrong. An example is outputting the answer before it is calculated.
6. Syntax are the rules of how words are used within a given language, which are important
because they give meaning to the language therefore making it useful and make sense. An
example is declaring a variable first before setting its value; as if you do it the other way
around you will get an error.
Harvey James
3.
4.
Harvey James
Chapter 3 questions:
1. Example of a calculation using the arithmetic operators:
Addition: answer = num1 + num2
Subtraction: answer = num1 – num2
2.
3.
4.
5.
6.