Укажите оператор, используемый для задания производного типа
class
 
type
 
record
 
extends
 
select type
 
Укажите оператор, который указывает какие процедуры привязаны к типу по имени
contains
 
private
 
type
 
class
 
select type
 
Процедурные указатели объявляются при помощи оператора
procedure
 
contains
 
class
 
final
 
pass
 
Наследование производных типов осуществляется при помощи атрибута
pass
 
extends
 
extend
 
class
 
select type
 
Неограниченно полиморфная переменная объявляется при помощи оператора
class
 
class(*)
 
class()
 
class*
 
*class
 
Финальные процедуры объявляются при помощи атрибута
procedure
 
final
 
deferred
 
non_overridable
 
extends
 
Выберите верные утверждения касающиеся конструктора
Определение типа полиморфной переменной происходит посредством оператора
class(*)
 
select case
 
type is
 
class is
 
select type
 
Каким атрибутом следует описать процедуру, привязанную к типу по имени, чтобы получить доступ к переменной, посредством которой вызывалась данная процедура ?
final
 
pass
 
nopass
 
deferred
 
procedure
 
Перегрузка операции деления реализуется при помощи оператора
extends
 
interface operator
 
operator
 
interface assignment
 
procedure
 
Перегрузка операции присваивания реализуется при помощи оператора
extends
 
interface operator
 
operator
 
interface assignment
 
procedure
 
Выберите верное задание операции EXTRACT для производного типа
Полиморфная переменная объявляется оператором
class
 
type
 
record
 
extends
 
select type
 
Для запрещения прямого обращения к полю производного типа используется атрибут
public
 
protected
 
private
 
extends
 
pass
 
В программе объявлены типы и переменнаяtype point complex x,y end type point type NewType integer a type (point) z(3) character(4) border(2) end type NewType type (NewType) pt(10) Укажите верные варианты инициализации элемента pt(5)
pt(5)=NewType(50,[(1.0,1.0),(2.0,2.0)],'A101')
 
pt(5)=NewType(50,0.0,['A101','B120'])
 
pt(5)=NewType(50,point(0.0),['A101','B120'])
 
pt(5)=NewType(50,point(0.0,0.0),['A101','B120'])
 
Модульmodule mod_1 type region integer x1,y1,x2,y2 end type region type blk logical st(3) character(5), private :: name end type blk type NewType type (region) reg type (blk) bee end type NewType end module mod_1 используется в головной программе.
Описан массив
type (NewType) matrix(10,10,100)
Укажите верные варианты инициализации элементаmatrix(1:5:2,:,20)
matrix(1:5:2,:,20)=NewType(region(1,2,3,4),blk(.TRUE.,'TERMO'))
 
matrix(1:5:2,:,20)=NewType(region(0),blk('TERMO',.FALSE.))
 
matrix(1:5:2,:,20)=NewType((1,2,3,4),blk(.FALSE.,'TERMO'))
 
matrix(1:5:2,:,20)=NewType(region(0,0,0,0),blk(.FALSE.,'TERMO'))
 
matrix(1:5:2,:,20)=NewType(region(0,0,0,0),blk('TER','TER'))
 
Модульmodule mod_1 type region integer x(4) real R end type region type blk logical st(3) character(5), public :: name(2) end type blk type NewType type (region) reg(20) type (blk) bee(30) end type NewType end module mod_1 используется в головной программе.
Объявлена переменная
type(NewType) NT
Укажите верные варианты доступа к полям производного типа.
NT.reg(10).x(2)
 
NT.reg.x
 
NT.reg.x(3)
 
NT.bee(1::2).name(1)
 
NT.bee(2:20:5).name(1)(1:3)
 
Модульmodule mod_1 type plot integer x1,y1,x2,y2 integer color(255) end type plot type indicator type (plot) plt logical, private :: free character(4) date end type indicator type card type (indicator) indic integer fparam integer sparam end type card end module mod_1 используется в головной программе.
Объявлена переменная
type(card) cd
Укажите верные варианты доступа к полям производного типа.
cd.indic.plt.color(200)
 
