База ответов ИНТУИТ

Программирование больших вычислительных задач на современном Фортране с использованием компиляторов Intel

<<- Назад к вопросам

В следующем фрагменте программы, укажите имена перегруженных процедур и операций.
  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
Похожие вопросы
В следующем фрагменте программы, какие имена не являются и могут не являться процедурами, привязанными к типу по имени?
  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  ...        
В следующем фрагменте программы, какие имена являются процедурами привязанными к типу по имени ?
  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)  ...        
В приведенном фрагменте программы перечислите имена пользовательских операций.
  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)  ...        
Какие имена являются процедуры привязанными к типу по имени в следующем фрагменте программы ?
  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  ...  
Объявлены следующие типы и переменные.
  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        
Какие справедливы прикрепления ссылок ?
Объявлены следующие типы и переменные.
  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        
Какие справедливы прикрепления ссылок ?
В головной программе используется модуль 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 proc5end module flow        
Объявлены следующие типы и переменные.
  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        
Какие справедливы прикрепления ссылок ?
Данная программа компилируется с ошибкой. Какие варианты изменений в программе можно выполнить, чтобы из головной программы вызвать процедуру init из модуля A
module mod_A contains   subroutine init     write(*,*) "Initializing A"   end subroutine initend module mod_Amodule mod_B contains   subroutine init     write(*,*) "Initializing B"   end subroutine initend module mod_BPROGRAM prog use mod_A use mod_B implicit none call init() ! вызываем процедуру из модуля Aend    
Данная программа компилируется с ошибкой. Какие варианты изменений в программе можно выполнить, чтобы из головной программы вызвать процедуру init из модуля A
module mod_A contains   subroutine init     write(*,*) "Initializing A"   end subroutine initend module mod_Amodule mod_B contains   subroutine init     write(*,*) "Initializing B"   end subroutine initend module mod_BPROGRAM prog use mod_A use mod_B implicit none call init() ! вызываем процедуру из модуля Aend