.Net Technologies Interview Questions and Answers for Experienced


Tips to remember :
  • 1. First of all think about What I Want To Hear If I Ask You To Tell Me About Yourself
  • 2. Start with the present and tell why you are well qualified for the position.
  • 3. Best to start with a strong simple statement about yourself (again related to the job and type of person they are looking for) and expand with a synthesized work history that shows how miraculously every thing you have done up to now has led you to this precise moment and prepared you perfectly for this job!

My main role is coding, unit testing, bug fixing and maintenance. My team size is 60 Approx.

Please include the technologies you used in your projects and what kind of architecture (for example: 3-tire, n- tier) you used.

using  System;
namespace  palindrome
{
    
class   Program
    {
        
static void Main(string [] args)
        {
            
string s,revs="" ;
            
Console.WriteLine( " Enter string" );
            s = 
Console .ReadLine();
            
for (int  i = s.Length-1; i >=0; i--)  //String Reverse
            {
                revs += s[i].ToString();
            }
            
if  (revs == s)  // Checking whether string is palindrome or not
            {
                
Console.WriteLine( "String is Palindrome \n Entered String Was {0} and reverse string is {1}" , s, revs);
            }
             else
            {
                
Console.WriteLine( "String is not Palindrome \n Entered String Was {0} and reverse string is {1}" , s, revs);
            }
            
Console .ReadKey();
        }
    }
}

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

 

namespace SchoolDays

{

    class Program

    {

        static void Main(string[] args)

        {

            string input = "WWW.TechTrick.Com";

 

            while (input.Length > 0)

            {

                Console.Write(input[0] + " : ");

                int count = 0;

                for (int j = 0; j < input.Length; j++)

                {

                    if (input[0] == input[j])

                    {

                        count++;

                    }

                }

                Console.WriteLine(count); 

                input = input.Replace(input[0].ToString(),string.Empty);               

            }

            Console.ReadLine();

        }

    }

}


Alternative References
https://www.codeproject.com/Questions/177626/count-number-of-characters-in-a-string
public class A
{
public int A()
{
Console.WriteLine("Hi you are in class A");
}
}
---------------------------Answers----------------------------------

Here we have a constructor A; a constructor should not have a return type. So the code above will throw a compilation error.

Both are the same. system. int32 is a .NET class and int is an alias name for System. Int32.

Yes. You can obfuscate your code by using a new precompilation process called "precompilation for deployment". You can use the aspnet_compiler.exe to precompile a site. This process builds each page in your web application into a single application DLL and some placeholder files. These files can then be deployed to the server.

You can also accomplish the same task using Visual Studio 2013 by using the Build->Publish Selection.

Viewstate stores the state of controls in HTML hidden fields. At times, this information can grow in size. This does affect the overall responsiveness of the page, thereby affecting performance. The ideal size of a viewstate should be not more than 25-30% of the page size.

Viewstate can be compressed to almost 50% of its size. . NET also provides the GZipStream orDeflateStream to compress viewstate.

No. All source code files kept in the root App_Code folder must be in the same programming language.

Update: However, you can create two subfolders inside the App_Code and then add both C# and VB.NET in the respective subfolders. You also have to add configuration settings in the web.config for this to work.

The main differences are listed below.
Dictionary:
  • 1. Returns an error if the key does not exist.
  • 2. No boxing and unboxing.
  • 3. Faster than a Hash table
Hashtable:
  • 1. Returns NULL even if the key does not exist.
  • 2. Requires boxing and unboxing.
  • 3. Slower than a Dictionary.
Client-side:
  • 1. Hidden Field
  • 2. View State
  • 3. Cookies
  • 4. Control State
  • 5. Query Strings
Server-side:
  • 1. In Proc mode
  • 2. State Server mode
  • 3. SQL Server mode
  • 4. Custom mode
Button btnTest = (Button) myGrid.Rows[0].Cells[1].Controls[1].FindControl("myButton ");

While using shared assemblies, to avoid Assembly being overwritten by a different version of the same assembly, shared assemblies are placed in a special directory subtree of the file system known as the global assembly cache (GAC). Placing shared assemblies can only be done by a special .Net Utilities.

While using shared assemblies, in order to avoid name collisions strong names are used. Strong Names are based on private key cryptography, ie. private assemblies are simply given the same name as their main file name.

You can keep multiple web.config files in an application. You can place a Web.config file inside a folder or wherever you need (apart from some exceptions) to override the configuration settings that are inherited from a configuration file located at a higher level in the hierarchy.

By default, ASP.NET submits a form to the same page. In cross-page posting, the form is submitted to a different page. This is done by setting the 'PostBackUrl' property of the button(that causes postback) to the desired page. In the code-behind of the page to which the form has been posted, use the 'FindControl' method of the 'PreviousPage' property to reference the data of the control in the first page

ALTER TABLE MyTab DROP CONSTRAINT myConstraint

DECLARE @table TABLE(
id INT IDENTITY(1, 1)
, data VARCHAR(20)
)
INSERT INTO @table VALUES ('not duplicate row')
INSERT INTO @table VALUES ('duplicate row')
INSERT INTO @table VALUES ('duplicate row')

WHILE 1 = 1
BEGIN
DELETE FROM @table
WHERE id IN (SELECT MAX(id)
FROM @table
GROUP BY data
HAVING COUNT(*) > 1)
IF @Rowcount = 0
BREAK ;
END

An async method is a method that returns to the calling method before completing all its work, and then completes its work while the calling method continues its execution.


An async method has the following characteristics:
  • An async method must have the async keyword in its method header, and it must be before the return type.
  • This modifier doesn’t do anything more than signal that the method contains one or more await expressions.
  • It contains one or more await expressions. These expressions represent tasks that can be done asynchronously.
  • It must have one of the following three return types.

// Three things to note in the signature: 
//  - The method has an async modifier.  
//  - The return type is Task or Task<T>. (See "Return Types" section.)
//    Here, it is Task<int> because the return statement returns an integer. 
//  - The method name ends in "Async."
async Task<int> AccessTheWebAsync()
{ 
                                // You need to add a reference to System.Net.Http to declare client.
    HttpClient client = new HttpClient();
                                // GetStringAsync returns a Task<string>. That means that when you await the 
                                // task you'll get a string (urlContents).
    Task<string> getStringTask = client.GetStringAsync("http://msdn.microsoft.com");
                                // You can do work here that doesn't rely on the string from GetStringAsync.
    DoIndependentWork();
                                // The await operator suspends AccessTheWebAsync. 
                                //  - AccessTheWebAsync can't continue until getStringTask is complete. 
                                //  - Meanwhile, control returns to the caller of AccessTheWebAsync. 
                                //  - Control resumes here when getStringTask is complete.  
                                //  - The await operator then retrieves the string result from getStringTask. 
                                string urlContents = await getStringTask;
                                // The return statement specifies an integer result. 
                                // Any methods that are awaiting AccessTheWebAsync retrieve the length value. 
                                return urlContents.Length;
}

An abstract class cannot be a sealed class because the sealed modifier prevents a class from being inherited and the abstract modifier requires a class to be inherited.

Basic difference between Web Services and Web APIs

Web Service:

1) It is a SOAP based service and returns data as XML.

2) It only supports the HTTP protocol.

3) It can only be hosted on IIS.

4) It is not open source, but can be used by any client that understands XML.

5) It requires a SOAP protocol to receive and send data over the network, so it is not a light-weight architecture.

Web API:

1) A Web API is a HTTP based service and returns JSON or XML data by default.

2) It supports the HTTP protocol.

3) It can be hosted within an application or IIS.

4) It is open source and it can be used by any client that understands JSON or XML.

5) It is light-weight architectured and good for devices which have limited bandwidth, like mobile devices.

SOAP:
  • 1. SOAP is a protocol.
  • 2. SOAP stands for Simple Object Access Protocol.
  • 3. SOAP uses services interfaces to expose the business logic.
  • 4. SOAP defines standards to be strictly followed.
  • 5. SOAP defines its own security.
  • 6. SOAP permits XML data format only.
REST:
  • 1. REST is an architectural style.
  • 2. REST stands for REpresentational State Transfer.
  • 3. REST uses URI to expose business logic.
  • 4. REST does not define too much standards like SOAP.
  • 5. RESTful web services inherits security measures from the underlying transport.
  • 6. REST permits different data format such as Plain text, HTML, XML, JSON etc

Stay Connected

Popular Posts

Get Latest Stuff Through Email


Who Should Read TechTrick?

All the tricks and tips that TechTrick provides only for educational purpose. If you choose to use the information in TechTrick to break into computer systems maliciously and without authorization, you are on your own. Neither I (TechTrick Admin) nor anyone else associated with TechTrick shall be liable. We are not responsibe for any issues that caused due to informations provided here. So, Try yourself and see the results. You are not losing anything by trying... We are humans, Mistakes are quite natural. Here on TechTrick also have many mistakes..