The value of the variable s. A fragment of the algorithm is depicted in the form of a block diagram. Determine what value of the variable S will be printed as a result of executing the algorithm. Assigning a value to a variable

  • 02.02.2024

Algorithmization and programming

2. Absent in procedural programming languages 2) complex

Data type.

When developing a software product, comparing the results of the program with the results of observations or results obtained experimentally refers to the stage

1)debugging and testing the program

4. Designing programs by sequentially breaking a large task into smaller subtasks corresponds to... 3) top-down design

5. The language whose name is an abbreviation for “universal symbolic code for beginners” is 4)Basic

6. The identifier table during the translation process is used to store... 3). variable and function names

7. The concept of "Polymorphism" refers to 3)modular programming technologies

8. The modular structure of the program reflects one of the features 2) dynamic programming.

10. Loading module of the program - the result of work... 4) link editor (linker)

11. The object-oriented approach is based on the concept 3)class hierarchy

12. The first stage of solving a problem on a computer is 1) problem statement

13. Data markup languages ​​are 1)HTML and XML

3)P=False;Q=False

16. The program is 2) an algorithm written in a programming language

Encapsulation in object-oriented programming means being able to

2) determination of the interface (specification) of methods for their implementation

18. Interpreters perform 1)operator-by-statement processing and program execution

The task: “enter two numbers and find their arithmetic mean and geometric mean and give the result” corresponds to an algorithm...

22. Does not apply to basic algorithmic constructions 1) substitution

The object-oriented approach to programming is based on the principle

4). bottom-up design

26. The Lisp language is a language 2)functional

Programming

27. When developing a software product, elimination of shortcomings noticed by the user is carried out at stage 4) maintenance of the software product

The basic principles of structured programming do not include

3) achieving an absolute minimum of characters and lines in the program text

29. Variable attributes in programming languages: a) name b) address c) visible/hidden d) value e) type f) functionality 2). a, b, d, d

1) number of zeros

A fragment of the algorithm is depicted in the form of a block diagram. Determine what value of the variable S will be printed as a result of executing the algorithm.

What value of the variable S will be printed after executing a fragment of the BASIC program?

For N = 1 To 3

Print S 4)6

4) finds the number of characters of the entered number

38. The definition of “suitability of an algorithm for solving a certain class of problems” refers to the property of algorithms, which is called 3) mass character

39. A translator that translates the source program into an equivalent resulting program in machine command language is called 4) Compiler

40. Procedural programming languages ​​do not have 2) complex

Data type.

41. The concept of "Polymorphism" refers to 1)object-oriented programming technologies

Database

4) is key in both tables

1)parametric

3. Relational databases represent dependent data in the form 1) interconnected tables

5. The language for querying relational databases is 1)SQL

6. In a relational database, a field is 4) column in the table

7. Based on the method of accessing databases, DBMSs are divided into 2). client-server

How many records are there in the presented database? 4)4

9. What entries will be found after searching in the Computer text box with the condition “contains a Pentium”?

10. In a relational database, a table field 3) table column

11. In a relational database, all elements of one column in a table 1) have the same type and length

12. Fill in the missing words in the definition: Database management system is 1) a set of software and language tools necessary to create databases, keep them up to date and organize the search for the necessary information in them.

13. Fill in the missing words in the definition: A database is 2) named and structured a collection of data related to a specific subject area.

14. In a relational database table 3)each field has a unique name

15. In what order will the records be located in the database after sorting in ascending order in the Memory field?

16. In a relational database 2) the data is presented in the form of one or more interrelated tables

17. Fill in the missing words in the definition: Field whose value 3)unambiguously identifies the corresponding entry , is called the key field.

18. When entering a condition for a date value in the Access DBMS, the correct entry is 1)>#01.01.55#And<#01.01.75#

19. A database field may contain 2) text, number and other types of data

20. The concept of a transaction corresponds to 1)Last. operations on data, which is considered in the DBMS as a single whole

2) many to many (M:M)

