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

Разработка компиляторов

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

При таком описании класса:
public class Matrix {	public const int n = 10;	public int[,] elements = new int[n,n];	public int this[int i, int j]	{		get { return elements[i,j]; }		set { elements[i,j] = value; }	}}
допустимо следующее использование:

(Ответ считается верным, если отмечены все правильные варианты ответов.)

Варианты ответа
Matrix a = new Matrix();(Верный ответ)
b[0,0] = -4; b[1,5] = 10;(Верный ответ)
a[0,0] = 1; a[1,5] = 5;(Верный ответ)
Matrix b = new Matrix();(Верный ответ)
Похожие вопросы
С помощью какого атрибута в данном примере:
using System.Runtime.InteropServices;public class AppMain {  [DllImport("user32.dll")]  public static extern int MessageBoxA(int handle, string message,    string caption,int flags);  public static void Main(){    MessageBoxA(0,"Hello World","Native Message Box",0);  }  [conditional("DEBUG")]   public static void SayHello() {     Console.WriteLine("Hello, World!"); return;   }}
обеспечивается взаимодействие с функцией MessageBoxA из Win32 API:
В данном примере:
using System; public delegate void EventHandler (string strText);class EventSource {  public event EventHandler TextOut;  public void TriggerEvent() {     if (TextOut != null) TextOut("Event triggered..."); }}class TestApp {  public static void Main() {    EventSource evsrc = new EventSource();    evsrc.TextOut += new EventHandler(CatchEvent);  evsrc.TriggerEvent();    evsrc.TextOut -= new EventHandler(CatchEvent);  evsrc.TriggerEvent();    TestApp theApp = new TestApp();    evsrc.TextOut += new EventHandler(theApp.InstanceCatch);     evsrc.TriggerEvent();  }public static void CatchEvent(string strText) { WriteLine(strText); }public void InstanceCatch(string strText) { WriteLine("Instance "+strText); }
происходят:
Данный пример:
private int m_stateOfVeryCriticalResource;public int stateOfVeryCriticalResource {  get { if (IsAllowedUser())            return m_stateOfVeryCriticalResource; }  set { if (IsAdmin())            m_stateOfVeryCriticalResource = value; }}...stateOfVeryCriticalResource = vcrCompletelyScrewedUp;
позволяет проверить достаточность полномочий запрашивающего приложения:
Следующая программа:
using System;class Fib{   public static void Main (String[] args)   {      int a = 1, b = 1;      for (int i = 1; i != 10; ++i)      {         Console.WriteLine (a);         int c = a + b;         a = b; b = c;      }   }}
вычисляет:
В данном примере:
public static void Main() {  Int32 v = 5;  Object o = v;  v = 123;  Console.WriteLine (v + ", " + (Int32) o);}
операция упаковки производится:
Данная программа:
class LowLevelSample {    public static void Run() {	int i;	i = 0;	try {	   Start:             if (i == 10) throw new Exception();             Console.WriteLine (i);             i = i + 1;             goto Start;	}	catch (Exception) {           Console.WriteLine ("Finished");	}    }}
может использоваться в качестве примера:
В качестве алфавита операторов данной программы:
int F (int a, int b){  int g = a, m = b;  if (a < b) {g = b; m = a;}  while (m)   {    int s = g;    g = m;    m = s % m;  }  return g;}
выступает следующее множество:
Следующий набросок программы:
q = q0;c = GetChar();while (c != eof) {  q = move (q, c);  c = GetChar();}if (q is in F) return "yes";else return "no"; 
демонстрирует (предполагается, что входная лента заканчивается символом end_of_file):
Следующая процедура:
int Factor (){   char ch = getChar();   if (isDigit (ch)) return getValue(ch);   if (ch == '(')    {      int result = Formula ();      if (getChar() == ')') return result;      error ("Неожиданный символ");      return 0;   }   return error ("Неожиданный символ"); }
вычисляет значение:
Данная функция:
int yylex (void){int ch;while ((ch = getchar ()) == ' ');if (isdigit (ch)){ungetc (ch, stdin); scanf (%i, &yylval);return NUMBER_LC;}return ch;}
вычисляет следующую пару значений: