Lessons 12–13 · 2 lessons · M. R. Fayziyeva, D. M. Sayfurov, N. S. Xaytullayeva. Informatics and Information Technologies, Grade 9. “Nashriyot uyi Tasvir”, Tashkent, 2020
12
Test: logic and algorithms
Textbook: p. 35
GoalReviews the topics of Chapters I–III (logical operations, truth tables, circuits, models, algorithm properties, flowcharts) and solves test-style tasks.
New words
logical expression: statements joined by logical operations and brackets · mantiqiy ifodatruth table: a table of an expression’s values for all variable combinations · rostlik jadvalialgorithm properties: discreteness, definiteness, clarity, generality, finiteness of result · algoritm xossalariscale: the ratio between a length on a map and the real length · masshtab
Explanation
Before the test recall the main rules. Order of logical operations: ¬, ∧, ∨, =>, <=>; brackets first. The implication A => B is false only for A = 1, B = 0; the equivalence is true for equal values. The table of an expression with n variables and k operations has n + k columns and 2ⁿ rows, with the values in binary increasing order. A logic circuit is a chain of AND, OR, NOT elements matching the expression. Models are classified by field of use, time factor and form of presentation. An algorithm has five properties and can be presented in words, formulas, a table, a flowchart or a program. While solving a task, first find out what is asked, write the order of operations and check the answer.
Worked examples
A = “A mouse is an input device” (1), B = “1 KB = 100 bytes” (0), C = “2 + 2 = 4” (1). A ∧ ¬B ∨ C: ¬B = 1; A ∧ 1 = 1; 1 ∨ 1 = 1. ¬A ∨ B => C: ¬A ∨ B = 0 ∨ 0 = 0; 0 => 1 = 1.
(A ∨ B) => ¬A: n = 2, k = 3, so 5 columns and 4 rows. For (A,B) = 00: 0 => 1 = 1; 01: 1 => 1 = 1; 10: 1 => 0 = 0; 11: 1 => 0 = 0. Last column: 1, 1, 0, 0 – the same as the column of ¬A.
Class activity
“Test contest”: the class splits into two teams; they take turns setting a task from a chapter and the opponents solve it in 1 minute. The team with more correct answers wins.
Practice
1
Find the value of X ∨ Y ∧ ¬Z for X = 0, Y = 1, Z = 1.
¬Z = 0; Y ∧ 0 = 0; 0 ∨ 0 = 0. Answer: 0.
2
In how many of the 8 combinations (A,B,C) is (A ∧ B) ∨ ¬C true?
5
3
Which property does the instruction “save the file in the right place” break?
Definiteness: it does not say which folder or under what name.
4
The map scale is 1 : 200 000. How many km is 3 cm on the map in reality?