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!
C# oop_class
C# oop_class
abstract class Rectangle
{ рublic double width, hight;
public Rectangle (double width, double hight)
{this.width = width; this.hight = hight; }
public double Zoom (double d)
{width + = d; hight + = d; return width * hight; }
}
class Program
{ static void Main ()
{Rectangle rect = new Rectangle (10, 20);
rect.Zoom (-5);
System.Console.Write ( "{0} {1}", rect.width, rect.hight);
}
}
Вкажіть результат виведення на консоль після спроби запустити програму на компіляцію і виконання:
C# oop_class
delegate string strMod (string str);
public static string ReplaceSpaces (string a) {return a.Replace ( '', '-'); }
public string ReplaceHyphens (string a) {return a.Replace ( '-', '*'); }
public static void Main ()
{ string str = System.Console.ReadLine();
strMod strOp = new strMod (Test.ReplaceSpaces);
str = strOp (str);
strOp = new strMod (new Test(). ReplaceHyphens);
str = strOp (str);
System.Console.WriteLine (strOp (str));
}
Користувач збирається після запуску програми ввести фразу ОЧЕНЬ ПРОСТОЙ ТЕСТ. Вкажіть результат виведення на консоль після спроби запустити програму на компіляцію і виконання:
C# oop_class
class D { рublic delegate double F (double x);}
class A { рublic int F (int x) {return x * x; }}
class B { рublic static double F (double x) {return x * x; }}
class Program
{
static void Main ()
{
______________;
System.Console.WriteLine (f ( 1 ) );
}
}
Серед перерахованих нижче кодів вкажіть код, підстановка якого замість знаків підкреслення дозволяє отримати коректну програму, вирішальну це завдання:
C# oop_class
C# oop_class
class Class
{
private int x, y;
public Class (int x, int y) {this.x = x; this.y = y; }
public static Class operator ++ (Class a)
{return new Class (ax, ay + 1);}
public void View()
{ System.Console.Write ( "{0} {1}", x, y);}
}
У класі Program визначено метод Main , в тілі якого знаходиться код:
Class a = new Class (2,3), b;
b = ++ a;
b.View(); a.View();
Вкажіть результат виведення на консоль після виконання методу Main():
C# oop_class
class A
{
private static int b;
public static int B
{get {return b * b; } set {b = value; }}
}
public class Test
{
public static void Main ()
{
A a = new A();
a.B = 5;
System.Console.Write (a.B);
}
}
Метод Main розроблявся для виведення квадрата числа 5.
Трансляція програми завершена невдало. З наведених висловлювань вкажіть висловлювання, яке розкриває причину некоректності програми:
C# oop_class
class A
{ рrotected int x = 123; }
class B: A
{
static void Main ()
{A a = new A();
int i = ax = 10;
B b = new B();
int j = bx = 20;
System.Console.Write ( "ax = {0} bx = {1}", i, j);
}
}
Вкажіть результат виведення на консоль після спроби запустити програму на компіляцію і виконання:
C# oop_class
C# oop_class