☰ Contents · Computing

The Memo object and a test

Lessons 57–58 · 2 lessons · N. I. Taylaqov (general editor), A. B. Akhmedov, M. D. Pardayeva, A. A. Abdug‘aniyev, U. M. Mirsanov. Informatics and Information Technologies, Grade 10, 1st edition. “Extremum-Press”, Tashkent, 2017
58

Test work

Textbook: pp. 131–132
GoalCompletes a test variant on lessons 51–57 of the Delphi chapter: CheckBox, RadioGroup, ListBox, ComboBox, SpinEdit and Memo.
New words
choosing the object: deciding which control suits the task · obyektni tanlashcode analysis: reading code and predicting its result · kod tahlilitest data: input values chosen to check the program · sinov ma’lumotiexpected result: the answer calculated before running · kutilgan natija
Explanation

In this test the most important skill is choosing the object that suits the task: a CheckBox if several options may be ticked, a RadioGroup for exactly one option, a ComboBox for a compact list, a ListBox for a long list, a SpinEdit for a whole number, a Memo for a multi-line result. Then use the properties (Items, ItemIndex, Checked, Value, Lines) and the methods (Add, Delete, Clear, Count) correctly. In code analysis calculate the number of lines or the sum step by step. When building an application first calculate the expected result with test data, then compare with F9: if there is a difference, first check that indexes start at 0 and check the loop limits.

Worked examples
Sample: 1) Show the first 6 multiples of 9 in a Memo: for i := 1 to 6 do Memo1.Lines.Add(IntToStr(9 * i)); The lines are 9, 18, 27, 36, 45, 54: Count = 6 and the sum is 9+18+27+36+45+54 = 189.
2) A list: Items = Olma, Nok, Uzum, Anor, Behi; if ItemIndex = 3 the chosen item is Anor. 3) A score taken from a ComboBox is 4 and a SpinEdit holds 3 subjects: 4·3 = 12. 4) Which object: “several favourite colours” – CheckBox; “one of the age groups” – RadioGroup.
Class activity

“Find the object”: a group writes 10 tasks (for example choice, list, number, text); another group finds the matching object for each and writes the reason in one sentence.

Practice
1
Items = Olma, Nok, Uzum, Anor, Behi; if ItemIndex = 4, which item is chosen?
2
After for i := 1 to 5 do Memo1.Lines.Add(IntToStr(i * i)); how many lines are there?
3
What is the sum of the numbers on these lines (1, 4, 9, 16, 25)?
4
Why is a RadioGroup better than CheckBoxes for “choose one subject”?