Interview question

An extension method is a special kind of static method that allows you to add new methods to existing types without creating derived types.

IOC– purpose ot to implement loosely coupled sys. We have to ensure that high-level modules depend on abstractions rather than concrete implementations of lower-level modules.

Dependency Injection (DI) is a software design pattern that allow us to develop loosely coupled code. Its like a part of IOC. We can implement in (Constructor Injection, Property injection, Method injection)

Strong Reference – As long as if application refers to the object. GC will not collect those objects. Those objects we say are strong reference objects.

Weak Reference – Even though application refers to the object, GC may collect those object or may not be. Those objects are weak referenced objects.


Returning JSON data to view in MVC

Below was the code to return data to the view

Code inside controller :

 public class SampleController : Controller

public class Products
            public int ProductId { set; get; }
            public string ProductName { set; get; }

        public JsonResult GetJsonData()
             var list = new List<Products>();
                list.Add(new Products { ProductId = 1, ProductName = “P1” });
             list.Add(new Products { ProductId = 2, ProductName = “P2” });
             list.Add(new Products { ProductId = 3, ProductName = “P3” });
             list.Add(new Products { ProductId = 4, ProductName = “P4” });
             return list;


Code inside javascript :


    function GetData()
            contentType: ‘application/json; charset=utf-8’,
            type: “POST”,
            url: ‘http://localhost:51798/Sample/GetJsonData&#8217;, // Make sure to change the port number here
            dataType: “json”,// Make sure that the datatype is json
            success: function (data) {
        for(var i=0;i<data.length;i++)
                   console.log(data[i]. ProductName);





$(MSBuildBinPath)\msbuild.exe “$(ProjectDir)build.xml” /p:TargetDir=”$(TargetDir)


<?xml version=”1.0″ encoding=”utf-8″?>
<Project xmlns=”″&gt;
<UsingTask TaskName=”CssCompressorTask” AssemblyFile=”$(TargetDir)Yahoo.Yui.Compressor.Build.MsBuild.dll” />
<UsingTask TaskName=”JavaScriptCompressorTask” AssemblyFile=”$(TargetDir)Yahoo.Yui.Compressor.Build.MsBuild.dll” />
<Target Name=”Minify”>
<CssFiles1 Include=”css\main.css”/>
<JavaScriptFiles1 Include=”JS\login.js”/>
<CssCompressorTask SourceFiles=”@(CssFiles1)” OutputFile=”css\main.min.css” />
<JavaScriptCompressorTask SourceFiles=”@(JavaScriptFiles1)” OutputFile=”JS\login.min.js” />

HTML5 Application Cache

What is Application Cache?

HTML5 introduces application cache, which means that a web application is cached, and accessible without an internet connection.

Advantages of Application Cache

  1. Offline Browsing:- Users can access the application in offline i.e when the internet disconnects suddenly.
  2. Speed:- Cached resources/ files always faster than the normal files.
  3. Reduced Server Load:- Browsers will load the cached files first, if the file version was different with the server/ the specified file was not available on cache then it will download from the server.

Application cache plays major role in Mobile Web Applications, online exam portals etc…