Software Design and Development - Implementation Flashcards
How do you assign a value to a variable?
Assigning a value to a variable e.g. In reference language SET score TO 20 In Livecode put 20 into score
How do you use Arithmetic in a program?
Using arithmetic (+, -, /, *, ^) e.g. In reference language SET total TO total + score In Livecode put total + score itno total
What is concatenation?
Joining two or more strings or substrings
For example in Livecode:
put firstname & “ “ & surname into fullname
Would join first name and surname and include a space between both
In Reference language:
SET fullname TO firstname + “ “ + surname
What selection constrcuts can be used?
< Less than > Greater than ≤ Less than or equal to ≥ Greater than or equal to = Equals ≠ Does not equal
What is an IF statement?
An If statement IS NOT A LOOP. IF statements allow
the program to make decisions. Conditions, such as
score <10 are used within IF statements.
IF score < 10 OR score >50
SEND ‘Try Again’ TO DISPLAY
END IF
This IF statements checks to see if a score is less than 10 or higher than 50
What is a nested IF statement?
Nested IFs are IF statements inside IF statements. The nested parts only run if needed. IF score < 100 THEN SEND “Low Score” to DISPLAY ELSE IF score < 150 THEN SEND “Mid level score” TO DISPLAY ELSE SEND “High score” TO DISPLAY END IF END IF
What are Logical Operators?
Logical operators can be used in
IF statements and conditional loops.
AND – Both conditions must be true
OR – One condition must be true
NOT – The opposite outcome to what would logically apply (negation)
What is a simple condition?
A simple condition has only one condition e.g.
IF firstname = “Betty”
The condition is = “Betty”
What is a complex condition?
A complex condition has two or more conditions e.g.
IF firstname = “Betty” OR firstname = “Trevor”
The two conditions are = “Betty” , = “Trevor”
AND /OR are used as part of complex conditions
What is repetition / iteration?
Repetition and iteration are technical terms for
loops. Repetition repeats a task set number of times. Iteration is the same but usually involves checking
over the contents of an array until you achieve what you want to achieve e.g. find a number or get to the end of the array list
.
What is a fixed loop?
A fixed loop will repeat all code held within the loop a
set number of times only. E.g.
For loop = 0 to 9
<code>
Next loop
The above loop would repeat 10 times</code>
What is a conditional loop?
A conditional loop repeats until a condition is met e.g.
WHILE score < 10
<code>
END WHILE
This loop will repeat the code inside as long as the score variable holds a value that is less than 10</code>
What is the ROUND function?
ROUND is a pre-defined function, meaning the code
to make it work already exists. If you use
the ROUND function, the computer will round a value to a certain number of decimal places:
SET size TO ROUND (measurement, 1)
This takes the value of the measurement variable and rounds it to one decimal place. It then returns this new value to the size variable
What is the RANDOM function?
RANDOM is a pre-defined function, meaning the
code to make it work already exists. If you use the RANDOM function, the computer will generate a random number:
SET bonusBall TO RANDOM(1, 59)
This would generate a random number between
1 and 59 and returns this number to the bonusBall variable.
What is the LENGTH function?
LENGTHis a pre-defined function, meaning the code to
make it work already exists. If you use the LENGTH function, the computer will calculate the number of characters held in a string variable:
SET numberOfCharacters TO LENGTH (firstname)
This would take the value in the first name variable, calculate its length and returnsit to the numberOfCharacters variable. E.g. Jane would return
4