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 Рarallelepiped (6, 8, 10);
parall.Zoom = -5; System.Console.Write (parall.Zoom); }
}
Вкажіть результат виведення на консоль після спроби запустити програму на компіляцію і виконання:
C# oop_class
interface IFigure {int Perimeter(); int Square(); }
class Kvadrat: IFigure
{ int length;
public Kvadrat (int length) {this.length= length;}
public int Perimeter() {return 4 * length; }
int IFigure.Square() {return length * length; }
}
class Test
{ рublic static void Main ()
{ IFigure fig;
fig = new Kvadrat (10);
System.Console.WriteLine ( "Периметр = {0} Площа = {1}",
fig. Perimeter(), fig.Square());
}}
Вкажіть результат виведення на консоль після спроби запустити програму на компіляцію і виконання:
C# oop_class
class Appliance
{ рublic Appliance() { System.Console.Write ( "Appliance"); }}
class Receiver: Appliance
{ рublic Receiver() { System.Console.Write ( "Receiver"); }}
class TVset: Appliance
{ рublic TVset() { System.Console.Write ( "TVset"); }}
class Program
{
static void Main () {Appliance P = new TVset(); }
}
Вкажіть результат виведення на консоль після виконання методу Main():
C# oop_class
class A
{ рublic virtual void F()
{ System.Console.Write ( "Фрукти"); }}
class B: A
{
public new void F() {base.F();
System.Console.Write ( "Яблука");
}
public void F (string s)
{ System.Console.Write (s); }
}
У класі Program визначено метод Main , в тілі якого знаходиться код:
A p1 = new B(); B p2 = new B();
______________;
Потрібно вивести повідомлення: Фрукти Яблока. Серед перерахованих нижче кодів вкажіть всі варіанти коду, підстановка кожного з яких замість знаків підкреслення дозволяє отримати коректну програму, вирішальну поставлене завдання:
C# oop_class
class Rectangle
{ double width = 0.0, hight = 0.0, s = 0,0;
string t = "Прямокутник";
public Rectangle (double w, double h) {width = w; hight = h; s = w * h; }
public Rectangle (double side): this (side, side) {t = "Квадрат"; }
public Rectangle(): this (1.0, 1.0) {t = "Точка"; }
public string RectForm() {return string.Format ( "{0}: площа = {1}", t, s); }
}
class Program
{ static void Main ()
{Rectangle k = new Rectangle (10); Rectangle t = new Rectangle();
System.Console.Write (k.RectForm() + t.RectForm());
}
}
Вкажіть результат виведення на консоль після спроби запустити програму на компіляцію і виконання:
C# oop_class
class A { рublic virtual void P()
{ System.Console.Write ( "ПЕТРIВ"); }}
Клас B визначено як спадкоємець класу A. Серед наведених нижче висловлювань вкажіть справжнє висловлювання:
У класі B метод P()
C# oop_class
class Rectangle
{ double width = 15, hight = 10, s;
string t = "прямокутник";
public Rectangle (double w, double h)
{ width = w; hight = h; s = w * h; }
public Rectangle (int w, int h)
{ width * = w; hight * = h; s = width * hight; }
public string RectForm()
{return string.Format ( "{0}: площа = {1}.", t, s); }
}
class Program
{ static void Main ()
{ Rectangle k = new Rectangle (2, 3);
Rectangle t = new Rectangle (3, 4.0);
System.Console.Write (k.RectForm() + t.RectForm());
}
}
Вкажіть результат виведення на консоль після спроби запустити програму на компіляцію і виконання:
C# oop_class
interface Interface {int Method(); }
class Class1: Interface
{ int len;
public Class1 (int l) {len = l; }
public virtual int Метод() {return len * len; }
}
class Class2: Class1
{ int w, h;
public Class2 (int w1, int h1): base (w1) {w = w1; h = h1; }
public override int Метод() {return w * h; }
}
class Test
{ рublic static void Main ()
{Class2 obj1 = new Class2 (5, 10);
Interface obj2 = obj1;
System.Console.WriteLine ( "значення1 = {0} значення2 = {1}",
obj1.Method(), obj2.Method());
}}
Вкажіть результат виведення на консоль після спроби запустити програму на компіляцію і виконання:
C# oop_class
class ClassA {
int a;
public int VA {get {return a; } Set {a = value; }}}
class ClassB: ClassA {
int b;
public int VB {get {return b; } Set {b = value; VA = b-3; }}}
class ClassC: ClassB {
int c;
public int VC {get {return c; } Set {c = value; VB = c-2; }}}
У класі Program визначено метод Main , в тілі якого знаходиться код:
ClassC P = new ClassC();
P.VC = 10;
System.Console.Write ( "{0} {1}", P.VC, P.VA);
Вкажіть результат виведення на консоль після виконання методу Main():
C# oop_class
class Student
{ string surname;
public string Surname {get {return surname; }}
public Student (string а) {surname = a; }
}
class Magistr Student
{ int course;
public int Course {get {return course; }}
public Magistr (string surn, int k): base (surn) {this.course = k; }
}
class Test
{ static void Main ()
{Student Ivaniv = new Magistr ( "Petrenko", 4);
System.Console.Write ( "{0} {1}", _______________);
}
}
Потрібно вивести прізвище і номер курсу студента у вигляді: Petrenko 4. Серед перерахованих нижче кодів вкажіть код, підстановка якого замість знаків підкреслення дозволяє отримати програму, вирішальну поставлене завдання:
C# oop_class