22. A form in Acess can be created based on 2) tables and queries

23. Relationships between tables in the MS Access DBMS are automatically established when using the Wizard 2) substitutions

Global and local networks

1. Network topology with sequential service of nodes is called 4)Ring

2) communication protocol with a remote computer

4. A computer that has 2 network cards and is designed to connect networks is called 1)router

6. The communication line with minimal delay is 2) fiber optic

7. An application for viewing hypertext pages is called 4) Browser

8. An IP address that is assigned automatically when a device connects to the network and is used until the connection session ends is called 4) Dynamic

9. FTP is 3) the name of the network protocol that serves the reception and transmission of files

4) twisted pair

11. The Open Network Interconnection (OSI) model includes 1) seven levels of interaction

1) common bus

13. Applies to browsers 1)Opera

14. The FTP protocol is designed for 1)file transfer

16. The browser is 2)web page viewer

17. Modem is 4) technical device

18. Electronic mail (e-mail) allows you to transfer 3)messages and attached files

19. A modem transmitting information at a speed of 28,800 bps can transmit two pages of text (3,600 bytes) within 3)1 seconds

20. A computer connected to the Internet must have 1)IP address

Accessible and understandable material for studying tasks 9 and 10 of the OGE in Computer Science + tasks for practicing

View document contents

Algorithmic language

alg
beginning
integer s, k
s:= 8
nc for k from 3 to 8
s:= s + 8
kts
output s
con

DIM k, s AS INTEGER
s = 8
FOR k = 3 TO 8
s = s + 8
NEXT k
PRINT s

Var s,k: integer;
Begin
s:= 8;
for k:= 3 to 8 do
s:= s + 8;
writeln(s);
End.

Solution:

As you can see, in the body of the loop there is only one command s:= s + 8. That is, this operation will be performed at each iteration (at each step) of the loop.

In the body of the loop, the value of the variable s increases by 8. Since the loop parameter increases from 3 to 8 in increments of 1, when executing the program, the body of the loop will be executed 6 times (k will be equal to 3, 4, 5, 6, 7, 8) . That is, the variable s increased by 8 * 6 = 48. And since the initial value of the variable s = 8 and after executing the program it will increase by 48, then ultimately the value of the variable s will become equal to 56.

Solving problems of type 10 GIA in computer science

The Dat table stores data on the number of students in classes (Dat is the number of students in the first grade, Dat is the number of students in the second, etc.). Determine what number will be printed as a result of the following program. The program text is provided in three programming languages.

Algorithmic language

celtab Dat

integer k, m

Dat := 20; Dat := 25

Dat := 19; Dat := 25

Dat := 26; Date := 22

Dat := 24; Dat := 28

Dat := 26; Date := 21

Date := 27

m:= 0

for k from 1 to 11

if Dat[k] 22 then

DIM Dat(11) AS INTEGER

DIM k,m AS INTEGER

Dat(1) = 20: Dat(2) = 25

Dat(3) = 19: Dat(4) = 25

Dat(5) = 26: Dat(6) = 22

Dat(7) = 24: Dat(8) = 28

Dat(9) = 26: Dat(10) = 21

Dat(11) = 27

m = 0

FOR k = 1 TO 11

IF Date(k) 22 THEN

m = m + 1

END IF

NEXT k

Var k, m: integer;

Begin

Dat := 20; Dat := 25;

Dat := 19; Dat := 25;

Dat := 26; Dat := 22;

Dat := 24; Dat := 28;

Dat := 26; Dat := 21;

Dat := 27;

m:= 0;

for k:= 1 to 11 do

if Dat[k] 22 then

begin

m:= m + 1

Answer: ___________________________.

Solution:

Note. The Dat array, which is described in Basic, will have 12 elements, since the numbering starts not from the first element, but from zero.

Array Dat

Meaning

In the body of the loop, the condition is checked

So, correct answer 7.

View presentation content
“Solution to tasks 9 and 10 of the OGE in Computer Science”

Solution to the problem

in computer science


Solving problems of type 9 GIA in computer science

Algorithmic language

BASIC

alg beginning integer s, k s:= 8 nc for k from 3 to 8 s:= s + 8 kts output s con

Pascal

DIM k, s AS INTEGER s = 8 FOR k = 3 TO 8 s = s + 8 NEXT k PRINT s

Var s,k: integer; Begin s:= 8; for k:= 3 to 8 do s:= s + 8; writeln(s); End.

Write down the value of the variable s obtained as a result of the following program. The program text is provided in three programming languages.

Answer: ___________________________.


Solution :

  • So, let's look at this algorithm written in different languages.
  • First, it is announced that variables k and s of integer type will be used
  • Next, the variable s is assigned the value 8.
  • After this, a cycle is described, where the variable k acts as a parameter, which changes from 3 to 8 in steps of 1 (that is, it will take sequential values ​​3, 4, 5, 6, 7 and 8).
  • There is only one command in the body of the loop: s:= s + 8. That is, this operation will be performed at each iteration (at each step) of the loop.
  • And at the very end, the value of the variable s is displayed on the screen
  • In the body of the loop, the value of the variable s increases by 8. Since the loop parameter increases from 3 to 8 in increments of 1, when executing the program, the body of the loop will be executed 6 times (k will be equal to 3, 4, 5, 6, 7, 8) . That is, the variable s will increase by 8 * 6 = 48. And since the initial value of the variable s = 8 and after executing the program it will increase by 48, then ultimately the value of the variable s will become equal to 56.

22 THEN m:= 0; m = m + 1 for k:= 1 to 11 do if Dat[k] 22 then m:= m + 1 END IF if Dat[k] 22 then NEXT k begin all m:= m + 1 kc PRINT m end; output m con writeln(m) End. "width="640"

The Dat table stores data on the number of students in classes (Dat the number of students in the first grade, Dat in the second, etc.). Determine what number will be printed as a result of the following program. The program text is provided in three programming languages.

Answer: ___________________________.

Algorithmic language

BASIC

Pascal

DIM Dat(11) AS INTEGER

DIM k,m AS INTEGER

Var k, m: integer;

celtab Dat

Dat: array of integer;

Dat(1) = 20: Dat(2) = 25

integer k, m

Dat(3) = 19: Dat(4) = 25

Dat := 20; Dat := 25

Dat := 19; Dat := 25

Dat(5) = 26: Dat(6) = 22

Dat := 20; Dat := 25;

Dat(7) = 24: Dat(8) = 28

Dat := 26; Date := 22

Dat := 19; Dat := 25;

Dat := 26; Dat := 22;

Dat(9) = 26: Dat(10) = 21

Dat := 24; Dat := 28

Dat(11) = 27

Dat := 24; Dat := 28;

Dat := 26; Date := 21

Date := 27

Dat := 26; Dat := 21;

FOR k = 1 TO 11

Dat := 27;

nc for k from 1 to 11

IF Date(k) 22 THEN

m = m + 1

for k:= 1 to 11 do

if Dat[k] 22 then

m:= m + 1

if Dat[k] 22 then

m:= m + 1

output m

writeln(m)

), then we do not take it into account, since 22 is not more than 22. It could be taken into account if there was an = sign in the comparison. So the correct answer is 7." width="640"

