logo

Crowdly

Browser

Add to Chrome

Основи розробки програмного забезпечення на платформі Microsoft.NET

Looking for Основи розробки програмного забезпечення на платформі Microsoft.NET test answers and solutions? Browse our comprehensive collection of verified answers for Основи розробки програмного забезпечення на платформі Microsoft.NET at do.ipo.kpi.ua.

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

public class RateLimitDecorator : IApi

{

private readonly IApi _inner;

private readonly TokenBucket _bucket;

public RateLimitDecorator(IApi a, int m) => (_inner, _bucket) = (a, new TokenBucket(m));

public Response Call(string ep)

=> _bucket.Take() ? _inner.Call(ep) : Response.TooManyRequests();

}

Що спільного у всіх Decorator’ів?

100%
0%
0%
0%
View this question

public interface INode { int Size(); }

public sealed class FileLeaf : INode

{

private readonly int _bytes;

public FileLeaf(int bytes) => _bytes = bytes;

public int Size() => _bytes;

}

public sealed class FolderComposite : INode

{

private readonly List

_children = new();

public void Add(INode n) => _children.Add(n);

public int Size() => _children.Sum(c => c.Size());

}

Який патерн ілюструє цей код?

0%
0%
100%
0%
View this question

var buffer = new ArrayBufferWriter<byte>();

using (var w = new Utf8JsonWriter(buffer, new JsonWriterOptions { Indented = true }))

{

    w.WriteStartArray();

    w.WriteNumberValue(1);

    w.WriteEndArray();

}

System.Console.WriteLine(System.Text.Encoding.UTF8.GetString(buffer.WrittenSpan).Count(c => c=='\n'));

0%
0%
0%
0%
View this question

Патерн Посередник (Mediator) реалізує зв'язок

100%
0%
View this question
Що виведе згенерований код?

var list = new[] { "ab", "abc", "abcd" };

var len = list.Select(s => s.Length).Where(l => l > 2).Max();

]]>
100%
0%
0%
0%
View this question

public Report Build()

{

if (_sections.Count == 0)

throw new InvalidOperationException("Report must have at least one section");

return _report;

}

Що демонструє ця перевірка в Build()?

100%
0%
0%
0%
View this question

public class Const : Expr

{

public int Value { get; }

public Const(int v)=>Value=v;

public override int Eval(Context _) => Value;

}

Чому Context ігнорується у Const.Eval?

100%
0%
0%
0%
View this question
Що виведе згенерований код?

var data = new[] { "abc", "de", "fghi" };

var query = data.Where(s => s.Contains("e") || s.Contains("g")).OrderByDescending(s => s.Length).First();

]]>
0%
0%
0%
0%
View this question

public sealed class Singleton

{

private static Singleton instance;

private Singleton() { }

public static Singleton Instance

{

get

{

if (instance == null)

instance = new Singleton();

return instance;

}

}

}

Яку проблему має цей код?

0%
0%
0%
100%
View this question

public class Macro : ICommand

{

private readonly IReadOnlyList

_list;

public Macro(params ICommand[] cmds) => _list = cmds;

public void Execute() => _list.ToList().ForEach(c => c.Execute());

}

Правильне твердження:

0%
0%
0%
0%
View this question

Want instant access to all verified answers on do.ipo.kpi.ua?

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

Browser

Add to Chrome