You must Sign In to post a response.
  • Category: General

    Interview Questions on .Net

    1. What is the difference between Web Services and WCF.

    2. What are the different ways of hosting a WCF service.

    3. Explain the different types of triggers in SQL Server.

    4. Difference between BasicHttpBinding and WSHttpBinding.

    5. What are the different types of assemblies available in .NET?

    6. What is a strong name and how do you give a strong name to an assembly?

    7. What is InsteadOf trigger.

    8. Can we use Insert/Update statements in views in SQL Server

    9. What are abstract classes and Interface and what the difference between the two.

    10. What are the advantages of Interface over abstract classes? I was unable to answer this and they needed the answer in detail. So they gave me some clues in order to arrive at the proper answer from me.

    11. What is a sealed class?

    12. What kind of authentication mechanism you have used in your WCF project.

    13. How do you configure a WCF Service to use Network Authentication.

    14. Difference between interface and abstract classes. What are the advantages of interfaces over abstract classes.

    15. What is Garbage Collection? How is Garbage Collector invoked in .NET.

    16. Can you force Garbage Collector to be invoked from c# code?

    17. How is var keyword used in .NET.Difference between var and dynamic keywords.

    18. Difference between Stored Procedures and Functions.

    19. What are the different types of contracts available in WCF(DataContract,MessageContract,ServiceContract,MessageContract,OperationContract).
  • #744144
    HI..
    Some of answer for your questions..

    1)Web service:
    Message send and Receive using by SOAP(Simple object Access project) over HTTP only
    WCF
    Message using any format(default SOAP) over any transport protocol (HTTP, TCP/IP, MSMQ, Named Pipes etc).

    2) What are the different ways of hosting a WCF service.
    Console application
    Windows application
    Windows services
    IIS6 ( its support HTTP only)
    WAS(Windows Process Activation Service) support for HTTP,TCP,Named Pipes,MSMQ and above version of IIS 6

    3) Explain the different types of triggers in SQL Server.
    Trigger is not but auto fire-up even.. ti's automatically process up(trigger),when you are insert ,update,delete in an tables.
    For example we have parent table and child table. Refer by primary key. Going to be perform action(insert,delete,update),its should be perform child table also. For this we are for trigger.

    4) Difference between BasicHttpBinding and WSHttpBinding
    BasicHttpBinding :
    No message level security
    Default windows authentication
    We can acess get the methods[service contract] through Web reference itself ,because its support .asmx and Basic profile 1.1
    Data are transport in the Simple plan text(XML) format
    WSHttpBinding
    Have message level,transport level,message with transport level
    Its expose web service WS-* specifications.
    We can acess get the methods through service reference
    Data are transport in the encrypted format.
    What are the different types of assemblies available in .NET?

    Private Assembly : use for single application store in the application directory or sub directory
    Public/Shared Assembly: Actually its store in the GAC... its have briefly structure
    satellite assembly : its use for containing resources specific to a given language, for localization and globalization (place the resources for different languages in different assemblies)

    6)What is a strong name and how do you give a strong name to an assembly?
    Strong name is similar to GUID
    Strong Name is only needed when we need to deploy assembly in GAC.
    Strong name use PKC for create the public and private key (public key cryptography)
    Syntax :
    Open ->Visual Studio Command Prompt ? type " sn.exe -k "D:\PKC.snk" click Enter
    Now you can open the .snk file in the notepad from given location . its show like amazing string cant readable format.
    Now Create new Class library for your project and right click in the solution and select Properties -> Signing -> select radio button for " Use a key file" click Ok.
    Now you add the STRONG NAME KEY to your assembly file. Need to register in the GAC
    GAC
    Goto "Visual Studio Command Prompt" and type "gacutil –i ( your_assembly_name)", location(assembly_name) is the DLL name of the project. You successfully register your own dll in GAC .

  • #744145
    Hi,

    8) Can we use Insert/Update statements in views in SQL Server

    Ans: Yes possible. You can create the view table first.

    create view cusdetails as select empname, empage from employee

    Then you can insert the value into view table "Cusdetails"

    insert into cusdetails values('Gopi',29)

    The same way you can update the view table.

    update cusdetails set empage = 5 where empname = 'gopi'

    Note : By the way the original data also would be modified.

    -----------------------------------------------------------------------------
    Regards,
    Gopi A.
    +91 9894315571
    Skype:gopi.net
    http://asaigopi-dotnet.blogspot.in/

  • #744146
    5. What are the different types of assemblies available in .NET?

    Ans: There are two types of assemblies. Below are they

    1. Private Assemblies
    2. Public (Shared Assemblies.)

    Private Assembly:- An assembly is used only for a particular application. It is stored in the application's directory other wise in the application's sub directory. There is no version constraint in private assembly.

    Public Assembly:- It has version constraint. This public assembly is stored inside the global assembly cache or GAC.GAC contains a collection of shared assemblies.

    Note: A public assembly also called as shared assembly

    7. What is InsteadOf trigger.

    Ans: INSTEAD OF trigger to support inserts, updates, and deletes that reference data in more than one table.

    17. How is var keyword used in .NET.Difference between var and dynamic keywords.

    Ans: Var word was introduced with C#3.5(specifically for LINQ) while dynamic is introduced in C#4.0. variables declared with var keyword will get compiled and you can have all its related methods by intellisense while variables declared with dynamic keyword will never get compiled. All the exceptions related to dynamic type variables can only be caught at runtime.

    18. Difference between Stored Procedures and Functions.

    Ans: 1) Procedure can return zero or n values whereas function can return one value which is mandatory.

    2) Procedures can have input, output parameters for it whereas functions can have only input parameters.

    3) Procedure allows select as well as DML(INSERT/UPDATE/DELETE) statements in it whereas function allows only select statement in it.

    4) Functions can be called from procedure whereas procedures cannot be called from function.

    5) Exception can be handled by try-catch block in a procedure whereas try-catch block cannot be used in a function.

    6) We can go for transaction management in procedure whereas we can't go in function.

    7) Procedures cannot be utilized in a select statement whereas function can be embedded in a select statement.

    -----------------------------------------------------------------------------
    Regards,
    Gopi A.
    +91 9894315571
    Skype:gopi.net
    http://asaigopi-dotnet.blogspot.in/

  • #744147
    Hi,

    5. What are the different types of assemblies available in .NET?

    A) there are 3 types of assemblies available in .NET

    1) Private Assembly
    2) Shared Assembly
    3) Satellite Assembly

    6. What is a strong name and how do you give a strong name to an assembly?

    A) When the assembly follows all the below features then we are called as that is Strong named Assembly.

    1) Name
    2) Version
    3) Public Key token.

    8. Can we use Insert/Update statements in views in SQL Server

    A) Yes, you can perform all CRUD operations using Views in SQL.

    9. What are abstract classes and Interface and what the difference between the two.

    A) Abstract is the mechanism to show irrelevant data to the user.

    Interface is used to inherit multiple classes.

    The main differences between those 2 are

    1) Abstract class won't allow multiple inheritance but interface allows inheritance.

    2) there is no datatype for Inheritance class by default that is Public, but in Abstract we can declare the datatype of that.

    3) parameters will not initialize in Inheritance class but in Abstract class we can able to initialize the parameters.


    10. What are the advantages of Interface over abstract classes? I was unable to answer this and they needed the answer in detail. So they gave me some clues in order to arrive at the proper answer from me.

    A) The main differences between those 2 are

    1) Abstract class won't allow multiple inheritance but interface allows inheritance.

    2) there is no datatype for Inheritance class by default that is Public, but in Abstract we can declare the datatype of that.

    3) parameters will not initialize in Inheritance class but in Abstract class we can able to initialize the parameters.

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/

  • #744148
    11. What is a sealed class?
    A) Sealed class will protect to override the base class information into derived class.

    14. Difference between interface and abstract classes. What are the advantages of interfaces over abstract classes.

    A) The main differences between those 2 are

    1) Abstract class won't allow multiple inheritance but interface allows inheritance.

    2) there is no datatype for Inheritance class by default that is Public, but in Abstract we can declare the datatype of that.

    3) parameters will not initialize in Inheritance class but in Abstract class we can able to initialize the parameters.


    15. What is Garbage Collection? How is Garbage Collector invoked in .NET.

    A) Garbage collection is the mechanism to destroy the objects initialized in the class. The best ex for this is Destructor.

    18. Difference between Stored Procedures and Functions.

    A) Stored Procedure:
    1) We can call procedure inside another procedure
    2) we can call procedure inside function.
    3) Optional to return the value
    4) We can able handle exceptions using try and catch in SP.

    Functions:
    1) We can't able to call procedure inside function
    2) We can't able to call function inside function.
    3) It must be to return a value.
    4) we can't able to handle exceptions using try and catch blocks in function.

    Hope this will clear your doubts...

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/

  • #744158
    for multiple interview Question. Please refer the below mentioned site.



    questpond.com

    Thanks & Regards
    Anil Kumar Pandey
    Microsoft MVP, DNS MVM

  • #744285
    Hai Rucha,
    Please find below answers for your questions:
    1. What is the difference between Web Services and WCF.
    Ans. A. WCF Services = Web Services + Remoting + Security + Reliability + Messaging Queue
    B. Not only that, hosting is also one of the powerful feature in WCF where the service can be hosted in Self Hosting, Hosting in Windows Services, Hosting on another Service etc.
    C. Supports DataContractSerializer which is fast and can serialize fields and properties.
    D. Integrated Logging mechanism.

    2. What are the different ways of hosting a WCF service.
    Ans.
    A. Hosting on Console application
    B. Hosting on Windows application
    C. Hosting on Windows services
    D. Hosting on IIS
    E. Hosting on WAS(Windows Activation Service)

    3. Explain the different types of triggers in SQL Server.
    Ans.
    A. DDL Trigger- Trigger fires on DDL Commands
    B. DML Trigger- Trigger fires on DML Commands
    C. InsteadOf Trigger- Trigger fires on View updation

    4. Difference between BasicHttpBinding and WSHttpBinding.
    Ans.
    A. BasicHttpBinding does not enable message level security while the WSHttpBinding enables Message level as well as Transport level security.
    B. BasicHttpBinding has the default windows authentication while the WSHttpBinding support WS* authentication and security.
    C. BasicHttpBinding only supports HTTP to access the service while WSHttpBinding suppors HTTP and HTTPS(secure)
    D. Data which travels through the BasicHttpBinding is in XML format and no encryption allowed while the data travels through WSHttpBinding goes in Encrypted format.

    5. What are the different types of assemblies available in .NET?
    Ans.
    A. Private Assembly
    B. Shared Assembly
    C. Satellite Assembly

    6. What is a strong name and how do you give a strong name to an assembly?
    Ans.
    Unique identification of an assembly called as strong name. By strong name we can differentiate the assemblies which are having the same name.
    We can generate the Strong name using the command:
    SN -K dllName


    7. What is InsteadOf trigger.
    Ans. To update the Views, InsteadOf trigger is used. This is the only use of InsteadOf trigger. There is no use except this.

    8. Can we use Insert/Update statements in views in SQL SERVER?
    Ans. No, View works only on the Query/select command. So we can't have DML commands inside the View. So no Insert/update operations are allowed.

    9. What are abstract classes and Interface and what the difference between the two.
    Ans.
    When the class does not provides the full functionality, the class must be declared as the abstract class.
    There are 2 types of abstract classes-
    A. Partial Abstract Class (Abstract Class)- Class which can support the abstract members(methods, properties) as well as concrete members(methods, properties), the class can be declared as the abstract class.
    Abstract class works based on the child class memory. We can't create the object of the abstract class, only the reference can be created for the abstract class.
    All the abstract members must be overrides in the child class using the Override keywords.

    B. Fully Abstract class (Interface) - The collection of abstract members (methods, properties) is called as interface.
    Interface contains all the abstract members.

    When you have limited scope for the functionality, Abstract class is better but when there is the requirement to implement the global functions, interface is best way to do.
    e.g. When u have some feature which can be implemented in several classes and classes are interrelated, use Abstract class but when the feature can be application level and used by various independent classes, use Interface.

    10. What are the advantages of Interface over abstract classes? I was unable to answer this and they needed the answer in detail. So they gave me some clues in order to arrive at the proper answer from me.
    Ans.
    When you have some feature which can be implemented in several classes and classes are interrelated, use Abstract class but when the feature can be application level and used by various independent classes, use Interface.
    Interfaces are more rigid than Abstract classes.
    e.g. let's say, i have a method called Show() to show the message in various classes, we can have interface for this. Now let's say, I have implemented this interface in 100 classes where I want to use the Show() method to show some message.
    Tomorrow there is some requirement to have the new Print Functionality to let's say in 50 various classes. Now the one way is to add this Print() in the same interface so that we can just implement it to those classes. But what about the rest 50, where we don't want this print.. So this is drawback of Interface.
    That is the reason the Single Responsibility principle and then the interface Segregation Principle came where a class/interface should have only one responsibility. Like in the above example, there are more responsibility and got the problem.
    Abstract class is best when the scope is limited. Let's say I want to calculate the Area of few shapes. So we can say that this is limited as few classes can use this so we can create the abstract class with the abstract method called Area and then implement to those classes by inheriting the abstract class.
    The scope of the Abstract class is till the immediate child class. So you can't use it in grand child or grandparent classes.

    11. What is a sealed class?
    Ans.
    When the class provides full functionality, we can make the class as sealed class. Sealed class can't be inherited but it can be instantiated. it means, when the class is self-dependent, the class be made as sealed class. E.g. all data types are sealed by nature.

    12. What kind of authentication mechanism you have used in your WCF project.
    Ans.
    There are various authentication modes which can be used for the WCF service like-
    A. No Authentication- When the service doesn't requires any authentication and its public to access and use, this type of authentication mode is used.
    B. Windows Authentication – This type of service depends on the windows credential so if the user is having the windows credentials, they can use and access the service.
    C. Form Authentication – This type of authentication requires certain and valid user name and password to access the service.
    D. Certificate Based – There are the secure cervices where each request needs certain authentication mechanism which can be the 3rdparty like X509 certificates to validate the access requests.
    E. Custom Authentication- This can be mixed with two or more authentication mechanism.
    F. Token Based Authentication – Depends on the token provided by the service provider. So based on the token, the client can access the service.

    13. How do you configure a WCF Service to use Network Authentication?
    Ans. We need to set the remote settings for this.
    Below is the reference url:
    http://technet.microsoft.com/en-us/library/cc742824.aspx


    14. What is Garbage Collection? How is Garbage Collector invoked in .NET?
    Ans.
    When the heap memory is filled with the objects and there is no memory left to accommodate the new object, Garbage collector gets called by the CLR. So it's an activity which is initiated by the run time (CLR). When the garbage collector gets called, it tries to find out each referenced objects which are in use by the applications. The objects which are not reachable, it marks them to delete. Based on the reachable objects, the garbage collector prepares the object graph, which has the reference of each reachable object. Now based on the object graph which contain the object generations too, the Garbage collector checks for the generation 0 objects and marks them for deletion and move rest of the objects to generation 1. The heap memory gets compacted for the new object and new object gets placed in the heap memory.
    This is the uncertain and un-deterministic process as the Garbage collector doesn't know when it will be called. Its all based on the capacity memory of the heap. When the heap memory get filled and a new object is initiated, the runtime (CLR) calls the Garbage collector.

    15. Can you force Garbage Collector to be invoked from c# code?
    Ans.
    Yes, When we have something called the unmanaged objects(C++, VC++,VB 6.0), then we need toexplicitelyrelease the memory. To do this, we can use the Dispose() method tofreeupthses object.
    Sometimjes, we need to force the garbage collector to be called to freeup the memory, so we can use the GC.Collect() method to do so.

    16. How is var keyword used in .NET.Difference between var and dynamic keywords.
    Ans.
    var keywordis newly introduces with the .net 3.5 and it is used to make the assignment for any typoe of data. It can store any type of data irrespective of its datatype.
    Sowhen we doen tknow that what type of data, the certain process will return, we can use the var keyword.
    e.g.

    var connection = new SqlConnection(connectionString);

    Here the connection variable can store the SQLConnection type.
    Dynamic keyword is newly introduces with the .net 4.0 version and is used to keep not only the any type of data but also the reference will be constant.
    For the var, the type is made at the compile time while in case of Dynamic; the type is inferred in runtime.
    e.g.

    var customer = new Customer();
    customer.GetCustomers();

    Here the compiler will check for the GetCustomers()method. If the GetCustomers() method doesn't exists, it will show error during the compilation.
    But for the dynamic,

    dynamic customer = new Customer();
    customer.GetCustomers();

    Here the compiler will not check for the GetCustomers() method during the compilation. But at the runtime, if the method is not available, it will throw error.
    So the main use of dynamic is when we don't want the compiler should check for certain errors during compilation. It will skip the error if they are of dynamic type.

    17. Difference between Stored Procedures and Functions.
    Ans.
    Stored Procedure and Functions are the database objects which are the precompiled names sql statements.
    A. Stored procedure can take in as well as Out parameters while function can take only in parameters'.
    B. Stored Procedure may or may not return the value while the Function must return a value. Returning a value in stored procedure depends on the input parameter. If the input parameter is of type out, then it will return the value.
    C. We can use the function inside the stored procedure but stored procedure can't be used inside a function.

    18. What are the different types of contracts available in WCF
    Ans.
    A. Service Contract
    B. Operation Contract
    C. Data Contract
    D. Message Contract
    E. Fault Contract
    Hope it will be helpful to you.

    Regards,
    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)
    pawansoftit@gmail.com


  • Sign In to post your comments