cd.indic.date(1:3)
 
cd.indic
 
cd.indic.free
 
cd.indic.plot
 
Модульmodule mod_1 type plot integer x1,y1,x2,y2 integer, private :: color(255) end type plot type indicator type (plot) plt logical :: free character(4), public :: date end type indicator type card type (indicator) indic integer fparam integer, private :: sparam end type card end module mod_1 используется в головной программе.
Объявлена переменная
type(card) cd
Укажите верные варианты доступа к полям производного типа.
cd.sparam
 
cd.fparam
 
cd.indicator.free
 
cd.indic.plt.x1
 
cd.indic.plt.color(1:100:4)
 
Дан модуль, который используется в головной программеmodule mod_1 type maps integer x,y integer color logical, private :: status end type maps type, extends (maps) :: e_maps integer segment character, private :: code end type e_maps end module mod_1 В головной программе объявлена переменная
type (e_maps) EM
Укажите верные варианты доступа к полям производного типа из головной программы.
EM.code
 
EM.segment
 
EM.color
 
EM.status
 
EM.maps
 
Дан модуль, который используется в головной программеmodule mod_1 type rectangle integer x1,y1,x2,y2 integer color character, private :: name end type rectangle type, extends (rectangle) :: roundrect integer radius real, public :: center end type roundrect end module mod_1 В головной программе объявлена переменная
type (rectangle) rct
Укажите верные варианты доступа к полям производного типа из головной программы.
rct.roundrect
 
rct.name
 
rct.center
 
rct.rectangle
 
rct.x1
 
Дан модуль, который используется в головной программеmodule mod_1 type person integer year character(64), private :: name="ABC" character(64), private :: sname="DEF" end type person type, extends (person) :: student logical, private :: status character, public :: group end type student end module mod_1 В головной программе объявлена переменная
type (person) ps type (student) st Укажите верные варианты доступа к полям производного типа из головной программы.
ps.year
 
st.person
 
st.group
 
st.status
 
ps.status
 
Дан модуль, который используется в головной программеmodule mod_1 type person integer, public :: year character(64), private :: name="ABC" character(64), public :: sname="DEF" end type person private person type, extends (person) :: student logical, public :: status character, private :: group end type student end module mod_1 В головной программе объявлена переменная
type (student) st
Укажите верные варианты доступа к полям производного типа из головной программы.
st.person
 
st.person.name
 
st.year
 
st.status
 
st.person.year
 
Дан модуль, который используется в головной программеmodule mod_1 type rectangle integer x1,y1,x2,y2 integer, private :: color character(16), private :: name = "REC_0001" end type rectangle type, extends (rectangle) :: roundrect integer r1, r2 real center end type roundrect end module mod_1 В головной программе объявлена переменная
type (roundrect) rc
Укажите верные варианты доступа к полям производного типа из головной программы.
rc.x1
 
rc.name
 
rc.rectangle
 
rc.color
 
rc.center
 
Объявлены следующие типы и переменные.type sma real p(100) real mid(100) logical res end type sma type, extends (sma) :: ssma real middle end type ssma type uma type (sma) sm(100) complex p(100) logical ret character bis end type uma class (sma), pointer :: polym type (uma), target :: um1 type (ssma), target :: ssm1 Какие справедливы прикрепления ссылки polym?
polym=>um1.sm(50)
 
polym=>um1
 
polym=>ssm1
 
polym=>um1.sm(1:100:4)
 
polym=>null()
 
Объявлены следующие типы и переменные.type cell real next real prev logical stat end type cell type, extends (cell) :: object integer code real dist real radius end type object type grid type (object) object integer n integer xa,xb,ya,yb end type grid class (*), pointer :: polym class (cell), pointer :: ptc type (grid), target :: ptg Какие справедливы прикрепления ссылок ?
polym => ptc
 
ptc => ptg.object
 
polym => ptg.object
 
polym=>um1.sm(1:100:4)
 
polym => ptg
 
