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

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

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

Какое значение будет присвоено переменной 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 ...

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

Варианты ответа
Похожие вопросы
Какое значение будет присвоено переменной k в результате выполнения оператора select type в следующем фрагменте программы ?
type point  integer x, yend type pointtype, extends(point) :: point_ex  integer zend type point_extype, extends(point_ex) :: point_phys  real vx  real tmend type point_phystype, extends(point_phys) :: point_mech  character(32) nameend type point_mechclass (point_ex), pointer :: polyclass (point), target, allocatable :: ptclass (point_ex), target, allocatable  :: pt_exclass (point_phys), target, allocatable  :: pt_phclass (point_mech), target, allocatable  :: pt_mhinteger kallocate (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 ...
Объявлены следующие типы и переменные.
  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        
Какие справедливы прикрепления ссылок ?
Объявлены следующие типы и переменные.
  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?
Объявлены следующие типы и переменные.
  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        
Какие справедливы прикрепления ссылок ?
Объявлены следующие типы и переменные.
  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        
Какие справедливы прикрепления ссылок ?
Даны два типа описанных в модуле 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 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 roundrectend module mod_1        

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

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

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

type (roundrect) rcУкажите верные варианты доступа к полям производного типа из головной программы.
В программе объявлены типы и переменная
  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)