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

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

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

Даны два типа описанных в модуле 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, который:
  • содержит поле типа baseX, в виде динамической переменной
  • содержит поле типа integer(2), в виде ссылки
  • содержит поле типа integer(8)
  • В ответ введите размер в байтах переменной типа composite

    (Ответ необходимо ввести в поле ввода.)

    Варианты ответа
    Похожие вопросы
    Даны два типа описанных в модуле 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
    Даны два типа
      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, который содержит поля:
  • типа point, в виде одномерного динамического массива
  • типа real(8), в виде трехмерного динамического массива
  • В ответ введите размер в байтах переменной типа region
    Даны два типа описанных в модуле 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 после добавления процедур ?
    Модуль
    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 cardend module mod_1        

    используется в головной программе.

    Объявлена переменная

    type(card) cdУкажите верные варианты доступа к полям производного типа.
    Модуль
    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 cardend module mod_1        

    используется в головной программе.

    Объявлена переменная

    type(card) cdУкажите верные варианты доступа к полям производного типа.
    Дан модуль, который используется в головной программе
    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_mapsend module mod_1        

    В головной программе объявлена переменная

    type (e_maps) EMУкажите верные варианты доступа к полям производного типа из головной программы.
    Какое значение будет присвоено переменной k в результате выполнения оператора select type в следующем фрагменте программы ?
    type point  integer x, yend type pointtype, extends(point) :: point_ex  integer z  integer color  logical errorend type point_extype, extends(point_ex) :: point_phys  real vx  real vy  real vz  real tmend type point_phystype, extends(point_phys) :: point_mech  character(32) name  character(8)  codeend type point_mechinteger kclass (*), pointer :: ptrtype  (point_ex), target :: pt_exclass (point_phys), allocatable, target :: pt_phclass (point_mech), allocatable, target :: pt_mhallocate(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 ...
    Дан модуль, который используется в головной программе
    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 studentend module mod_1        

    В головной программе объявлена переменная

    type (student) stУкажите верные варианты доступа к полям производного типа из головной программы.
    Модуль
    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 NewTypeend module mod_1        

    используется в головной программе.

    Объявлена переменная

    type(NewType) NTУкажите верные варианты доступа к полям производного типа.