Question d’entretien chez EPAM Systems

Started with Basic C# questions, than 1) How to implement the Prototype Pattern. 2) How to implement Template Pattern. 3) How to implement Decorator Pattern. 4) How to implement the versioning of Web Api. 5) Difference between Transient,Scoped and Singletone service in Asp.net core. 6) Explain SOLID principle with example. 7) Difference between IQueryable and IEnumerable. 9) Difference between First() and Single() , linq question. 10) Write a code to calculate the sum of price Different flowers using LSP solid principle. for example: The user will provide flower quantity, and price, input in form of List, (10 lilly , 20 roses, 30 lotus)

Réponse à la question d'entretien

Utilisateur anonyme

11 mai 2022

The answer for coding problem should be following: public class Flower { public int price; public int quantity; public virtual int getCost() { return price * quantity; } } public class Rose:Flower { } public class Lily:Flower { } class Program { static void Main(string[] args) { int totalCost = 0; var flowerObj = new List() { new Rose(){price=10,quantity=5}, new Lily(){price=20,quantity=10}, }; foreach(var o in flowerObj) { totalCost += o.getCost(); } Console.WriteLine(totalCost); } }