TERM 1 | Practical | Chapter 4 Flashcards
What is the difference between DIV and MOD?
Div Divides the first number by the second, then discards the remainder
Mod Divides the first number by the second, then keeps only the remainder
What is the result?
9 MOD 5
4
When we evaluate basic mathematical operators in mathematical expressions,
they need to be evaluated using the ____rule
BODMAS
Operators with the same importance are executed from___to___, in the order in which they appear.
Left
Right
Evaluate the expression below:
2 + 3 *26 / (16 – 3) – 5
= 2 + 3 * 26 / 13 – 5 (Level 1 – brackets)
= 2 + 78 / 13 – 5 (Level 2 – multiplication)
= 2 + 6 – 5 (Level 2 –division)
= 8 – 5 (Level 3 – addition)
= 3 (Level 3 – subtraction)
What is a trace table?
A trace table is a tool used to track how the value of variables change in a program
after each line of code is executed. This tool is helpful for testing an algorithm
because it helps you to determine if an algorithm gives the correct result.
What do you need to create a trace table
● identify all the variables
● create a table with a column for each line number, a separate column for
each variable, and a column for the output
● follow the code line-by-line and write down the new value of the variable that
changed.
What is an IPO Table?
An Input-Processing-Output (IPO) table is a planning tool that can be used to record your inputs,
processing and output. Usually, before you write a program,
In Delphi, you can format real numbers to display in a speci c format. In this unit we will use the\_\_\_\_\_ function to format real numbers.
FloatToStrF
What does Precision refers to?
Precision refers to the total number of digits a number will display. If the number of digits in the Value
exceeds the total number of digits in the Precision, then the Value is rounded to the total number of
digits as per the Precision
What is a format and give 2 examples
Format indicates how a Value will be formatted into a string. The formats that we will use this
year are:
ffCurrency
ffFixed
What would be the value of this number?
rVal:=452.769;
lblOut.Caption:=FloatToStrF(rVal,ffFixed,8,1);
452.8
What would be the output of this function
rSquare := Sqr(4); //
rSquare = 16
what does the SQRT FUNCTION calculate?
The SQRT function calculates the square root of a number.
What does the Round function calculate
The ROUND function is used to round a real number to the nearest integer
number.