Posts

Showing posts from March, 2015

SQL INTERVIEW QUERIES QUESTIONS AND ANSWERS WITH EXAMPLE FOR FRESHIER SET-1

Image
This is 1st post related to sql interview queries with examples. This post contains questions for both fresher and experienced developers. How to get second highest salary from Salary Master Table in SQL ? How to get Department wise total salary  form Department Master and Salary Master ?

Can two methods have same name with different return types in c#?

return type is different. Method name & argument list same.   public class MyClass     {         public double Test(int x)         {             return x * 120;                 }         public int Test(int x)         {             return x * 120;         }    }           class Program     {         static void Main(string[] args)         {                                MyClass obj = new MyClass();             obj.Test(12);             Console.WriteLine();             Console....

What is an abstract class, and when it should be used?

//Abstract classes are classes that contain one or more abstract methods. using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace AbstractClass {     class Program     {         static void Main(string[] args)         {             Dog obj = new Dog();             obj.makeNoise();         }     }     // Note that the abstract keyword is used to denote both an abstract method, and an abstract class.     // we can not create instance of Abstract class     // By using abstract classes, you can inherit the implementation of other (non-abstract) methods.     // You can't do that with interfaces - an interface cannot provide any method implementations.    public abstract class Animal     {         ...

How to get Number From String in c#

                        How to get Number From String in c#                   string a = "A1B2C3D4E5";                 string b = string.Empty;                 string c = string.Empty;                 int val;                 for (int i = 0; i < a.Length; i++)                 {                     if (Char.IsDigit(a[i]))                         b += a[i];                     else                         c += a[i];           ...

Function overloading and return type

Function overloading and return type For example, the following program C++ and Java programs fail in compilation. C++ Program int DESCRIBE() {      return 10; }   char DESCRIBE () {  // compiler error; new declaration of DESCRIBE ()      return 'a' ; }   int main() {      char x = DESCRIBE ();      getchar ();      return 0; } Java Program // filename Main.java public class Main {      public int DESCRIBE () {          return 10;      }      public char DESCRIBE () { // compiler error: DESCRIBE () is already defined          return 'a' ;      }      public static void main(String args[])    ...