ASP.NET interview questions and answers

Which is the parent class of the Web server control? The System.Web.Ul.Control class is the parent class for all Web server controls. In which event are the controls fully loaded? Page load event guarantees that all controls are fully loaded. Controls are also accessed in Page_Init events but you will see that view state is … Continue reading ASP.NET interview questions and answers

Download/Upload files using FTP in C#

        What is FTP?  FTP(File transfer protocol)  is a client-server protocol that relies on two communications channels between client and server: a command channel for controlling the conversation and a data channel for transmitting file content. Clients initiate conversations with servers by requesting to download a file. Using FTP, a client can … Continue reading Download/Upload files using FTP in C#

Interface vs Abstract class in C#

What is Interface? An interface is a contract with the list of the method defined in the interface.An interface can only have the method definition.Any class implementing the interface should implement all the methods defined in the interface. What is Abstract Class? An abstract class is a special kind of class which can not be instantiated, … Continue reading Interface vs Abstract class in C#

Swap two variable without using the third variable

using System; namespace Swap { class Program { private static void Main(string[] args) { int a = 1000; int b = 999; Console.WriteLine("Before Swap"); Console.WriteLine("Value of A :{0} ", a); Console.WriteLine("Value of B :{0} ", b); a = a + b; b = a - b; a = a - b; Console.WriteLine("After Swap"); Console.WriteLine("Value of … Continue reading Swap two variable without using the third variable

Sum of digits till the sum is one-digit number

public class SumtillDigitOne { private long _sum = 0; public long SumAllNumberTillDigitOne(long bigno) { if (bigno == 0) { if (_sum > 9) { bigno = _sum; _sum = 0; } else { return _sum; } } _sum += bigno%10; bigno = bigno/10; return SumAllNumberTillDigitOne(bigno); } } class Program { private static void Main(string[] args) … Continue reading Sum of digits till the sum is one-digit number

Html Form validation using one function of javascript

<script type="text/javascript"> function validateform() { var txtcontrols = document.getElementsByTagName("input"); for (var count = 0; count &lt; txtcontrols.length; count++) { if (txtcontrols[count].value == '') { errmsg.innerHTML = "Please Enter " + txtcontrols[count].name; return false; } if (txtcontrols[count].getAttribute('type') == 'radio') { var counter = 0; var radiobuttons = document.getElementsByName(txtcontrols[count].name); for (var radio = 0; radio &lt; radiobuttons.length; … Continue reading Html Form validation using one function of javascript

Solid Principles of OOP

Object oriented programming has 5 basic rules that we called solid rules where s stands for Single Responsibility Principle,o stand for Open Close principle,l stand for Liskov Substitution Principle,I stand for Interface Segregation Principle and the last but not lease is  Dependency Inversion Principle. If you want to use object oriented design in your application … Continue reading Solid Principles of OOP