Book of tasks on programming. Old version

 

 by Aliaksandr N. Prykhodzka

 

and, computer, system, destructor, критерий, сборник задач по программированию, частота, visual basic, author, абстракция, type, сборник, visual basic
 

for valuable work you must have JavaScript (allow active content)

Pascal. Pa.12. Nest of tasks. Type Boolean

 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

Pa.12.1     Answer      Java-analogue      Visual Basic-analogue

Determine a value of the variable b1 after executing the following program


Program AA;
var
    b1, b2, b3 : boolean;
    m, n, k : integer;
begin
    m:=7;    k:=4;    n:=5;
    b3:=(m>k);
    b2:=(n>m) or b3;
    b1:=b2 and b3;
end.

 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

Pa.12.2     Answer      Java-analogue      Visual Basic-analogue

Determine a value of the variable b1 after executing the following program


Program AA;
var
    b1 : boolean;
    i : integer;
begin
    b1:=false;
    for i:=1 to 5 do
        b1:=b1 or (i mod 3 = 0);
end.

 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

Pa.12.3     Answer      Java-analogue      Visual Basic-analogue

Determine a value of the variable b1 after executing the following program


Program AA;
var
    b1 : boolean;
    k, i, j : integer;
begin
    k:=0;
    for i:=1 to 3 do k:=k+i;
    j:=0;
    for i:=1 to 3 do j:=j+2;
    b1:=(k=j);
end.

 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

Pa.12.4     Answer      Java-analogue      Visual Basic-analogue

Determine a value of the variable b1 after executing the following program


Program AA;
var
    b1 : boolean;
    k, i, j : integer;
begin
    i:=5;    j:=15;
    b1:=true;
    for k:=7 to 11 do
        b1:=b1 and ((i>k) and (k end.

 

©   Aliaksandr Prykhodzka    1993 - 2007