Объявлены следующие типы и переменные.type grid integer adr real alfa real beta end type grid type, extends (grid) :: flow integer coord real dist real param end type flow type regime type (flow) flw real, allocatable :: ux(:,:,:), uy(:,:,:), uz(:,:,:) real R1, R2, R3 end type regime class(*), pointer :: polym class(regime), pointer :: pol_reg type(flow), target :: pol_flw Какие справедливы прикрепления ссылок ?
polym => pol_flw.grid
 
pol_reg => pol_flw.flw
 
polym => pol_reg
 
pol_reg => pol_flw
 
polym => pol_flw
 
Объявлены следующие типы и переменные.type cell real next real prev logical stat end type cell type object integer code real dist real radius end type object type grid type (object) object type (cell) cell integer xa,xb,ya,yb end type grid class (*), pointer :: polym class (cell), pointer :: ptc type (grid), target :: ptg Какие справедливы прикрепления ссылок ?
polym => ptg.cell
 
ptc => ptg.cell
 
ptc => ptg.object
 
ptc => ptg.cell.next
 
polym => ptg.cell.next
 
Объявлены следующие типы и переменные.type grid integer adr real alfa real beta end type grid type, extends (grid) :: flow integer coord real dist real param end type flow type, extends (flow) :: regime real, allocatable :: ux(:,:,:), uy(:,:,:), uz(:,:,:) real R1, R2, R3 end type regime class(*), pointer :: polym class(grid), pointer :: pol_grd type(flow), target :: flw Какие справедливы прикрепления ссылок ?
pol_grd=>flw
 
polym => flw.dist
 
pol_grd => flw.param
 
pol_grd => flw.grid
 
polym => flw.grid.beta
 
В головной программе используется модуль
geom
, который содержит только типtriangle
и модульную процедуруSquare
. Головная программа использует модульgeom
. В головной программе объявлена переменнаяtype (triangle) TR
.Укажите верное описание типа
triangle
и процедурыSquare
, для организации вызоваwrite(*,*) TR.Square()
из головной программы
В головной программе используется модуль geom, который содержит только тип
circle
и модульную процедуруIncRadius
. Головная программа использует модульgeom
. В головной программе объявлена переменнаяtype (circle) CR
.Укажите верное описание типа
circle
и процедурыIncRadius
, чтобы при вызовеcall CR.IncRadius(10.0)
из головной программы, полеR
переменнойCR
было изменено.
В головной программе используется модуль
peoples
, который содержит только типperson
и модульную процедуруPrintInfo
. Головная программа использует модульpeoples
. В головной программе объявлена переменнаяtype (person) PS
.Укажите верное описание типа person и процедуры
PrintInfo
, чтобы при вызовеcall PS.PrintInfo()
из головной программы, отображалась информация, содержащаяся в полях переменнойPS
.
В головной программе используется модуль
farm
, который содержит только типanimal
и модульную процедуруPrintTitle
. Головная программа использует модульfarm
. В головной программе объявлена переменнаяtype (animal) AN
.Укажите верное описание типа
animal
и процедурыPrintTitle
, для организации вызоваcall AN.PrintTitle()
из головной программы.
В головной программе используется модуль geom, который содержит только тип
figure
и модульную процедуруModify
. Головная программа использует модульgeom
. В головной программе объявлена переменнаяclass (figure), allocatable :: FG
.Укажите верное описание типа
figure
и процедурыModify
, чтобы при вызовеcall FG.Modify(10)
из головной программы, происходило изменение поляpoints
в переменнойFG
.
Какие имена являются процедуры привязанными к типу по имени в следующем фрагменте программы ?use graph type(plot) PLT, PLTA, PLTB ... call PLT.Create(10,10,200,200) PLT=.INVERSE.PLT write(*,*) PLTA.xcenter write(*,*) PLT.Radius() call VerifyPlot(PLTB.coords) write(*,*) finish(PLTA.start()) PLT=PLTA.UNION.PLTB ...
Create
 
NVERSE
 
xcenter
 
Radius
 
VerifyPlot
 
coords
 
finish
 
start
 
UNION
 
