TERM 1 | Practical | Chapter 4 Flashcards

1
Q

What is the difference between DIV and MOD?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the result?

9 MOD 5

A

4

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

When we evaluate basic mathematical operators in mathematical expressions,
they need to be evaluated using the ____rule

A

BODMAS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Operators with the same importance are executed from___to___, in the order in which they appear.

A

Left

Right

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Evaluate the expression below:

2 + 3 *26 / (16 – 3) – 5

A

= 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)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a trace table?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What do you need to create a trace table

A

● 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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is an IPO Table?

A

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,

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q
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.
A

FloatToStrF

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does Precision refers to?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is a format and give 2 examples

A

Format indicates how a Value will be formatted into a string. The formats that we will use this
year are:

ffCurrency
ffFixed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What would be the value of this number?
rVal:=452.769;
lblOut.Caption:=FloatToStrF(rVal,ffFixed,8,1);

A

452.8

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What would be the output of this function

rSquare := Sqr(4); //

A

rSquare = 16

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

what does the SQRT FUNCTION calculate?

A

The SQRT function calculates the square root of a number.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What does the Round function calculate

A

The ROUND function is used to round a real number to the nearest integer
number.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What does the TRUNC FUNCTION calculate

A

The TRUNC function truncates (removes or ‘chops off’) the decimal part of a real
number. It returns an integer after the truncation.

17
Q

What does the Random function calculate?

A

The RANDOM function is used to generate random numbers.

18
Q

If a variable needs to be accessed from more than one event handler, it must be
declared outside of the event handlers in the___section at the top of the
program. We say that these variables have global scope.

A

VAR