Pregunta de entrevista de Luxoft

1. Explain HTTP protocol verbs other than GET and POST. :-O 2. How to initialize some public property in an ASP.Net MVC Controller, which depends on some currently processing request's parameter. 3. Three blocks (div) on a page with CSS "float" property set to "left" and three questions: a) how blocks will behave b) If we add another block with no styles - how it will be arranged on the page among other blocks c) WHY(!!!) float property works so? 4. Provide javascript code of class initialization. How to implement private method in javascript. And you are supposed to dictate the exact code via phone for all that stuff!!!

Respuestas de entrevistas

Anónimo

2 oct 2013

1. PUT, DELETE, HEAD and so on. Yes, and be prepared to describe each in detail. ;( 2. Of course you cannot do that through an action filter. I suppose they wanted to hear about the overriden Controller.Initialize() method, which I sadly never used.. :( 3. I answered correcly about the behaviour, but I had no idea WHY it works so. 4. I answered almost correclty. :) The problem was with the private method - I rememeber that it can be easily done through closures, but couldn't provide the exact code quickly.

Anónimo

18 oct 2013

2. Initialize() method is more preferable, but you CAN do it through an ActionFilter too. But you will need to deal with Reflection. Example: Let's Assume that we have "protected string SomePropertyInController {get; set;}" in our Controller. public override void OnActionExecuting(ActionExecutingContext actionExecutingContext) { var someParamValueFromRequest = actionExecutingContext.HttpContext.Request["SomeParamFromRequest"]; if (!String.IsNullOrEmpty(id)) { var controller = actionExecutingContext.Controller; var info = controller.GetType().GetProperty("SomePropertyInController", BindingFlags.Instance | BindingFlags.NonPublic); if (info != null) info.SetValue(controller, someParamValueFromRequest, null); } }