AdvertisementYour brand could be hereYour brand hereOn every Darslab page · students, parents and teachersinfo@darslab.comAsk for pricesPricesinfo@darslab.com
☰ Contents · Computing

Changing the data type and a test

Lessons 49–50 · 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
50

Test work

Textbook: p. 110
GoalCompletes a test variant on lessons 43–49 of the Delphi chapter: Label, Visible/Enabled, Edit and changing types.
New words
test: a checking work on a finished topic · nazoratcode analysis: reading code and predicting its result · kod tahliliapplication design: planning objects, properties and events · ilova yaratishchecking: comparing the result with a hand calculation · tekshirish
Explanation

The test contains three kinds of tasks: a theory question (for example about the properties of Label, Edit and Button), code analysis (working out what result a given procedure gives) and creating a new application. In code analysis write the values of the variables step by step in a table: this prevents mistakes. When creating a new application plan first what will be on the window (how many Labels, Edits, Buttons), then their properties, then the button procedure. Where text and numbers are mixed, check whether StrToInt, IntToStr, StrToFloat or FloatToStr is needed. Test the application with F9 and also see how it behaves with at least one wrong entry.

💡 Where will I use this?
In real life

In a volleyball game the scorer writes the score on paper after every rally. If the final score does not match, the scorer looks back through the sheet and finds the step where the mistake happened. With program code it is the same: writing the variable values step by step reveals the mistake.

Who uses it

Programmers, accountants and game referees note down the result of each step and search for mistakes that way.

Try it today

In your next game (draughts, cards or any other) write the score on paper after every round and re-check one step at the end.

Worked examples
Pascal
1var s, i: Integer;
2begin
3  s := 0;
4  for i := 1 to 4 do
5    s := s + i * 2;
6  Label1.Caption := IntToStr(s);
7end;
Code analysis – code above. Steps: i = 1: s = 2; i = 2: s = 6; i = 3: s = 12; i = 4: s = 20. The Label shows 20.
Creating an application: “Triangle perimeter”. Three Edits (a, b, c), one button, one Label. The button procedure: Label1.Caption := 'P = ' + IntToStr(StrToInt(Edit1.Text) + StrToInt(Edit2.Text) + StrToInt(Edit3.Text)); with 3, 4, 5 it gives P = 12.
Class activity

“Reading code”: a pair writes a short procedure for each other; the second finds the result with a table and checks it in the application.

Practice
1
After s := 0; for i := 1 to 3 do s := s + i * 3; what is s?
2
If a = 6, b = 8, c = 10, what is the perimeter of the triangle?
3
What is used to convert the number in an Edit to an integer?
4
Why is it useful to write the variable values in a table in code analysis?
Story of the Week · The Khwarizmi WayFree energy from an old radio?Close the week: all of this week’s subjects in one storyRead →