computer science teacher
MBOU Secondary School No. 76, Ulyanovsk
Lesson form: problem solving.
Objectives:
- consolidate knowledge of command systems and constructions of executing algorithms;
- form an operational style of thinking.
Tasks:
Educational:
- systematization of students' knowledge on the topic: "Algorithmization and fundamentals of programming in the Pascal environment".
Developmental:
- development of cognitive interest, memory, attention;
- teach a rational way to build an algorithm;
- develop logical thinking.
Educational:
- nurturing a purposeful, competitive personality for students;
- fostering a respectful attitude towards your work and the work of others.
Knowledge and skill requirements:
Students should know:
- what is called interpretation;
- difference between mod and div operators.
Students should be able to:
- Determine variable values after passing the flowchart;
- Determine variable values after passing a fragment of an algorithm written in Pascal;
- work with the program's team executor.
Software-didactic:
- video projector;
- laptop;
- cards with a task.
Lesson plan
1. Organizational moment.
2 Mainstreaming Knowledge on: "Algorithmization and Fundamentals of Programming in the Pascal Environment".
3, Study of new material.
4, Securing the studied.
5, Summing up the lesson.
6, Homework.
Lesson progress
1. Organizational moment.
2, Mainstreaming Knowledge on Algorithmization and Fundamentals of Programming in the Turbo Pascal Environment
Front poll
U. Guys! you and I have already started to study the topic: "Algorithmization and programming basics" and now we will remember it a little.
1 - What is the name of a clear, executable-understandable series of commands that allows the task to be performed.
(Algorithm)
2 - What is the name of an algorithm whose actions are performed strictly in order?
(Linear algorithm)
3 - What is the name of an algorithm where actions are performed depending on the fulfillment or non-fulfillment of some condition?
(Branching algorithm or branching)
4 - What is the name of an algorithm that is performed multiple times?
(Cyclic algorithm or loop)
5 - What is the name of a set of instructions for a computer aimed at solving a specific problem?
(Computer program)
6. What is the name of the set of quantities combined by the set of permissible operations?
(Data type)
7 - What is the name of a programming language sentence that specifies a complete description of some action to be performed?
(Operator)
8, How can we run the program we wrote in the TR environment?
(using the RanàRan command menu or the CTRL+F9 key combination)
9 Name the basic forms of representation of the algorithm
(Word, table, graphic (flow chart))
10, Name the properties of the algorithm
- discreteness (execution of the algorithm is divided into a sequence of completed steps);
- determinism (the way to solve a problem is uniquely defined in the form of a sequence of steps);
- clarity (the algorithm should not contain instructions, the meaning of which may be perceived ambiguously);
- performance (if the algorithm commands are executed accurately, the process must stop in a finite number of steps, and the task question must be answered);
- mass (the algorithm works correctly on some set of source data, which is called the applicability region of the algorithm).
11 - What does the T.P. language alphabet consist of?
(letters of the Latin alphabet, characters numbers from 0 to 9, symbols)
12 - Name the basic programming elements
(input, data, operations, output, conditional execution, subroutines)
Working in pairs
U. Well done! Now let's look at the table with you:
Implementation of the algorithm flowchart elements in Pascal.
Your task is to add empty table cells to the desired operators, schemes or actions.
Block element implementation - algorithm schemes in Pascal language. (see appendices for table)
Answer.
Block element implementation - algorithm schemes in Pascal language. (see appendices for table)
U. And now the group that first filled the table on the card correctly will fill it out on the board, and you guys will check your tables.
U. Which of the descriptions listed below can be considered as algorithms and why?
- The procedure for safely crossing the roadway at an unregulated pedestrian crossing.
- Traffic rules in general.
- Method for converting decimal numbers to another number system.
- Proof of Pythagorean theorem.
- Spelling rule for combinations -zhi- and -shi- in Russian.
- Rubik's Cube Puzzle Solving Method
- Catalogue of items on sale in the shop.
- Instructions for unpacking, installing, connecting and setting up a TV.
(1, 3, 6, 8)
3, Study of new material.
U. Now open the notebooks, write down the number, cool work and the topic of our lesson
"Solving Algorithmic Problems - Program Fragment Execution"
U. Let's solve an example with you.
Example 1 Determine the value of an integer variable x after executing the following program fragment:
U. There is a loop in the flowchart, i.e. the same commands are repeated many times In order not to make a mistake when executing the flowchart, it is convenient to create a table in which the values of the variables and the results of checking the condition at each step are entered. Sign <> - denotes unequal.
A. Each single execution of a loop body is called an interposition.
So, the variable x after executing this program fragment took the value 5.
Answer: 5
U. Guys, think about what algorithm does this flowchart fit?
This flowchart corresponds to the well-known Euclid algorithm for finding the GCD of two numbers. Therefore, the answer can be obtained without formal execution of the algorithm, using, for example, the following chain of conclusions: 55 is divided by 5 (based on divisibility by 5); 55=5*11; 75 is aimed at 11 is not divided, but is also divided by 5, therefore the GCD of numbers 55 and 75 is 5.
If it is not easy to understand from the appearance of the flowchart which algorithm it implements, then to solve such problems you should use a general method - step-by-step execution of the flowchart with filling out the table.
Working in groups
The children form groups and the teacher gives out task cards.
Card 1 Determine the value of the variable s after executing a fragment of the algorithm:
Card 2: Determine the value of variable a after executing a fragment of the algorithm:
Card 3 Determine the value of variable B after executing the next fragment of the algorithm.
Card 4 Determine the value of variable A after executing the following algorithm:
Card 5: Determine the value of the variable s after executing the next fragment of the algorithm:
U. Let's solve the following examples. But first, let's write that mod - standard operation calculating the remainder of division targets the first argument to the second, and div - standard operation calculating the result of division targets the first argument to the second.
Example 2: Determine the value of integer variables after executing a program fragment:
Solution. We will compile and fill out a table
Answer: x=2, y=5, t=5
Working in groups
Card 1: Determine the value of integer variables after executing a program snippet:
a:=42;
b:=14;
a:=a div b;
b:=a*b;
a:=b div a;
Card 2: Determine the value of integer variables after executing a program fragment:
a:=2468;
b:=(a mod 1000)*10;
a:=a div 1000+b;
Card 3: Determine the value of integer variables after executing a program fragment:
x:=4;
y:=16;
t:=x;
x:=y mod x;
y:=t+1;
Card 4: Determine the value of integer variables after executing a program fragment:
a:=37;
b:=a mod 10;
c:=a div 10;
Card 5: Determine the value of integer variables after executing a program fragment:
a:=20;
b:=7;
a:=a div b;
b:=a*b;
a:=b div a;
U. Well done! you all got the job done. Now let's remember with you how the team performer works and solve the following examples.
Example 3 - What will Snail draw by executing the following program?
PROGRAM
translate to point (2,0)
translate to point (2,-4)
translate to point (-2,-4)
move to point (-2.0)
translate to point (0.0)
raise your pen
translate to point (1,-1)
put down your pen
translate to point (1,-3)
translate to point (-1,-3)
translate to point (-1,-1)
translate to point (1,-1)
raise your pen
move to point (-2.0)
put down your pen
translate to point (0,2)
translate to point (2,0)
END
Example 4 A chain of three beads is formed according to the following rule:
In first place in the chain is one of beads A, B, B. In second place is one of beads B, B, D. In third place is one of beads A, B, D not standing in the chain in first or second place Which of the following chains is created according to this rule:
1) AGB 2)VAG 3)BGG 4)BBG
Solution.
In first place in the chain is one of the beads A, B, B.
Once the second condition is met, the options remain:
AB, AB, AG,
BB, BV, BG,
WB, VV, VG
In the third step, the chains are added:
ABV, ABG, AVG, AGV,
BBA, BBV, BBG, BVA, BVG, BGA, BGV,
VBA, VBG, VVA, VVG, VGA
Total 16 chains, of the four proposed, only BBG is suitable
5, Summing up the lesson
The teacher evaluates the work of the class and names the students who distinguished themselves in the lesson.
6 Homework
Repeat topic: "Algorithmization and programming basics in the Turbo Pascal environment", solve problems:
1. The Turtle performer moves around on the screen, leaving a line-like mark. At any given moment, the performer's position and direction of movement are known. The performer has two commands:
Forward n, where n is an integer that causes the turtle to move n steps in the direction of movement.
To the right m, where m is an integer that causes a change in direction of movement by m degrees clockwise.
The record Repeat 4 [Team1 Command2] means that the sequence of commands in parentheses will be repeated 4 times.
The turtle was given the following algorithm to execute:
Repeat 4 [Forward 10 Right 120].
What figure will appear on the screen?
2. Determine the value of integer variables a and b after executing a program fragment:
a:= 1819;
b:= (a div 100)*10+9;
a:= (10*b -a) mod 100;
3 Determine the value of the variable a after executing a fragment of the algorithm.



The presentation contains 14 slides.
The archive contains a lesson summary with illustrations and tables (doc) and a presentation (ppt), with a volume of 252 Kb