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

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