Solution:

  • Let's look at the program step by step. So, at the very beginning, the variables that will be used (variables k and m), as well as the Dat array containing 11 elements (from 1 to 11), are declared.
  • Next comes filling the array. For example, the array element with index 1 is assigned the value 20, the element with index 2 is assigned the value 25, and so on. As a result, the resulting array can be represented as follows:
  • Next, the variable m is assigned the value 0. After which the loop with the parameter k begins, with k changing from 1 to 11 in steps of 1.
  • The value of the array element at index k is compared with the number 22. If the array element is greater than 22, then the variable m is incremented by 1. Otherwise, nothing happens.
  • At the very end of the program, the value of the variable m is displayed on the screen.
  • So, we have translated the program into human language, now let's think about what we will ultimately get after its execution. We are interested in the cycle - this is where the value of the variable m changes. Before the loop, its value is zero. Next, the program iterates through all the elements of the array and compares them with the number 22. And if the array element is greater than 22, then the variable m is increased by 1. Thus, we need to count all the elements of the array that are greater than 22 - their number will be equal to the value of the variable m. There are 7 such elements - these are elements with indices 2, 4, 5, 7, 8, 9 and 11.
  • You should pay attention to element number 6, which is equal to 22. Since our comparison is strict (sign), we do not take it into account, since 22 is not more than 22. It could be taken into account if the comparison were sign =.

So the correct answer is 7.

| Test

Lesson 38
Test

"Algorithmization and programming"

Attention! The test contains questions and code elements from Pascal!


First option

Part 1.

1. What does an assignment sign look like in programming?:

  1. <=

2. What is the name of an algorithmic design that consists of sequential actions that follow each other in a strictly ordered order?

  1. Following
  2. Branching
  3. Repetition

3. What algorithm is shown in the picture?:

  1. Following
  2. Branching
  3. Repetition

4. Select the correct program entry :

  1. program Yakov_petrovich;
  2. program Yakov petrovich;
  3. program Yakov Petrovich;
  4. program_Yakov_Petrovich;

5. Which command can be used to find out the remainder of division of a number? aonb:

Part 2.


1. Write down the value of the variable b

a:=4;

x:=10;

a:= x-a*2;

x:=a*2-x;

2. What will happen as a result of executing this algorithm? Write down your answer :

a:=5;

b:=7;

if a>b then b:= a+b-28

elseb:= a* b-30;

3. What will happen as a result of executing this algorithm? Write down the value you get for variable b

a:=7;

b:=22;

a:= b div a;

b:= b mod a;

4. What value of b will be obtained after executing the algorithm? Write down the answer. (If you need to round your answer, round to the nearest tenth)

a:=3;

b:=90;

for i:=1 to 4 do

b:=b/a;

  1. program cup_of_tea;
  2. var a, b, c, y , x: real;
  3. begin
  4. writeln('Please enter three numbers');
  5. readln(a,b,c);
  6. y:=a;
  7. if b>y then y:=b;
  8. if c>y then y:=c;
  9. if ab) or (a>c) then x:=a;
  10. if ba) or (b>c) then x:=b;
  11. if ca) or (c>b) then x:=c;
  12. writeln(y+x);
  13. end.
  1. What is the name of the program? Write
  2. Write down what type of variables is used in the program.
  3. Write down the names of the variables used.
  4. On which line does the program receive data from the user? Write the line number
  5. What will be displayed if the user enters the values: 6, 9, 3

Part 3. Write a program.

Three numbers are entered. Print the smallest number.

Second option

Part I

1. The design of an algorithm in which, as a result of checking the fulfillment of a condition, various actions can be performed is called:

  1. Following
  2. Branching
  3. Repetition

2. Not equal in pascal it is written:

3. Which entry is correct:

  1. write (Set variables a and b);
  2. write (‘ Set Variables a and b’);
  3. write (‘ Set Variables ’, a and b);
  4. write ( Set Variables , ‘a and b’);

4. The block diagram shows the algorithmic design:

  1. Linear algorithm
  2. Branching algorithm
  3. Repetition algorithm

5. A command in pascal that allows you to read data received from the user:

  1. write

Part 2.


1. What value will the variable k have after executing this algorithm?:

a:=2;

k:=4;

a:= k+a*3;

k:=a/2-k;

2. Write down the value of the variable b after executing a fragment of the algorithm:

a:=7;

b:=5;

if a>b then b:= a+b+5

elseb:= a* b-3;

3. Write down the value of the variable b after executing a fragment of the algorithm:

a:=4;

b:=15;

a:= b div a;

b:= b mod a;

4. Write down the value of the variable b after executing a fragment of the algorithm:

a:=2;

b:=5;

for i:=1 to 5 do

b:= a* b;

5. Review the algorithm and answer the questions:

program stocking;

var a, b, c, y: real;

begin

writeln('Enter three numbers');

readln(a,b,c);

y:=a;

if b>y then y:=b;

if c>y then y:=c;

writeln( y) ;

end.

  1. Write the name of the program.
  2. What type of variables is used in the program.
  3. How many variables are used in the program, indicate their names.
  4. Rewrite the line where the program receives data from the user.
  5. What will be displayed if the user enters the values: 5, 8, 2.

Part 3. Write a program.

Given two integersaAndb ( a< b). Print in ascending order all the integers located between a andb(including the numbers themselvesaAndb), as well as the numberNthese numbers.

The basic principles of structured programming do not include....

When developing a software product, elimination of shortcomings noticed by the user is carried out at the _________ stage

The Lisp language is a ____________ programming language.

The object-oriented approach to programming is based on the principle....

Does not apply to basic algorithmic constructions...

Interpreters do...

Encapsulation in object-oriented programming means being able to.....

The program is...

Data markup languages ​​are..........

The first step in solving a problem on a computer is....

The object-oriented approach is based on the concept....

The loading module of the program is the result of work...

The modular structure of the program reflects one of the features of _______________ programming.

The identifier table during the translation process is used to store...

Designing programs by sequentially breaking a large problem into smaller subproblems corresponds to...

When developing a software product, comparing the results of the program with the results of observations or results obtained experimentally refers to the stage

Procedural programming languages ​​do not have a _____________ data type.

1). symbolic

2). complex

3). integer

4). Real

1). debugging and testing the program

2). analysis and formalized description of the problem

3). program support

4). analysis of the results obtained

1). bottom-up design

2). object-oriented design

3). top-down design

4). conceptual modeling

5. The language, whose name is an abbreviation for "universal symbolic code for beginners" is...

1). variable values

2). results of function execution

3). variable and function names

4). results of procedures

7. The concept of "Polymorphism" refers to

1). object-oriented programming technologies

2). structured programming technologies

3). modular programming technologies

4). imperative programming technologies

1). heuristic

2). dynamic

3). logical



4). Structural

1). interpreter

2). grammar

3). translator

4). link editor (linker)

1). formalization of properties

3). class hierarchy

4). Recursions

1). formulation of the problem

2). testing

3). debugging

4). algorithm development

1). P=True; Q=False

2). P=False; Q=True

3). P=False; Q=False

4). P=True; Q=True

1). a complete minimal semantic expression in a programming language

2). algorithm written in a programming language

3). computer operating system command set

4). protocol for interaction between computer network components

1). implementation of the "one module - one object" correspondence

2). defining the interface (specification) of methods for their implementation

3). creating special programs that implement changes in the state of an object

4). enclosing procedures for working with an object in a separate module

1). statement-by-statement processing and program execution

2). statement-by-statement processing without program execution

3). only broadcast of the program

4). tracing and program execution

The task: “enter two numbers and find their arithmetic mean and geometric mean and give the result” corresponds to an algorithm...

1). substitution

2). branching

3). loop with precondition

4). loop with postcondition

1). dichotomous search

2). branches and bounds

3). top-down design

4). bottom-up design

1). systemic

2). functional

3). structural

4). Uncertain

1). debugging and testing

2). analysis of the results obtained

3). coding the program

4). software product support

1). top down programming

2). dividing the project into modules, each of which has one input and one output

3). achieving an absolute minimum of characters and lines in the program text

4). program logic allows only three basic algorithmic structures: sequences, branches, and repetitions

29. Variable attributes in programming languages: a) name b) address c) visible/hidden d) value e) type f) functionality

1). a B C D

2). a, b, d, d

3). b, d, d, f

4). a, c, d, d

1). number of zeros

2). number of positive

3). number of the last zero

4). number of the first zero

34. What value of the variable S will be printed after executing a fragment of the BASIC program?