В следующем фрагменте программы, какие имена являются процедурами привязанными к типу по имени ?use algebra type (matrix) MTR, MTR1, MTR2 real det ... call MTR.Create(10,10) call MTR.Random() call MTR1.Transpose() det=MTR1.determinant ... MTR=MTR1.CONVERT.MTR2 write(*,*) MTR.value(10,2:10,10) ...
Create
 
Random
 
Transpose
 
determinant
 
CONVERT
 
value
 
В приведенном фрагменте программы перечислите имена пользовательских операций.use math type (matrix) MTR, MTR1, MTR2 type (set) S1, S2, S3 ... call MTR.Create(Mi,Mj) MTR = MTR1 + MTR2 * (MTR.Inverse()) S2 = S1.CROSS.S3 call MTR1.Transpose() det = MTR1.determinant ... S1 = S2.UNION.S3 write(*,*) S1.value(1:100:2) ...
Create
 
Inverse
 
Transpose
 
determinant
 
INDEX
 
UNION
 
CROSS
 
value
 
В следующем фрагменте программы, какие имена не являются и могут не являться процедурами, привязанными к типу по имени?use grids type (grid_MKE) GR type (point) pt call GR.Init() call GR.PrintInfo() write(*,*) GR.coordinates(10,20) write(*,*) GR.next() write(*,*) GR.values(2,2) if (.NOT.GR.err) then ... pt = GR.points + pt ...
Init
 
PrintInfo
 
coordinates
 
next
 
values
 
err
 
points
 
В следующем фрагменте программы, укажите имена перегруженных процедур и операций.use flow type (grid) GRD type (velocity) VX, VY, VZ ... GRID.Init() call GRD.Add(VX) call GRD.Add(VY,VZ) call GRD.Build(X1=0.0,Y1=0.0,X2=2.0,Y2=1.0) write(1,*) VX + VY, VX - VZ ... call GRD.Draw() ... call VX.VectorField(GRD)
Init
 
Add
 
Draw
 
операция " + "
 
операция " - "
 
VectorField
 
Build
 
Даны два типаtype person character(64) name character(64) lastname end type person type robot character(32) mech integer(8) period end type robot Создайте тип office, которыйВ ответ введите размер в байтах переменной типа
наследует тип person содержит поле типа robot, в виде одномерного динамического массива содержит поле типа character(64), являющееся ссылкой office
Даны два типаtype grid real(8) x1,y1,x2,y2 integer(8) adr end type grid type point real(8) x real(8) y end type point Создайте типregion
, который содержит поля:В ответ введите размер в байтах переменной типа region
типа point
, в виде одномерного динамического массиватипа real(8)
, в виде трехмерного динамического массива
Даны два типа описанных в модулеhydro
module hydro type point real(8) x real(8) y end type point type, extends (point) :: expoint real(16), allocatable :: x1,y1,x2,y2 character(8) code end type expoint ... end module hydro В типexpoint
добавляются две модульные процедурыprocA
иprocB
. Процедуры не имеют формальных параметров. На сколько изменится размер в байтах переменной типа expoint после добавления процедур ?
Даны два типа описанных в модулеgas_dynamics
module gas_dynamics type grid real(8), allocatable :: dat(:,:,:) real(8), allocatable :: xcoord(:) real(8), allocatable :: ycoord(:) real(8), allocatable :: zcoord(:) end type grid type particle real(8), allocatable, private :: ux(:,:,:) real(8), allocatable, private :: uy(:,:,:) real(8), allocatable, private :: uz(:,:,:) real(8), allocatable, private :: tm(:,:,:) end type particle ... end module gas_dynamics Создайте тип plot, который:В ответ введите размер в байтах переменной типа
наследует поля типа grid
содержит поле типа particle
, в виде одномерного динамического массивасодержит два поля типа complex(8)
, в виде одномерных динамических массивовplot
Даны два типа описанных в модулеgas_dynamics
type base complex(8), allocatable :: points(:) logical, allocatable :: errors(:) integer, private :: size end type base type, extends(base) :: baseX character(32) file character(32) name logical stat end type baseX Создайте типcomposite
, который:В ответ введите размер в байтах переменной типа composite
содержит поле типа baseX, в виде динамической переменной содержит поле типа integer(2)
, в виде ссылкисодержит поле типа integer(8)
Для типа point выберите правильный код финальной процедуры DeletePointmodule flow integer, private :: INDEX type point integer x,y,z integer color logical stat contains final :: DeletePoint end type point CONTAINS ... subroutine InitFlow() INDEX=0 end subroutine InitFlow end module flow
В головной программе используется модуль flow. Объявлена переменная PT типа point. Какие из процедур в типе point могут изменить приватную часть переменной PT ?module flow type point integer x integer y real, private :: cp contains procedure, nopass :: proc1 procedure proc2 procedure, pass :: proc3 procedure, nopass :: proc4 procedure proc5 procedure show end type point contains subroutine proc1(pt,val) type(point) pt real val pt.cp = val end subroutine proc1 subroutine proc2(pt) class(point) pt pt.cp=real(pt.x+pt.y) end subroutine proc2 subroutine proc3(pt) class(point) pt integer tmp tmp=pt.x; pt.x=pt.y; pt.y=tmp end subroutine proc3 subroutine proc4(pt) type(point) pt if (pt.cp<=0) write(*,*) "ERROR" end subroutine proc4 subroutine proc5(pt,M,N,S) class(point) pt integer M,N real, optional :: S pt.x=pt.x+N pt.y=pt.y+M if (present(S)) call random_number(pt.cp) end subroutine proc5 end module flow
proc1
 
