logo

Crowdly

Browser

Add to Chrome

Крос-платформне програмування

Looking for Крос-платформне програмування test answers and solutions? Browse our comprehensive collection of verified answers for Крос-платформне програмування at moodle.chnu.edu.ua.

Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!

Проаналізуйте наведений код.

class Rectangle

{ рublic int x = 10, y = 20;

public Rectangle (int x, int y)

{this.x = x; this.y = y; }

public virtual int Zoom

{

get {return x * y; }

set {x + = value; y + = value; }}

}

class Рarallelepiped: Rectangle

{ рublic int z;

public Рarallelepiped (int x, int y, int z): base (x, y)

{this.z = z; }

public override int Zoom

{

get {return x * y * z; }

set {x + = value; y + = value; z + = value; }}

}

class Program

{ static void Main ()

{Rectangle parall = new Rectangle (6, 8, 10);

parall.Zoom = -5; System.Console.Write (parall.Zoom); }

}

Вкажіть результат виведення на консоль після спроби запустити програму на компіляцію і виконання:

C# oop_class

0%
0%
0%
0%
0%
View this question
У класі Testвизначено наведений нижче код:

public delegate int CallBackMethod (int a1, int a2);

public static void Main ()

{ int s = 0;

s = CallMethod (new CallBackMethod (CBMethod));

System.Console.WriteLine (s);

}

public static int CallMethod (CallBackMethod cbMethod)

{Return cbMethod (11, 22); }

public static int CBMethod (int a1, int a2)

{Return a1 + a2; }

Вкажіть результат виведення на консоль після спроби запустити програму на компіляцію і виконання:

C# oop_class

0%
0%
0%
0%
0%
View this question
Вихідний модуль містить вказівку використовуваних просторів імен System, System.Collections. У модулі визначено єдиний клас Program c методом Main , в тілі якого знаходиться код:

Stack s = new Stack ();

string str = "A2B43";

for (int i = 0; i

if (str [i]> = '0' && str [i] <= '9') s.Push (str [i]);

while (s.Count > 0)

Console.Write (s.Peek());

Вкажіть результат виведення після запуску програми на компіляцію і виконання:

C# oop_class

0%
0%
0%
0%
0%
View this question
Наведеним нижче кодом доступні простору імен Systemі System.Collections.

public static void Main ()

{ArrayList al = new ArrayList ();

al.Add ( "Ivaniv");

al.Add ( "Petrenko");

al.Add (3.1415f);

al.Add ( "Ларін");

foreach (object str in al) Console.Write (str + "");

}

Вкажіть результат виведення на консоль після спроби запустити програму на компіляцію і виконання:

C# oop_class

0%
0%
0%
0%
0%
View this question
Наведеним нижче кодом є простір імен System.

class ExceptA: ApplicationException {}

class ExceptB: ExceptA {}

public static void Main ()

{ string a = Console.ReadLine(); string b = Console.ReadLine();

try {if (a == "end") throw new ExceptA();

else if (b == "exit") throw new ExceptB();

else throw new Exception();

}

catch (ExceptB) {Console.Write ( "Виняток-1"); }

catch (ExceptA) {Console.Write ( "Виняток-2"); }

catch (Exception) {Console.Write ( "Виняток-3"); }

}

Користувач збирається після запуску програми ввести noі yes. Вкажіть результат виведення на консоль після спроби запустити програму на компіляцію і виконання:

C# oop_class

0%
0%
0%
0%
0%
View this question
Вихідний модуль містить код:

interface IФормула {int F (int x); }

class A: IФормула { рublic int F (int x) {return x * x * x; }}

class B: IФормула { рublic int F (int x) {return x * x; }}

class Program

{

static int Out (IФормула f, int x) {return fF (x); }

static void Main ()

{

A a = new A(); B b = new B();

System.Console.WriteLine (______________);

}

}

Серед перерахованих нижче кодів вкажіть код, підстановка якого замість знаків підкреслення дозволяє отримати коректну програму для обчислення 2 * 2 * 2 + 4 * 4:

C# oop_class

0%
0%
0%
0%
0%
View this question
Вихідний модуль містить код:

interface IMAN

{ рublic string Name(); public string Surname(); }

class MAN: IMAN

{

string name, surname;

public MAN (string name, string surname) {this.name= name; this.surname = surname; }

public string Name() {return name; }

public string Surname() {return surname; }

}

class Program

{

static void Main ()

{

MAN man = new MAN ( "Іван", "Sydorenko");

System.Console.Write (man.Name() + man.Surname());

}

}

Метод Main розроблявся для виведення імені та прізвища людини.

Трансляція програми завершена невдало. З наведених висловлювань вкажіть висловлювання, яке розкриває причину некоректності програми:

C# oop_class

0%
100%
0%
0%
0%
View this question
Серед перерахованих модифікатор ів вкажіть всі модифікатор и, допустимі при визначенні типу делегата:

C# oop_class

0%
100%
100%
0%
100%
View this question
Вихідний модуль містить код:

using System;

class Tree { рublic Tree() {Console.Write ( "Tree"); }}

class Fruits: Tree

{ рublic Fruits() {Console.Write ( "Fruits"); }}

class Apple: Fruits

{ рublic Apple() {Console.Write ( "Apple"); }

public Apple (string s): this() {Console.Write (s); }

}

class Program

{ static void Main () {object P = new Apple ( "Antonovka"); }

}

Вкажіть результат виведення на консоль після спроби запустити програму на компіляцію і виконання:

C# oop_class

0%
100%
0%
0%
0%
View this question
Проаналізуйте наведений код.

class Circle

{ рrotected double r = 5;

public Circle (double r) {this.r = r; }

public virtual int Figure()

{return (int) (3.14 * r * r); }

}

class Cylinder: Circle

{ double h = 10;

public Cylinder (double r, double h): base (r)

{this.h = h; }

public override int Figure() {return (int) (3.14 * r * r * h); }

}

class Cone: Circle

{ double h = 10;

public Cone (double r, double h): base (r)

{this.h = h; }

public override int Figure()

{return (int) (3.14 * r * r * h / 3.0); }

}

class Program

{ static void Param (Circle fig)

{ System.Console.Write (fig.Figure() + "");

}

static void Main ()

{ рaram (new Circle(1) ); }

}

Вкажіть результат виведення на консоль після спроби запустити програму на компіляцію і виконання:

C# oop_class

100%
0%
0%
0%
0%
View this question

Want instant access to all verified answers on moodle.chnu.edu.ua?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome