Friday, December 14, 2012

To work with grid as tooltip in grid on mouse over of a cell, without using java script or Rad controls


We can achieve this using Ajax HoverMenuExtender & OnRowDataBound Event of Gridview


In  .aspx page:Use TemplateField in the Base Gridview as below:


<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" EnableModelValidation="True"
                    OnRowDataBound="GridView2_RowDataBound">
                    <Columns>
                        <%--<asp:BoundField HeaderText="MenuId" DataField="MenuId" />--%>
                        <asp:BoundField HeaderText="MenuName" DataField="MenuName" />
                        <asp:BoundField HeaderText="MenuRefID" DataField="MenuRefID" />
                        <asp:BoundField HeaderText="MenuUrl" DataField="MenuUrl" />
                        <asp:TemplateField HeaderText="Menu ID">
                           <ItemTemplate>
                                <asp:LinkButton ID="LinkButton1" runat="server" Text='<%# Eval("MenuId") %>'>LinkButton</asp:LinkButton>
                                <asp:HoverMenuExtender ID="HoverMenuExtender1" runat="server" TargetControlID="LinkButton1"
                                    PopupControlID="Panel2" PopupPosition="Right" OffsetX="0" OffsetY="0" PopDelay="50">
                                </asp:HoverMenuExtender>
                                <asp:Panel ID="Panel2" runat="server">
                                    <asp:GridView ID="GridView3" runat="server">
                                    </asp:GridView>
                                </asp:Panel>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>


In Code-Behind:

protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            DataRowView dr = (DataRowView)e.Row.DataItem;

            GridView secondGrid = (GridView)e.Row.FindControl("GridView3");
            DataTable dtForSecondGrid = new DataTable(); //here you populate this table with values by passing the key 'menuid'
            SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["con"].ToString());
            string str = "Select * from MenuDetails where MenuId="+menuId;
            SqlDataAdapter da = new SqlDataAdapter(str, con);
            da.Fill(dtForSecondGrid);
            secondGrid.DataSource = dtForSecondGrid;
            secondGrid.DataBind();
        }
    }

Wednesday, November 28, 2012

Imp java Servlet qns

Question 1: In web.xml file   <load-on-startup>1</load-on-startup> is defined between <servlet></servlet> tag what does it means.

Ans: whenever we request for any servlet the servlet container will initialize the servlet and load it which is defined in our config file called web.xml by default it will not initialize when our context is loaded .defining like this <load-on-startup>1</load-on-startup> is also known as pre initialization of servlet means now the servlet for which we have define this tag has been initialized in starting when context is loaded before getting any request.

Question 2: How can we create deadlock condition on our servlet?

Ans: one simple way to call doPost() method inside doGet() and doGet()method inside doPost() it will create deadlock situation for a servlet.

Question 3: For initializing a servlet can we use constructor in place of init ().

Ans: No, we can not use constructor for initializing a servlet because for initialization we need an object of servletConfig using this object we get all the parameter which are defined in deployment descriptor for initializing a servlet and in servlet class we have only default constructor according to older version of java so if we want to pass a
Config object we don’t have parametrized constructor and apart from this servlet is loaded and initialized by container so ots a job of container to call the method according to servlet specification they have lifecycle method so init() method is called firstly.

More important Java doesn't allow interfaces to declare constructors. These kinds of servlet interview questions are quite popular on service based companies who just want to dig one level more.

Question 4: Why super.init (config) wiil be the first statement inside init(config) method.

Ans: This will be the first statement if we are overriding the init(config ) method by this way we will store the config object for future reference and we can use by getServletConfig ()  to get information about config object if will not do this config object will be lost and we have only one way to get config object because servlet pass config object only in init method . Without doing this if we call the servletConfig method will get NullPointerException.

Question5: Can we call destroy() method inside the init() method is yes what will happen?

Ans:Yes we can call like this but  if we have not override this method container will call the default method and nothing will happen.after calling this if any we have override the method then the code written inside is executed.

Question 6: How can we refresh servlet on client and server side automatically?

Ans: On client side we can use Meta http refresh and server side we can use server push.

Question 7: How can you get the information about one servlet context in another servlet?
Ans: In context object we can set the attribute which we want on another servlet and we can get that attribute using their name on another servlet.
Context.setAttribute (“name”,” value”)
Context.getAttribute (“name”)

Question 8: Why we need to implement Single Thread model in case of Servlet.

Ans: In J2EE we can implement our servlet on two different ways either by using:
1. Single Thread Model
2. Multithread Model
Depending upon our scenario, if we have implemented single thread means only one instance is going handle one request at a time no two thread will concurrently execute service method of servlet.
Example in banking account where sensitive data is handle mostly this scenario was used this interface is deprecated in Servlet API version 2.4.

As the name signifies multi thread means a servlet is capable to handle multiple requests at same time. This servlet interview question was quite popular few years back on entry level but now its loosing its shine.

Question 9: what is servlet collaboration?
Ans: communication between two servlet is called servlet collaboration which is achieved by 3 ways.
1. RequestDispatchers include () and forward() method .
2. Using sendRedirect()method of Response object.
3. Using servlet Context methods


Question 10: What is the difference between ServletConfig and ServletContext?

Ans: ServletConfig as the name implies provide the information about configuration of a servlet which is defined inside the web.xml file or we can say deployment descriptor.its a specific object for each servlet.

ServletContext is application specific object which is shared by all the servlet belongs to one application in one JVM .this is single object which represent our application and all the servlet access application specific data using this object.servlet also use their method to communicate with container.





Monday, November 19, 2012

How to develop a JDBC Application

The following are the steps to develop java appn to communicate with db server:

1. Register the JDBC driver.

2. Get the connection from db server

3. Create the Statement object to send the sql queries to db server.

4. Execute the query.

5. Close the connection.

For JDBC appn there are 2 different packages are ther

Java.Sql  ----- Interfaces
Driver, Connection, Statement, PreparedStatement, CallableStatement, ResultSet, ResultSetMetadata, DatabaseMetadata

Java.Sql ------Classes
DrverManager, Types,Date


Javax.sql------ Interfaces
DataSource,RowSet

When will be the class is loaded into JVM's memory

In the following 4 scenarios class is loaded into JVM's memory.

1. When we create an object
2. when we call JVM
3. When we access Static variables
4. when we acces static methods.


How to Organize the files in a project and how to deliver it to customer

To Organize the files in a java project:


To deliver the project to the customer, we use the following formats:

1. Jar(Java Archive) - For standalone appns

2. War (Web Archive) - For Webbased appns (ie Servlets & JSPs)

3. EAR ( Enterprize Archive) - For Enterprize appns  ( ie EJBs & Spring)

To create JAR or WAR files:

Class files path> jar -cvf  filename. Extension   ( The externsion may be jar or war as per our requirement)

To Extract JAR or WAR files:

Class files path> jar -xvf  filename. Extension   ( The externsion may be jar or war as per our requirement)

Difference between Interface and abstract class

Interface should contain all methods are "abstract".
Abstarct class may or may not contain abstract methods, concrete methods

Some Super class and sub class concepts(Polymorphism)

I f


 Some Valid obect creation....

Cone c1= new Cone();
Ctwo c2= new Ctwo();
Cone c= new Ctwo();
Object O= new Cone();
Object o= new Ctwo();


This is somewhat called as polymorphism

But from Cone object we cant access the CTwo class methods . To access the CTwo class methods,
we have to typecaste  COne object into CTwo object

Ctwo c2= (CTwo)c1;

Thursday, August 23, 2012

ASP: Gridview Sorting

 protected void RG_ItemNameSearch_sorting(object sender, GridViewSortEventArgs e)
    {
        string sortingDirection = string.Empty;
        if (dir == SortDirection.Ascending)
        {
            dir = SortDirection.Descending;
            sortingDirection = "Desc";
        }
        else
        {
            dir = SortDirection.Ascending;
            sortingDirection = "Asc";
        }
        DataTable dt = new DataTable();
        dt.Columns.Add(new DataColumn("SNO", typeof(System.Int32)));
        dt.Columns.Add(new DataColumn("MaterialId", typeof(System.Int64)));
        dt.Columns.Add(new DataColumn("MaterialAbbr", typeof(System.String)));
        dt.Columns.Add(new DataColumn("MaterialName", typeof(System.String)));
        dt.Columns.Add(new DataColumn("UnitId", typeof(System.Int64)));
        dt.Columns.Add(new DataColumn("UnitName", typeof(System.String)));
        dt.Columns.Add(new DataColumn("SaleUnitNumbers", typeof(System.Int32)));
        dt.Columns.Add(new DataColumn("SalePrice", typeof(System.Decimal)));
        dt.Columns.Add(new DataColumn("PurchaseUnit", typeof(System.Int64)));
        dt.Columns.Add(new DataColumn("BatchNo", typeof(System.String)));
        dt.Columns.Add(new DataColumn("SALEQTYOFSU", typeof(System.Int32)));
        dt.Columns.Add(new DataColumn("SALEQTYOFPU", typeof(System.Int32)));
        List<MaterialDetailsSearch> lstMaterialDetailsSearch = new List<MaterialDetailsSearch>();
        if(Session["MaterialsSearch"]!=null)
            lstMaterialDetailsSearch = (List<MaterialDetailsSearch>)Session["MaterialsSearch"];

        if (lstMaterialDetailsSearch != null && lstMaterialDetailsSearch.Count > 0)
        {
            foreach (MaterialDetailsSearch objMaterialDetailsSearch in lstMaterialDetailsSearch)
            {

                DataRow row = dt.NewRow();
                //  row[0] = objInvGrnReturnDetails.MaterialId;
                row[1] = objMaterialDetailsSearch.MaterialId;
                row[2] = objMaterialDetailsSearch.MaterialAbbr;
                row[3] = objMaterialDetailsSearch.MaterialName;
                row[4] = objMaterialDetailsSearch.UnitId;
                row[5] = objMaterialDetailsSearch.UnitName;
                row[6] = objMaterialDetailsSearch.SaleUnitNumbers;
                row[7] = objMaterialDetailsSearch.SalePrice;
                row[8] = objMaterialDetailsSearch.PurchaseUnit;
                row[9] = objMaterialDetailsSearch.BatchNo;
                row[10] = objMaterialDetailsSearch.SALEQTYOFSU;
                row[11] = objMaterialDetailsSearch.SALEQTYOFPU;
                dt.Rows.Add(row);

            }

        }
        DataView sortedView = new DataView(dt);
        sortedView.Sort = e.SortExpression + " " + sortingDirection;
        RG_ItemNameSearch.DataSource = sortedView;
        RG_ItemNameSearch.DataBind();
    }
    public SortDirection dir
    {
        get
        {
            if (ViewState["dirState"] == null)
            {
                ViewState["dirState"] = SortDirection.Ascending;
            }
            return (SortDirection)ViewState["dirState"];
        }
        set
        {
            ViewState["dirState"] = value;
        }
    }

Monday, July 16, 2012

when I have server Problem like...


Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500


To resolve this, set the validateRequest attribute of the Page directive to false ValidateRequest=”false” 

Even if it is solved by this then we have to change in web.config file by

    <add key="aspnet:MaxHttpCollectionKeys" value="2000" />

Friday, June 8, 2012

To find the tables list in current db

 SELECT * FROM INFORMATION_SCHEMA.TABLES..


Note: INFORMATION_SCHEMA is base to find the tables, columns, views, constraints, etc

Something about JDBC

1. How to communicate with data base?
(A) To connect to data base we have set of interfaces provided by Java.sql.*; First you need to load JDBC driver and then Make JDBC connection.

2. What are the different types of database drivers?
(A) Four types of drivers available
Type -1: (JDBC-ODBC Bridge Driver)
In this type, you have java API which talks to a native API (JDBC-ODBC Driver) which then talks to a database.
Type-2 (Thick/Native driver)
In this type, you have a native API which talks to a Database.
Type-3 (Network protocol driver)
It`s a three tier architecture, the client talks to server with network protocol diver and server uses any one from other three type of drivers. This type of driver is used when lot of concurrency can be done.
Type-4 (Pure or Thin Driver)
It`s complete Java API which talk to a Database, this is most often used driver.

3. How to Load the driver?
(A) Use Class.forName(), forName() is a method in Class which returns a class object, to the forName() you provide a string parameter that is the Class that you want to load. To load the Class you need to provide total path including package.
For type-1 Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”);
For type-2 using Oracle database Class.forName(“oracle.jdbc.driver.OracleDriver”);

4. How to fetch the connection?
(A) Connection is the interface in Java.sql package.
For Type-1
Connection con=DriverManager.getConnection(“jdbc:odbc:[odcb dsn]“:”username”:”password”);

5. What is a ResultSet ?
(A) ResultSet is a Java Object, it contains the results of executing an SQL query. In other words it is a table of data representing a database result set, which is usually generated by executing a statement that queries the database.
Sample : ResultSet rs = stmt.executeQuery(“SELECT a, b, c FROM Table1″);

6.  What do you mean by fastest type of JDBC driver?
(A) JDBC driver performance or fastness depends on a number of issues: Quality of the driver code, size of the driver code, database server and its load, Network topology, Number of times your request is translated to a different API.

Today I found a solution to check a column existing in the table or not :)

In SQL Server:

 SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'MyTableName' AND COLUMN_NAME = 'MyColumnName'


In Oracle:

SELECT * FROM user_tab_columns
WHERE table_name = '<tablename>'
AND column_name = '<columnname>

Wednesday, February 15, 2012

Dotnet


What is the difference between login controls and Forms authentication?
  • Forms authentication can be easily implemented using login controls without writing any code.
  • Login control performs functions like prompting for user credentials, validating them and issuing authentication just as the FormsAuthentication class.
  • However, all that’s needs to be dne is to drag and drop the use control from the tool box to have these checks performed implicitly.
  • The FormsAuthentication class is used in the background for the authentication ticket and ASP.NET membership is used to validate the user credentials.
What is Fragment Caching in ASP.NET?
  • Fragment caching refers to the caching of individual user controls within a Web Form.
  • Each user control can have independent cache durations and implementations of how the caching behavior is to be applied.
  • Fragment caching is useful when you need to cache only a subset of a page.
  • Navigation bars, header, and footers are good candidates for fragment caching.
What is partial classess in .net?
When there is a need to keep the business logic separate from the User Interface or when there is some class which is big enough to have multiple number of developers implement the methods in it, the class can be separated and written in different files as partial class.
The keyword partial must appear in each class.
//syntax for C#
Public partial class MyPartialClass1
{
//code
}
// this code could be in file1
Public partial class MyPartialClass1
{
//code
}
// this code could be in file2
Explain how to pass a query string from an .asp page to aspx page?
Consider the following URL:
http:// localhost/form.aspx?param1=career&param2=ride
This html addresses use QueryString property to pass values between pages.
From the URL above the information obtained is:
form.aspx: which is the destination page for your browser.
Param1 is the first parameter, the value of which is set to career
Param2 is the first parameter, the value of which is set to ride
The ‘?’ marks the beginning of the QueryString
‘&’ is used as a separator between parameters.
private void formButtonSubmit_Click(object sender, System.EventArgs e)
{
Response.Redirect("form.aspx?Param1=" +
this.formTextfieldParam1.Text + "&Param2=" +
this. formTextfieldParam2.Text);
}
The above code is a submit button event handler and it sends the values of the query string to the second page.
The following code demonstrates how to retrieve these valus on the second page:
private void Page_Load(object sender, System.EventArgs e)
{
this.form2TextField1.Text = Request.QueryString["Param1"];
this. form2TextField2.Text = Request.QueryString["Param2"];
}

You can also use the following method to retrieve the parameters in the string:

for (int i =0;i < Request.QueryString.Count;i++)
{
Response.Write(Request.QueryString[i]);
}
What is a ViewState?
  • If a site happens to not maintain a ViewState, then if a user has entered some information in a large form with many input fields and the page is refreshes, then the values filled up in the form are lost.
  • The same situation can also occur on submitting the form. If the validations return an error, the user has to refill the form.
  • Thus, submitting a form clears up all form values as the site does not maintain any state called ViewState.
  • In ASP .NET, the ViewState of a form is maintained with a built-in state management technique keeps the state of the controls during subsequent postbacks by a particular user.
  • The ViewState indicates the status of the page when submitted to the server. The status is defined through a hidden field placed on each page with a <form runat="server"> control.
    <input type="hidden" name="__VIEWSTATE" value="CareerRide">
  • The ViewState option can be disabled by including the directive <%@ Page EnableViewState="false"%> at the top of an .aspx page
  • If a ViewState of a certain control has to be disabled, then set EnableViewState="false".
What is ViewState? Explain its benefits and limitations.
Viewstate is used to maintain or retain values on postback. It helps in preserving a page. Viewstate is internally maintained as a hidden field in encrypted form along with a key.
Advantages:
i) No server resources.
ii) Viewstate ensures security because it stores the data in encrypted format.
iii) Viewstates are simple. They are used by enabling or disabling the viewstate properties.
iv) It is based on the wish of developer that they want to implement it at the page level or at control level.
Disadvantages:
i) If large amount of data is stored on the page, then page load might cause a problem.
ii) Does not track across pages. Viewstate information does not automatically transfer from page to page.
Difference between src and Code-Behind
With the ‘src’ attribute, the source code files are deployed and are compiled by the JIT as needed.
Though the code is available to everyone with an access to the server (NOT anyone on the web), this method is preferred as it does away with the compilation of the DLLs.
‘CodeBehind’ attribute just has the VS.NET associate the code file with the aspx file. This is necessary since VS.NET automates the pre-compiling that is harder by hand.
Due to this the ‘Src’ attribute is done away with having only a DLL to be deployed enhancing the protection level even though it can be decompiled.
What is the difference between URL and URI?
A URL (Uniform Resource Locator) is the address of some resource on the Web. A resource is nothing but a page of a site. There are other type of resources than Web pages, but that's the easiest conceptually.
A URI is a unique identifier to usually a namespace.
Though it looks like a URL but it doesn’t have to necessarily locate any resource on the web.
URI is a generic term. URL is a type of URI.
What is the Pre-Compilation feature of ASP.NET 2.0?
Previously, in ASP.NET, the pages and the code used to be compiled dynamically and then cached so as to make the requests to access the page extremely efficient. In ASP.NET 2.0, the pre-compilation feature is used with which an entire site is precompiled before it is made available to users.
There is a pre-defined folder structure for enabling the pre-compilation feature:
  • App_Code: stores classes
  • App_Themes: stores CSS files, Images, etc.
  • App_Data: stores XML files, Text Files, etc.
  • App_GlobalResources: stores all the resources at global level E.g. resx files, etc
  • App_LocalResources: stores all the resources at local/Page level
How can we create custom controls in ASP.NET?
Custom controls are user defined controls. They can be created by grouping existing controls, by deriving the control from System.Web.UI.WebControls.WebControl or by enhancing the functionality of any other custom control. Custom controls are complied into DLL’s and thus can be referenced by as any other web server control.
Basic steps to create a Custom control:
1. Create Control Library
2. Write the appropriate code
3. Compile the control library
4. Copy to the DLL of the control library to the project where this control needs to be used
5. The custom control can then be registered on the webpage as any user control through the @Register tag.
What is an application domain?
It's a way in CLR to maintain a boundary between various applications to ensure that they do not interfere in working of any other application. CLR acts as a mini operating system where a single process may have various application domains.
Explain the concepts of application domain.
  • An operating system process can have many ongoing application domains. Application Domains keep an application separate.
  • All objects created within the same application scope are created within the same application domain.
  • Multiple application domains can exist in a single operating system process,
  • Distinct memory address space allocation by the OS is effective but expensive and it does not satisfy to the numbers required for large web servers.
  • However, the CLR isolates an application by managing the memory use of code running within the application domain due to which the code cannot access memory outside the boundaries of the domain.
Explain the two different types of remote object creation mode in .NET.
Ways in which object can be created using Remoting: -
SAO Server Activated Object (call mode): lasts the lifetime of the server. They are activated as SingleCall/Singleton objects. It makes objects stateless. A SingleCall object gets created for each request by client and A Singleton object is created once on the server and is shared by all the clients.
CAO (Client Activated Objects): CAO creates stateful objects. The object creation request is based on the request by client side. Therefore, the lifetime is based on client and not server. Single instance of object is created for every call.
Describe SAO architecture of Remoting.
Remoting has at least three sections:-
1. Server
2. Client: This connects to the hosted remoting object
3. Common Interface between client and the server .i.e. the channel
Remoting takes an indirect approach to application domain communication by creating proxy objects. Communication is performed as below:
a. When a client object wants to create an instance of the server object, the remoting system at the client creates a proxy of the server object. The proxy object is at the client but behaves exactly like the remote object i.e. the server object.
b. The proxy passes the call information to the remoting system on the client. Client remoting system then sends the information to the remoting system on the server which then invokes the actual method on the server object. The remoting system on the server then passes the result information back to the client remoting system.
c. The client remoting system returns the results to the client object through the proxy.
Explain Singleton architecture of Remoting.
Singleton architecture is to be used when all the applications have to use or share same data.
Define LeaseTime, SponsorshipTime, RenewOnCallTime, LeaseManagePollTime.
Terms related to lifecycle of a remoting object.
The LeaseTime property protects the object so that the garbage collector does not destroy it as remoting objects are beyond the scope of the garbage collector. Every object created has a default leasetime for which it will be activated. Once the leasetime expires, the object is eligible again for garbage collector and is eventually destroyed. Default value is 5 minutes.
Even though the leasetime of an object has expired, there still may be clients who would still need the remoting object on the server. In such cases the leasemanager keeps a track of such clients and asks them if they need the object and are ready to extend or sponsor the object to extend its existence. This is done through SponsorshipTime property, which is then based on the sponsor.
The RenewOnCallTime property defines the duration for which a remoting object's lease is extended if a sponsor is found. The default value is 2 minutes.
The LeaseManager class has a property PollTime, which defines the frequency at which the LeaseManager polls the leases. Default is 10 seconds.
Briefly explain how to specify remoting parameters using config files.
The remoting parameters can be specified through both programming and in config files. All the settings defined in config files are placed under <system.runtime.remoting>
<application> is placed under system.runtime.remoting but the name attribute of application tag specifies if the parameter is for server or client. RemotingConfiguration.Configure is used to access the configuration keys for remoting properties.
What is marshalling? Explain types of marshalling.
Marshaling is a process of transforming or serializing data from one application domain and exporting it to another application domain.
Two types of marshalling
  • Marshal by value: a copy of an object is created by the server and is passed and used by the client.
  • Marshal by reference: the client creates a proxy to access the object.