proc2
 
proc3
 
proc4
 
proc5
 
Какое значение будет присвоено переменнойk
в результате выполнения оператора select type в следующем фрагменте программы ?type point integer x, y end type point type, extends(point) :: point_ex integer z integer color logical error end type point_ex type, extends(point_ex) :: point_phys real vx real vy real vz real tm end type point_phys type, extends(point_phys) :: point_mech character(32) name character(8) code end type point_mech integer k class (*), pointer :: ptr type (point_ex), target :: pt_ex class (point_phys), allocatable, target :: pt_ph class (point_mech), allocatable, target :: pt_mh allocate(pt_ph,source=point_phys(1,2,3,4,.true.,0.0,0.0,0.0,0.0)) allocate(pt_mh,source=point_mech(5,6,7,8,.true.,0.0,0.0,0.0,0.0,"A","B")) ptr=>pt_ph select type (ptr) type is (point_ex); k=ptr.x class is (point); k=ptr.y class is (point_mech); k=ptr.color class default; k=0 end select ...
Какое значение будет присвоено переменнойk
в результате выполнения оператора select type в следующем фрагменте программы ?type point integer x, y end type point type, extends(point) :: point_ex integer z end type point_ex type, extends(point_ex) :: point_phys real vx real tm end type point_phys type, extends(point_phys) :: point_mech character(32) name end type point_mech class (point_ex), pointer :: poly class (point), target, allocatable :: pt class (point_ex), target, allocatable :: pt_ex class (point_phys), target, allocatable :: pt_ph class (point_mech), target, allocatable :: pt_mh integer k allocate (pt, source=point(1,2)) allocate (pt_ex, source=point_ex(3,4,5)) allocate (pt_ph, source=point_phys(6,7,8,0.0,9.0)) allocate (pt_mh, source=point_mech(9,10,11,0.0,0.0,"ABC")) poly=>pt_mh select type (poly) class is (point_ex); k=poly.x class is (point_phys); k=poly.z class default; k=0 end select ...
Какое значение будет находиться в поле a переменнойex1
после вызова call ex1.solve() в следующей программе ?module mod_1 abstract interface integer function func(x) integer x end function func end interface type region integer, private :: a integer, private :: b procedure (func), pointer, nopass :: funct contains procedure solve end type region contains subroutine solve(rg) class(region) rg rg.a=rg.funct(rg.a) end subroutine solve end module mod_1 program prog use mod_1 type (region) ex1 ex1.a=2; ex1.b=3; ex1.funct=>F call ex1.solve() contains integer function F(x) integer x F=x*x+x end function F END