You will be asked to code on paper 3 scenarios 1) Generate a TinyUrl application 2) Generate a method to determine if a word is Palindrome (i.e. Abba or Eye) 3) Generate two class models for two related classes (in memory not DB) , one will hold a Merchant (or some other user's) details and the other class will hole the Stores owned by the merchant. How would you store the data in a session (Application if Web or Cache if desktop) How would you find the Merchants of a particular Name How would you find the stores belonging to a particular Merchant How would you find the stores belonging to a particular Merchant and those stores are in a particular city 4) Given an array of ints, write a C# method to total all the values that are even numbers.
Sigiloso
1) Use a WEB API for the CRUD actions - insert url into DB and use identity key converted to ToBase64 as the tinyUrl 2) Create a recursive method called IsPalindrome (string word = "") that returns a bool. Because you are defaulting the Null word to an empty string, you do not have to test for NULL, just word.Trim().IsNullOrEmpty() and return false; Return true when length of word is 1. Convert the word to Char{} and determine if the first and last characters are the same, if not - return false if the first and last are the same remove (firsta nd last chars) - if no chars left - return true; If Chars left, convert Char[] back to string and call method again. 3) Use Linq\Lambda to filter Merchant and stores List merchant = new List(); var results = merchant.AsEnumerable().Where(mer => mer.MerchantID == 100 && mer.stores.Any(str => str.StoreType == StoreType.Chinese)).ToList(); using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace WebApplication1 { public class Merchant { public Merchant() { // default properties or override ctor that takes properties } public int MerchantID { get; set; } public string MerchantName { get; set; } public string MerchantAddress { get; set; } public StoreType MerchantType { get; set; } List stores = new List(); } public class Store { public Store() { } public int StoreID { get; set; } public string StoreAddress { get; set; } public StoreType StoreType { get; set; } public string StoreCity { get; set; } } public enum StoreType { Chinese, Burgers, Tacos } }