What is ObjRef object in remoting?
ObjRef is a searializable object returned by Marshal() that knows about location of the remote object, host name, port number, and object name.
Explain the steps of acquiring a proxy object in web services.
  • Client communicates to UDI node to retrieve a list of available web services that the client has access to.
  • Every service listed has a URI pointing to the service's DISCO or WSDL document, which is needed to access the webservice and its 'webmethod" methods.
  • After interpreting the DISCO document, follow the URI for the WSDL document related to the chosen webservice.
  • Client then adds and parses the WSDL document and creates a proxy object which can then communicate with Webservice and access its "webmethod" methods.
Explain the steps to create a web services and consume it.
Steps to create and consume a webservice
Creation:
  • a. Create a new website by selecting "ASP.NET Web Site" and giving it a suitable name.
  • b. service.cs file appears inside the solution with a default webmethod named as "HelloWorld()"
  • c. Right click on the webservice project and add a web reference instead of adding a normal reference.
  • d. A window appears that displays a list of webservices knows to the solution.
  • e. Click on "Webservices in this solution"
  • f. a search progress bar appears and
  • g. Select the service that appears in the list
  • h. progress bar appears once again.
  • i. web method appears on the screen
  • j. Click on "Add reference" button. This would add localhost
  • k. solution would have App_WebReference folder
Consumption or Usage:
  • a. Add a UI (.aspx) to the webservice project
  • b. Add a button and a label to the form
  • c. Double click the button to see the click event of the button
  • d. Create an object of type service localhost.serviceName
  • e. Write code to display the value returned by the webmethod on the label
  • f. Execute the solution by setting the added aspx as the startpage.
  • g. click on the button and the message "Hello World" would be displayed on the label

Easy questions:
  • What's the difference between a class and a struct?
  • Is System.String a class or a struct (or reference or value type if you prefer).
  • Explain IDisposable and the 'using' statement.
  • Explain public, protected, private, and internal.
Intermediate questions:
  • What's the difference between Hashtable and Dictionary<>?
  • What does int? mean? Explain the relationship with Nullable.
Hard questions:
  • Explain the following snippet of code: 'from x in collection select new { x.Foo }'. What is the compiler doing? What is the CLR executing?
  • Explain the "yield" keyword. What is the compiler doing internally?


Q:1.What is code access Security ?
A1. code access Security is a way to restrict of resources and operation where we can access or not .
Q:2.what is the work of CLR (Common language Run time)?
A2.work of CLR (Common language Run time) are Gar base collection , convert programming code to intermediate language Code(managed code) ,multiple language integration
Q:3.Tell me about your product and how many tier application it has ?
A3.Tell me about your product ? how many tier application it has ?
i tell about my export project and it is three tier application
Q:4.tell about application domain ?
Q:5.How Dot net interact with com component ?
A:5.Dot net interact with com component using RCW (Run time scramble wrapper )
Q.6.what are oops concept ?
A.6.oops concept :encapsulations ,inheritance ,abstractions ,polymorphism

Q:7.what is inheritance ?
A:7.inheritance is way to reuse code you just create a base class and this code also use in derived classes .

Q:8.


class A
function T1()
//msgbox( class A T1 )
end function
End class

class B inherits class A
function T1()
//msgbox( class B T1 )
end function
End class

now what is the output of or which class method t1 is called
A obj=new B
A.T1()
A:9 output of or A class method T1 is called because A is native object .(i think wrong one )
Q:9.what are delegates how you use it ?
A:9. A delegate is a type references a method. Once a delegate is assigned a method, it behaves exactly like that method.
Q:10.what are normalization ?
A:10.decomposition of one table schema into smaller schema so that no data redundancy , and anomaly can remove .
Q:11.what is data reader ?
A:11.data reader read data sequential and forward method . read one record at a time .
Q:12.what is difference between data table copy and clone ?
A:12.between data table copy and clone , in copy copy complete data table data and schema but in clone just copy schema

Q:13.Suppose 2 Tables A and B , b has one column (FK of A table dentity column) now Firstly i insert data in table A then B how i find what value i insert in table B (How i find identity column value) ?
A:13.using Trigger !

Q:14.what are constructor can we create private constructor ?


A:14.yes we can create private constructor .