C#.Net Interview Questions

Size: px
Start display at page:

Download "C#.Net Interview Questions"

Transcription

1 1 P a g e C#.Net Interview Questions

2 2 P a g e Table of Contents 1. About? About Write, WriteLine, Read, ReadLine and ReadKey methods? About difference between Decimal, Float and Double in.net? How to get Max and Min range of data types? About Data type conversion? About Boxing and Unboxing? About Ternary Operator? About is and as Operators? About Null Coalescing Operator??? About Bitwise Operators? About difference between int.parse,convert.toint32 and int.tryparse? About switch vs if-else-if? About for vs foreach? About polyndrome number? About Prime number? About Instance method? About Static Method? About value type parameters? About reference type parameter? About out parameter? About parameter array?... 24

3 3 P a g e 22. About storing different data types values in to an array? About Obsolete Attribute in C#? About Tuple in C#? About Finalize and Dispose Methods? About using keyword? About Use of New Keyword? About sorting an array elements? About sorting elements with Bubble sort? About structures? About enum data type? About reversing a string? About string vs stringbuilder? About Difference b/w.tostring() and Convert.ToString()? About Recursive Method? About ArrayList? About Hashtable? About Stack? About Difference b/w Pop() and Peek()? About Queue? About difference b/w DeQueue() and Peek()? About Generic Collection Dictionary? About Generic Collection List? About Generic Collection Queue? About Generic Collection Stack? About SortedList?... 45

4 4 P a g e 47. About IEnumerable? About IQueryable? What's the difference between IEnumerable<T> and List<T>? About Class? About public access modifier? About private Access Modifier? About protected Access Modifier? About properties? About default constructor? About parameter Constructor? About static constructor? About copy constructor? About private constructor? About static class? About abstract class? About interface? About partial class? About Data Abstraction and Encapsulation? About Method Overloading? About Operator Overloading? About Method Overriding? About Inheritance? About single inheritance? About multi-level inheritance? About multiple inheritance?... 74

5 5 P a g e 72. About multiple inheritance through interfaces? About multiple interface with one class and one interface? About Extension Method? About indexers? About Generic Methods? About Generic Classes? About Exception Handling? About dynamic, object and var keywords? About LINQ with selection? LINQ with where condition? LINQ with select many? LINQ with Take? LINQ with TakeWhile? LINQ with Skip? LINQ with Order by? LINQ with Group By? LINQ with Distinct? LINQ with Union? LINQ with intersect? LINQ with Except? LINQ with First? LINQ with FirstOrDefault? LINQ with All? LINQ with Count? LINQ with Sum?... 97

6 6 P a g e 97. LINQ with Min, Max and Average? LINQ with Join? About Delegate? About Multicast Delegate or chaining delegates? About Asynchronous Method call with Delegates? About Asynchronous Method call with return value? About Anonymous method call? About Reflection? About Basics of Threading? About Background thread? About Thread lifecycle? About difference b/w Abstarct class and Interface? About where to use interface? Can an interface inherit from another interface? Is it possible to create partial structs, interfaces and methods? How do you create partial methods? Why is it not a good idea to use Empty destructors? We cannot create instances of static classes. Can we have constructors for static classes? Can you prevent a class from being instantiated? Can a child class call the constructor of a base class? If a child class instance is created, which class constructor is called first - base class or child class?

7 7 P a g e 118. Can you mark static constructor with access modifiers? What happens if a static constructor throws an exception? If a method's return type is void, can you use a return keyword in the method? About Dependency Injection? About implementation of DI through the Constructor? About implementation of DI through the Property? About implementation of DI through the Method? About implementation of DI through the interface? About Singleton Design pattern? About Factory Method design pattern? What are the Methods we can able to access with a,b,c objects in the following program? In the following code finally block execute or not? How to implement only specified Methods in an interface?

8 8 P a g e About? namespace The static keyword tells us that this method should be accessible without instantiating the class. void, it tells us what this method should return. For instance, int could be an integer or a string of text, but in this case, we don't want our method to return anything, or void, which is the same as no type. Main, which is simply the name of our method. This method is the so-called entry-point of our application, that is, the first piece of code to be executed. A set of arguments can be specified within a set of parentheses. In our example, our method takes only one argument, called args. The type of the argument is a string, or to be more precise, an array of strings, but more on that later. If you think about it, this makes perfect sense, since Windows applications can always be called with an optimal set of arguments. These arguments will be passed as text strings to our main method. About Write, WriteLine, Read, ReadLine and ReadKey methods? namespace //The Write() method outputs one or more values to the screen without a new line character(\n). Console.Write("About Write!"); Console.Write("Hollo World!"); Console.Write("Hollo World!"); //The WriteLine() always appends a new line character to the end of the string. this means any subsequent output will start on a new line.(\n) Console.Write("About WriteLine!"); Console.WriteLine("Hollo World!"); Console.WriteLine("Hollo World!");

9 9 P a g e //there is no difference b/w Write and WriteLine if we use \n in Write method Console.Write("About Write with \n!"); Console.Write("Hollo World!\n"); Console.Write("Hollo World!\n"); Console.WriteLine("Hollo World!"); Console.WriteLine("Hollo World!"); character ////Read() method will read only a single char and return ASCII value of that Console.Write("About Read!"); int i = Console.Read(); Console.WriteLine(i); ////ReadLine() Method reads the whole string Console.Write("About ReadLine!"); string s = Console.WriteLine(s); //With ReadKey() we can get ConsoleKey information like what is the key user entered and Modifier information as below Console.WriteLine("Please Enter Something : "); ConsoleKeyInfo obj = Console.ReadKey(); Console.WriteLine(); Console.WriteLine("Key : 0,KeyChar is :1,Modifier is :2", obj.key, obj.keychar.gettypecode(), obj.modifiers.tostring()); About difference between Decimal, Float and Double in.net? Precision is the main difference. Float - 7 digits (32 bit) Double digits (64 bit) Decimal significant digits (128 bit) Decimals have much higher precision and are usually used within financial applications that require a high degree of accuracy. Decimals are much slower (up to 20X times in some tests) than a double/float. Decimals and Floats/Doubles cannot be compared without a cast whereas Floats and Doubles can. Decimals also allow the encoding or trailing zeros.

10 10 P a g e namespace float flt = 1F / 3; double dbl = 1D / 3; decimal dcm = 1M / 3; Console.WriteLine("float: 0 double: 1 decimal: 2", flt, dbl, dcm); Result : float: double: decimal: How to get Max and Min range of data types? namespace ////Built-in Data Types: //byte ////How to find the Min and Max values of a data type Console.WriteLine("The minimum value of byte is 0,maximam value of byte is 1", byte.minvalue, byte.maxvalue); ////How to find size data type Console.WriteLine("The size of of byte is 0", sizeof(byte)); //short Console.WriteLine("The minimum value of short is 0,maximam value of short is 1", short.minvalue, short.maxvalue); Console.WriteLine("The size of of short is 0", sizeof(short)); //int Console.WriteLine("Interger Min Value:" + sbyte.minvalue + " Integer Max Value:" + sbyte.maxvalue);

11 11 P a g e About Data type conversion? namespace //Type Coversion type value //Implicit Type Conversion:Converting lower data type value to higher data int intvalue = 123; long longvalue = intvalue; Console.WriteLine("0, 1", intvalue, longvalue); type value ////Explicit Type Conversion:Converting higher data type value to lower data double doublevalue = ; int intvalue1 = Convert.ToInt32(doubleValue); Console.WriteLine("0, 1", doublevalue, intvalue1); About Boxing and Unboxing? namespace ////Boxing and Unboxing int stackvar = 12; //Boxing: Converting value type to reference type

12 12 P a g e object boxedvar = stackvar; //Unboxing: Converting reference type to value type int unboxed = (int)boxedvar; Console.WriteLine("0, 1", boxedvar, unboxed); About Ternary Operator? namespace //Ternary Operators //If the expression is true, set value to Eligible.Otherwise, set value to Not Eligible. int age = 25; string IsEligibleForVote = age>18? "Eligible" : "Not Eligible"; Console.WriteLine(IsEligibleForVote); About is and as Operators? namespace class Abc class Def

13 13 P a g e //is and as Operators //The is operator in C# is used to check the object type and it returns a bool value: true if the object is the same type and false if not. Abc A = new Abc(); Def D = new Def(); bool isdef = (A is Def); Console.WriteLine(isDef); //The as operator does the same job of is operator but the difference is instead of bool, it returns the object if they are compatible to that type, else it returns null. Def isdeftype = D as Def; Console.WriteLine(isDefType); Output: False.Def About Null Coalescing Operator??? namespace //Null Coalescing Operators :?? //The?? operator is called the null-coalescing operator. It returns the left-hand operand if the operand is not null; otherwise it returns the right hand operand.

14 14 P a g e int? x = null; // Set y to the value of x if x is NOT null; otherwise, // if x = null, set y to -1. int y = x?? -1; Console.WriteLine(y); About Bitwise Operators? Bitwise operator works on bits and perform bit by bit operation. The truth tables for &,, and ^ are as follows: p Q p & q p q p ^ q Assume if A = 60; and B = 13; then in the binary format they are as follows: A = B = A&B = =12

15 15 P a g e A B = A^B = ~A = Example: using System.Linq; using System.Runtime.Remoting.Messaging; using System.Reflection; using System.Threading; namespace int A = 60;// int B = 13;// Console.WriteLine("The bitwise & value of A&B is 0",A&B);//12 Console.WriteLine("The bitwise value of A B is 0", A B);//49 Console.WriteLine("The bitwise ^ value of A^B is 0", A ^ B);//61 Console.WriteLine("The bitwise << value of A<< is 0", A << B);// Console.WriteLine("The bitwise >> value of A>>B is 0", A >> B);//0 Console.WriteLine("The bitwise ~ value of ~A is 0", ~A);//-61 About difference between int.parse,convert.toint32 and int.tryparse? int.parse: Simply, int.parse (string s) method converts the string to integer. If string s is null, then it will throw ArgumentNullException. If string s is other than integer value, then it will throw FormatException. If string s represents out of integer ranges, then it will throw OverflowException.

16 16 P a g e using System.Linq; using System.Runtime.Remoting.Messaging; using System.Reflection; using System.Threading; namespace string str1 = "9009"; string str2 = null; string str3 = " "; string str4 = " "; int finalresult; finalresult = int.parse(str1); //success finalresult = int.parse(str2); //ArgumentNullException finalresult = int.parse(str3); //FormatException finalresult = int.parse(str4); //OverflowException Convert.ToInt32: Simply, Convert.ToInt32(string s) method converts the string to integer. If string s is null, then it will return 0 rather than throw ArgumentNullException. If string s is other than integer value, then it will throw FormatException. If string s represents out of integer ranges, then it will throwoverflowexception. using System.Linq; using System.Runtime.Remoting.Messaging; using System.Reflection; using System.Threading; namespace string str1 = "9009"; string str2 = null; string str3 = " ";

17 17 P a g e string str4 = " "; int finalresult; finalresult = Convert.ToInt32(str1); // 9009 finalresult = Convert.ToInt32(str2); // 0 finalresult = Convert.ToInt32(str3); //FormatException finalresult = Convert.ToInt32(str4); //OverflowException int.tryparse: Simply int.tryparse(string s,out int) method converts the string to integer out variable and returnstrue if successfully parsed, otherwise false. If string s is null, then the out variable has 0 rather than throw ArgumentNullException. If string s is other than integer value, then the out variable will have 0rather than FormatException. If string s represents out of integer ranges, then the out variable will have 0rather than throw OverflowException. using System.Linq; using System.Runtime.Remoting.Messaging; using System.Reflection; using System.Threading; namespace string str1 = "9009"; string str2 = null; string str3 = " "; string str4 = " "; int finalresult; bool output; output = int.tryparse(str1, out finalresult); // 9009 output = int.tryparse(str2, out finalresult); // 0 output = int.tryparse(str3, out finalresult); // 0 output = int.tryparse(str4, out finalresult); // 0

18 18 P a g e About switch vs if-else-if? namespace //use of switch statement compare to if-else statement string DayName = "Wednesday"; //if else if if (DayName == "Sunday") Console.WriteLine("The Day is Sunday"); else if (DayName == "Monday") Console.WriteLine("The Day is Monday"); else if (DayName == "Monday") Console.WriteLine("The Day is Monday"); else if (DayName == "Tuesday") Console.WriteLine("The Day is Tuesday"); else if (DayName == "Wednesday") Console.WriteLine("The Day is Wednesday"); else if (DayName == "Thursday") Console.WriteLine("The Day is Thursday"); else if (DayName == "Friday") Console.WriteLine("The Day is Friday"); else if (DayName == "Saturday") Console.WriteLine("The Day is Saturday"); else Console.WriteLine("Please enter proper day"); //switch: which provides an easy way to check multiple statements switch (DayName) case "Sunday": Console.WriteLine("The Day is Sunday"); break; case "Monday": Console.WriteLine("The Day is Monday"); break; case "Tuesday": Console.WriteLine("The Day is Tuesday"); break; case "Wednesday": Console.WriteLine("The Day is Wednesday"); break; case "Thursday": Console.WriteLine("The Day is Thursday");

19 19 P a g e break; case "Friday": Console.WriteLine("The Day is Friday"); break; case "Saturday": Console.WriteLine("The Day is Saturday"); break; default: Console.WriteLine("Please enter proper day"); break; About for vs foreach? namespace //for vs foreach //foreach-which is useful to iterate through collections very easily int[] myinterger = new int[4]; myinterger[0] = 1; myinterger[1] = 2; myinterger[2] = 3; myinterger[3] = 4; int total = 0; foreach (int i in myinterger) total += i; Console.WriteLine(total); ////Same using For for (int i = 0; i < myinterger.length; i++) total += myinterger[i]; ; Console.WriteLine(total);

20 20 P a g e About polyndrome number? namespace //polyndrome is number which is same as it s reverse int num, temp, remainder, reverse = 0; Console.WriteLine("Enter an integer \n"); num = int.parse(console.readline()); temp = num; while (num > 0) remainder = num % 10; reverse = reverse * 10 + remainder; num /= 10; Console.WriteLine("Given number is = 0", temp); Console.WriteLine("Its reverse is = 0", reverse); if (temp == reverse) Console.WriteLine("Number is a palindrome \n"); else Console.WriteLine("Number is not a palindrome \n"); About Prime number? namespace //Prime Numbers Console.Write("Enter a Number : "); int num; num = Convert.ToInt32(Console.ReadLine());

21 21 P a g e int k; k = 0; for (int i = 1; i <= num; i++) if (num % i == 0) k++; if (k == 2) Console.WriteLine("Entered Number is a Prime Number and the Largest Factor is 0", num); else Console.WriteLine("Not a Prime Number"); About Instance method? namespace ////Methods //Instance Method: which needs an object to call a method Program ojver = new Program(); int c = ojver.add(5, 10); Console.WriteLine(c); public int Add(int a, int b) return a + b;

22 22 P a g e About Static Method? namespace ////Methods ////Static Method:which doesn't need any object to call a method int d = Add(5, 10); Console.WriteLine(d); public static int Add(int a, int b) return a + b; About value type parameters? namespace ////Method Parameters ////Value Parameter: the value changes in called method not reflecting to calling method int i = 10; Console.WriteLine("I value before Calling SimpleMethod() " + i); SimpleMethod(i); Console.WriteLine("I value before Calling SimpleMethod() " + i); static void SimpleMethod(int j) j = j + 1; Console.WriteLine("J value inside Called Method is " + j);

23 23 P a g e About reference type parameter? namespace ////Method Parameters ////reference Parameter:the value changes in called method automatically reflecting to calling method int i = 10; Console.WriteLine("I value before Calling SimpleMethodRef() " + i); SimpleMethodRef(ref i); Console.WriteLine("I value before Calling SimpleMethodRef() " + i); static void SimpleMethodRef(ref int j) j = j + 1; Console.WriteLine("J value inside Called Method is " + j); About out parameter? namespace ////Method Parameters ////Out Parameter:which returns more than one value to calling function int i = 5; int j = 5; int Sum = 0; int product = 0; SimpleMethodOut(i, j, out Sum, out product); Console.WriteLine("Sum is 0 and Product is 1", Sum, product);

24 24 P a g e static void SimpleMethodOut(int i, int j, out int Sum, out int Product) Sum = i + j; Product = i * j; About parameter array? namespace array ////Method Parameters ////Parameter Array:which accepts any number of parameters in the form of SimpleMethodParams(1, 2, 3, 4, 5); static void SimpleMethodParams(params int[] numbers) int sum = 0; foreach (var item in numbers) sum += item; Console.WriteLine("Sum of first 5 numbers is 0", sum); About storing different data types values in to an array? namespace

25 25 P a g e //storing different data types values into an array,using object array we can able to achieve it object[] arr = new object[4]; arr[0]=""; arr[1]=5; arr[2]= 5.55; arr[3]='k'; foreach (var item in arr) Console.WriteLine(item); About Obsolete Attribute in C#? using System.Linq; using System.Runtime.Remoting.Messaging; using System.Reflection; using System.Threading; namespace //Obsolete attribute is used to declare a method as deprecated. M1(); M2(); [Obsolete("M1() Method is deprecated please use M2() instead")]//it will allow to compile the code with deprecate method //[Obsolete("M1() Method is deprecated please use M2() instead",true)]//it will not allow to compile the code with deprecate method public static void M1()

26 26 P a g e Console.WriteLine("M1"); public static void M2() Console.WriteLine("M2"); About Tuple in C#? A tuple is an ordered sequence, immutable, fixed-size and of heterogeneous objects, i.e., each object being of a specific type. using System.Linq; using System.Runtime.Remoting.Messaging; using System.Reflection; using System.Threading; namespace //Obsolete attribute is used to declare a method as deprecated. //usage of Tuple var primes = Tuple.Create(2, 3, 5, 7, 11, 13, 17, 19); Console.WriteLine("Prime numbers less than 20: " + "0, 1, 2, 3, 4, 5, 6, and 7", primes.item1, primes.item2, primes.item3, primes.item4, primes.item5, primes.item6, primes.item7, primes.rest.item1); //use tuple to return more that one value from a method Tuple<int, int, int> OperationResult = Calculate(10, 20); Console.WriteLine("Sum is 0 Sub is 1 Mul is 2", OperationResult.Item1, OperationResult.Item2, OperationResult.Item3);

27 27 P a g e public static Tuple<int, int, int> Calculate(int a, int b) Tuple<int, int, int> vals = Tuple.Create(a+b, a-b, a*b); return vals; About Finalize and Dispose Methods? using System.Linq; using System.Runtime.Remoting.Messaging; using System.Reflection; using System.Threading; using System.Data.SqlClient; namespace //Finalize() belongs to the Object class. //It is automatically called by the Garbage Collection mechanism when the object goes out of the scope(usually at the end of the program //It is slower method and not suitable for instant disposing of the objects. //It is non-deterministic function i.e., it is uncertain when Garbage Collector will call Finalize() method to reclaim memory. class employee:idisposable ~employee() //This is the destructor of emp class //This destructor is implicitly compiled to the Finalize method. //Explicitly, it is called by user code and the class implementing dispose method must implement IDisposable interface. //used to release unmanaged code. public void Dispose() Dispose(); GC.SuppressFinalize(this);

28 28 P a g e SqlConnection sqlcon=null; try string constring = "Server=(local);Database=my; User Id=sa; Password=sa"; sqlcon = new SqlConnection(constring); sqlcon.open(); // here connection is open catch finally sqlcon.close(); // close the connection sqlcon.dispose(); // detsroy the connection object About using keyword? using System.Linq; using System.Runtime.Remoting.Messaging; using System.Reflection; using System.Threading; using System.Data.SqlClient; namespace //"using" keyword helps to clear objects once execution come out of the using block. //"using" keyword helps to import namespaces. using (SqlConnection sqlcon = new SqlConnection()) sqlcon.open();

29 29 P a g e About Use of New Keyword? using System.Linq; using System.Runtime.Remoting.Messaging; using System.Reflection; using System.Threading; using System.Data.SqlClient; namespace //"New" keyword helps to hide base class method and provides new implemetation in derived class. class A public void show() Console.WriteLine("Hello: Base Class!"); class B : A public new void show() Console.WriteLine("Hello: Derived Class!"); A a1 = new A(); a1.show(); B b1 = new B(); b1.show(); A a2 = new B(); a2.show();

30 30 P a g e About sorting an array elements? namespace //Sorting an array elements int[] arr = new int[5]; arr[0] = 10; arr[1] = 14; arr[2] = 15; arr[3] = 14; arr[4] = 11; Console.WriteLine("Array elements before sorting"); foreach (var item in arr) Console.WriteLine(item); Array.Sort(arr); Console.WriteLine("Array elements after sorting"); foreach (var item in arr) Console.WriteLine(item); About sorting elements with Bubble sort? namespace

31 31 P a g e //Sorting an array elements using bubble sort int[] arr = new int[5]; arr[0] = 10; arr[1] = 14; arr[2] = 15; arr[3] = 12; arr[4] = 11; int i, j; int N = arr.length; for (j = N - 1; j > 0; j--) for (i = 0; i < j; i++) if (arr[i] > arr[i + 1]) exchange(arr, i, i + 1); foreach (var item in arr) Console.WriteLine(item); public static void exchange(int[] data, int m, int n) int temporary; temporary = data[m]; data[m] = data[n]; data[n] = temporary; About structures? namespace public struct Customer private int id; public int Id get return id; set id = value;

32 32 P a g e private string name; public string Name get return name; set name = value; public Customer(int Ids, string name) this.id = Ids; this.name = name; public void Print() Console.WriteLine(id + name); //Structures/ Structs //Similar to classes struct can have fields, properties,constructors and methods. //Class is Reference type but Struct is Value type //Struct can't have desructors //Struct can't be inherite Customer c = new Customer(101, "Madhan"); c.print(); About enum data type? namespace

33 33 P a g e //enum public enum Days Sun, Mon, Tue, Wed, Thu, Fri, Sat ; //Enums //Enums are strongly typed constants //The default underlying type an enum is int. //Th default value of the enum is 0 and increment by 1. //Enum is value type Console.WriteLine((int)Days.Sun); Console.WriteLine((int)Days.Mon); Console.WriteLine((int)Days.Tue); Console.WriteLine((int)Days.Wed); Console.WriteLine((int)Days.Thu); Console.WriteLine((int)Days.Fri); Console.WriteLine((int)Days.Sat); About reversing a string? namespace //method one string str = ""; char[] strrev = str.tochararray(); Array.Reverse(strrev); Console.WriteLine("Reverse of a string is 0", new string(strrev));

34 34 P a g e //method 2 string str1 = ""; StringBuilder strtemp = new StringBuilder(); char[] strrev1 = str1.tochararray(); Array.Reverse(strrev1); foreach (var item in strrev1) strtemp.append(item); Console.WriteLine("Reverse of a string is 0", strtemp); About string vs stringbuilder? using System.Linq; using System.Runtime.Remoting.Messaging; using System.Reflection; using System.Threading; namespace //string is a immutal //Performance wise string is slow because every time it will create new instance //String belongs to System namespace string str = ""; // create a new string instance instead of changing the old one str += " IT"; str += " Services"; Console.WriteLine("The complete Name is 0",str); //StringBuilder mutable //Performance wise stringbuilder is high because it will use same instance of object to perform any action

35 35 P a g e //Stringbuilder belongs to System.Text namespace StringBuilder str1 = new StringBuilder(); str1.append(""); str1.append(" IT"); str1.append(" Services"); Console.WriteLine("The complete Name is 0", str1); About Difference b/w.tostring() and Convert.ToString()? using System.Linq; using System.Runtime.Remoting.Messaging; using System.Reflection; using System.Threading; namespace //.ToString() not allow null,it gives error string str1 = ""; Console.WriteLine(str1.ToString());//will work fine string str2 = null; Console.WriteLine(str2.ToString());//will give System.NullReferenceException //.ToString() not allow null,it gives error string str3 = ""; Console.WriteLine(Convert.ToString(str3));//will work fine string str4 = null; Console.WriteLine(Convert.ToString(str4));//will work fine

36 36 P a g e About Recursive Method? A method can call itself. This is known as recursion. Following is an example that calculates factorial for a given number using a recursive function: using System.Linq; using System.Runtime.Remoting.Messaging; using System.Reflection; using System.Threading; namespace Program p = new Program(); //calling the factorial method Console.WriteLine("Factorial of 6 is : 0", p.factorial(6)); Console.WriteLine("Factorial of 7 is : 0", p.factorial(7)); Console.WriteLine("Factorial of 8 is : 0", p.factorial(8)); public int factorial(int num) int result; if (num == 1) return 1; else result = factorial(num - 1) * num; return result; About ArrayList?

37 37 P a g e namespace //ArrayList is used to store non-homogeneous data types under a common name ArrayList obj = new ArrayList(); obj.add("madhan"); obj.add(10); obj.add(10.123); obj.insert(2,"mamidala"); foreach (var item in obj) Console.WriteLine(item); About Hashtable? namespace //Hashtable is used to store non-homogeneous data types with Kay and Value pairs under a common name Hashtable obj = new Hashtable(); obj.add(1, "Madhan"); obj.add(2, "Kumar"); obj.add(3, "Mamidala"); for (int i = 1; i <= obj.count; i++) Console.WriteLine("The value for the Kay is 0", obj[i]);

38 38 P a g e About Stack? namespace //Stack is used to store non-homogeneous data types in First In Last Out(FILO) order under a common name Stack obj = new Stack(); obj.push("madhan"); obj.push("kumar"); obj.push("mamidala"); foreach (var item in obj) Console.WriteLine(item); About Difference b/w Pop() and Peek()? using System.Linq; using System.Runtime.Remoting.Messaging;

39 39 P a g e using System.Reflection; using System.Threading; namespace // Creates and initializes a new Statck. Stack mys = new Stack(); mys.push("the"); mys.push("quick"); mys.push("brown"); mys.push("fox"); // Displays the Stack. Console.Write("Stack values:"); PrintValues(myS); // Removes an element from the Stack. Console.WriteLine("(Pop)\t0", mys.pop()); // Displays the Stack. Console.Write("Stack values:"); PrintValues(myS); // Removes another element from the Stack. Console.WriteLine("(Dequeue)\t0", mys.pop()); // Displays the Stack. Console.Write("Stack values:"); PrintValues(myS); // Views the first element in the Stack but does not remove it. Console.WriteLine("(Peek) \t0", mys.peek()); // Displays the Stack. Console.Write("Stack values:"); PrintValues(myS); public static void PrintValues(IEnumerable mycollection) foreach (Object obj in mycollection) Console.Write(" 0", obj); Console.WriteLine();

40 40 P a g e About Queue? namespace //Queue is used to store non-homogeneous data types in First In First Out(FIFO) order under a common name Queue obj = new Queue(); obj.enqueue("madhan"); obj.enqueue("kumar"); obj.enqueue("mamidala"); foreach (var item in obj) Console.WriteLine(item); About difference b/w DeQueue() and Peek()? using System.Linq; using System.Runtime.Remoting.Messaging; using System.Reflection; using System.Threading; namespace

41 41 P a g e // Creates and initializes a new Queue. Queue myq = new Queue(); myq.enqueue("the"); myq.enqueue("quick"); myq.enqueue("brown"); myq.enqueue("fox"); // Displays the Queue. Console.Write("Queue values:"); PrintValues(myQ); // Removes an element from the Queue. Console.WriteLine("(Dequeue)\t0", myq.dequeue()); // Displays the Queue. Console.Write("Queue values:"); PrintValues(myQ); // Removes another element from the Queue. Console.WriteLine("(Dequeue)\t0", myq.dequeue()); // Displays the Queue. Console.Write("Queue values:"); PrintValues(myQ); // Views the first element in the Queue but does not remove it. Console.WriteLine("(Peek) \t0", myq.peek()); // Displays the Queue. Console.Write("Queue values:"); PrintValues(myQ); public static void PrintValues(IEnumerable mycollection) foreach (Object obj in mycollection) Console.Write(" 0", obj); Console.WriteLine(); About Generic Collection Dictionary?

42 42 P a g e namespace //Dictionary is used to store specified homogeneous data types with Key and Value pairs under a common name Dictionary<int, string> Dint =new Dictionary<int, string>(); // Add some elements to the dictionary. Dint.Add(1, "Student 1"); Dint.Add(2, "Student 2"); Dint.Add(3, "Student 3"); Dint.Add(4, "Student 4"); // The Add method throws an exception if the new key is // already in the dictionary. //Dint.Add(3, "Student 5"); // The Item property is another name for the indexer, so you // can omit its name when accessing elements. Console.WriteLine("For key = \"1\", value = 0.",Dint[1]); About Generic Collection List? namespace //List is used to store specified homogeneous data types under a common name List<int> lststudentint = new List<int>();

43 43 P a g e lststudentint.add(1); lststudentint.add(2); lststudentint.add(3); lststudentint.add(4); lststudentint.add(5); //lststudent.add("student 1"); Console.WriteLine(); foreach (int dinosaur in lststudentint) Console.WriteLine(dinosaur); About Generic Collection Queue? namespace //Queue is used to store specified homogeneous data types with FIFO order under a common name Queue<string> numbers = new Queue<string>(); numbers.enqueue("one"); numbers.enqueue("two"); numbers.enqueue("three"); numbers.enqueue("four"); numbers.enqueue("five"); // A queue can be enumerated without disturbing its contents. foreach (string number in numbers) Console.WriteLine(number); Console.WriteLine("\nDequeuing '0'", numbers.dequeue()); Console.WriteLine("Peek at next item to dequeue: 0", numbers.peek()); Console.WriteLine("Dequeuing '0'", numbers.dequeue());

44 44 P a g e About Generic Collection Stack? namespace //Stack is used to store specified homogeneous data types with FILO order under a common name ////Stack Stack<string> numbers = new Stack<string>(); numbers.push("one"); numbers.push("two"); numbers.push("three"); numbers.push("four"); numbers.push("five"); // A stack can be enumerated without disturbing its contents. foreach (string number in numbers) Console.WriteLine(number); Console.WriteLine("\nPopping '0'", numbers.pop()); Console.WriteLine("Pop at next item to destack: 0", numbers.peek()); Console.WriteLine("Popping '0'", numbers.pop()); About SortedList?

45 45 P a g e namespace ////SortedList is apply sort order for the elements automatically SortedList<int, string> Slst =new SortedList<int, string>(); //Add some elements to the dictionary. Slst.Add(1, "Student 1"); Slst.Add(3, "Student 3"); Slst.Add(2, "Student 2"); Slst.Add(4, "Student 4"); // The Add method throws an exception if the new key is // already in the dictionary. //Dint.Add(3, "Student 5"); foreach (KeyValuePair<int, string> kvp in Slst) Console.WriteLine("Key = 0, Value = 1", kvp.key, kvp.value); About IEnumerable? using System.Linq; using System.Runtime.Remoting.Messaging; using System.Reflection; using System.Threading; using System.Data.SqlClient; namespace //IEnumerable

46 46 P a g e //It is a read only collection. //It iterates only in forward direction. //It does not support adding, removing objects on collection. //It provides enumerator to iterate collection in forward direction. class Category public string Name get; set; public int ID get; set; List<Category> categories = new List<Category>() new Category()Name="Beverages", ID=001, new Category()Name="Condiments", ID=002, new Category()Name="Vegetables", ID=003, new Category()Name="Grains", ID=004, new Category()Name="Fruit", ID=005 ; IEnumerable<Category> categories1 = categories; foreach (var item in categories1) Console.WriteLine("0 1", item.id, item.name); About IQueryable? using System.Linq; using System.Runtime.Remoting.Messaging; using System.Reflection; using System.Threading; using System.Data.SqlClient; namespace //IQueryable

47 47 P a g e //If you are fetching records from remote databases IQueryable<T> should be used. It constructs the query using an Expression Tree. //When to use //Working with the queryable datasource //Need to apply filter on data at the datasource //Need to apply paging, composition //Working with external data source //Needs to load data in deferred way //Need to use foreach to iterate collection class Category public string Name get; set; public int ID get; set; MyDataContext dc = new MyDataContext(); IQueryable<Category> list = dc.category.where(p => p.name.startswith("s")); list = list.take<category>(10); foreach (var item in list) Console.WriteLine("0 1", item.id, item.name); What's the difference between IEnumerable<T> and List<T>? 1. IEnumerable is an interface, where as List is one specific implementation of IEnumerable. List is a class. 2. FOR-EACH loop is the only possible way to iterate through a collection of IEnumerable, where as List can be iterated using several ways. List can also be indexed by an int index, element can be added to and removed from and have items inserted at a particular index. 3. IEnumerable doesn't allow random access, where as List does allow random access using integral index. 4. In general from a performance standpoint, iterating thru IEnumerable is much faster than iterating thru a List.

48 48 P a g e About Class? namespace //Class is a collection of member variables and member methods //Class contains Destructor where as struct doesn't //Class will support inheritance class Customer //Fields public string _firstname; public string _lastname; //Property public string name get; set; //Constructor to initialize fields public Customer(string FirstName, string LastName) _firstname = FirstName; _lastname = LastName; //Destructor to release objects ~Customer() //Method public void PrintFullName() Console.WriteLine("Full Name : " + _firstname + " " + _lastname); Customer cust = new Customer("Mamidala", "Madhan"); cust.printfullname();

49 49 P a g e About public access modifier? namespace // public-the type or member can be accessed by any other code in the same assembly or another assembly that references it. class Customer //Fields public string _firstname; public string _lastname; //Property public string name get; set; //Constructor to initialize fields public Customer(string FirstName, string LastName) _firstname = FirstName; _lastname = LastName; //Destructor to release objects ~Customer() //Method public void PrintFullName() Console.WriteLine("Full Name : " + _firstname + " " + _lastname);

50 50 P a g e Customer cust = new Customer("Mamidala", "Madhan"); cust.printfullname(); About private Access Modifier? namespace //private:the type or member can be accessed only by code in the same class or struct. class Customer //Fields private string _firstname; private string _lastname; //Constructor to initialize fields public Customer(string FirstName, string LastName) _firstname = FirstName; _lastname = LastName; private void PrintFullName() Console.WriteLine("Full Name : " + _firstname + " " + _lastname); Customer cust = new Customer("Mamidala", "Madhan"); //Which is not accessible out side of the class //cust.printfullname();

51 51 P a g e About protected Access Modifier? namespace ////protected:the type or member can be accessed only by code in the same class or struct, or in a class that is derived from that class. class Customer //Fields protected string _firstname; protected string _lastname; public Customer() //Constructor to initialize fields public Customer(string FirstName, string LastName) _firstname = FirstName; _lastname = LastName; protected void PrintFullName() Console.WriteLine("Full Name : " + _firstname + " " + _lastname); class CustomerDerived : Customer public CustomerDerived(string FirstName, string LastName) _firstname = FirstName; _lastname = LastName;

52 52 P a g e public void TestPrint() //protected member which is accessible by derived class PrintFullName(); CustomerDerived cust = new CustomerDerived("Madhan","Mamidala"); cust.testprint(); About properties? namespace //Properties //Properties provides ability to validate user input values to class members //Properties provide ability to make class members as readonly class Student //public int ID; //public string Name; //public int Passmark=35; private int _id; private string _name; private int _passmark = 35; public int Id set if (value <= 0) throw new Exception("ID not to be negative");

53 53 P a g e _id = value; get return _id; public string Name set _name = value; get return _name; public int Passmark //set // // _passmark = value; // get return _passmark; //Auto implemented properties(c# compiler automatically create private fields automatically) public int City set; get; //Properties Student c = new Student(); c.id = -101;//we can validate the user input using properties c.name = "Madhan"; c.passmark = 0;//we can make class members as readonly

54 54 P a g e About default constructor? namespace //Constructor //Constructor is a special type of method,which has same name of class name and used to initialze the class variables //Every class by default have one constructor which ic=s called as default constructor class Student string Name; string Address; public Student() Name = "Madhan"; Address = "India"; public void Print() Console.WriteLine("Name is 0 and Address is 1", Name, Address); //Default constructor Student c = new Student(); c.print();

55 55 P a g e About parameter Constructor? namespace //Constructor //parameter Constructor is used to pass values for class members dynamically class Student string Name; string Address; public Student(string _Name,string _Address) Name = _Name; Address = _Address; public void Print() Console.WriteLine("Name is 0 and Address is 1", Name, Address); //Parameter constructor Student c = new Student("Madhan","India"); c.print(); About static constructor?

56 56 P a g e namespace //Constructor //static Constructor calls only one time when first object creation //where as normal constructor calls every time when new object create for the class class StaticConstructor //public int a; //static public int b; public StaticConstructor() Console.WriteLine("In Instance Constructor"); static StaticConstructor() Console.WriteLine("In Static Constructor"); //static constructor StaticConstructor c1 = new StaticConstructor(); StaticConstructor c2 = new StaticConstructor(); About copy constructor? namespace

57 57 P a g e //Constructor //copy Constructor accepts object as a parameter class CopyConstructor //public int a; //static public int b; int A, B; public CopyConstructor(int X, int Y) A = X; B = Y; //Copy Constructor public CopyConstructor(CopyConstructor T) A = T.A; B = T.B; public void Print() Console.WriteLine("A = 0\tB = 1", A, B); CopyConstructor c1 = new CopyConstructor(10, 20); CopyConstructor c2 = new CopyConstructor(c1); c1.print(); c2.print();

58 58 P a g e About private constructor? namespace //Constructor //private Constructor oppose to create object for a class class PrivateConstructor static public int b = 10; static public int c = 20; private PrivateConstructor() //object creation of a class which contains private constructor gives an error //PrivateConstructor c1 = new PrivateConstructor(); PrivateConstructor.b = 50; PrivateConstructor.c = 60; Console.WriteLine("b value 0 c value 1", PrivateConstructor.b, PrivateConstructor.c);

59 59 P a g e About static class? namespace // ////Static Class (For Static class we can't create instance) static class Customer //Fields static string _firstname; static string _lastname; // (Default Constructor) static Customer() _firstname = "Madhan"; _lastname = "Mamidala"; static public void PrintFullName() Console.WriteLine("Full Name : " + _firstname + " " + _lastname); ////Static Class Customer.PrintFullName();

60 60 P a g e About abstract class? namespace //////Abstract Class (For Abstract class also we can't create instance) //abstract class will contains instance methods as well as abstract methods(a method which contains signature but not defination /implementation called as Abstract method) abstract class Customer //Fields public string _firstname; public string _lastname; // (Default Constructor) public Customer() _firstname = "Madhan"; _lastname = "Mamidala"; public abstract void PrintFullName(); class DerivedCustomer:Customer public override void PrintFullName() Console.WriteLine("First name is 0 Last Name is 1",base._firstName,base._lastName); ////abstarct Class doesn't support object creation //Customer c = new Customer(); DerivedCustomer d = new DerivedCustomer(); d.printfullname();

61 61 P a g e About interface? namespace //interface can contains only abstarct methods //interface can contains properties interface ICustomer //properties string Name get; set; string Address get; set; //publich and abstarct methods(but no need to mention them as public and abstract) void PrintName(); void PrintAddress(); class Customer:ICustomer //implemeting properties of a interface private string name; public string Name get return name; set name = value; private string address; public string Address get return address; set

62 62 P a g e address = value; //implementing methods of a interface public void PrintName() Console.WriteLine("Name : 0", Name); public void PrintAddress() Console.WriteLine("Address : 0", Address); Customer d = new Customer(); d.name = "Madhan"; d.address = "India"; d.printname(); d.printaddress(); About partial class? namespace //////Partial Class (Spilt the functionality in to two or more classes) partial class Customer //Fields public string _firstname; public string _lastname;

63 63 P a g e // (Default Constructor) public Customer() _firstname = "Madhan"; _lastname = "Mamidala"; public void PrintFirstName() Console.WriteLine("First Name : 0", _firstname); partial class Customer public void PrintLastName() Console.WriteLine("Last Name : 0", _lastname); Customer d = new Customer(); //runtime compiler clubs all the methods in to single class d.printfirstname(); d.printlastname(); About Data Abstraction and Encapsulation? In the following program in order to calculate the Division of 2 numbers user needs to call two methods which are Validate() and Calculate(),which is complex to the end user.

64 64 P a g e namespace ////Data Abstraction(Providing only necessary details to the user) and Data Encapsulation(Hiding the complxity to the user) class DivideFunction public int FirstNumber; public int SecondNumber; public DivideFunction(int firstnumber, int secondnumber) FirstNumber = firstnumber; SecondNumber = secondnumber; public void Validate() if (SecondNumber == 0) throw new Exception("Divident must not be zero"); public double Calculate() return FirstNumber / SecondNumber; //Data Absraction and Data Encapsulation Calculate() DivideFunction d = new DivideFunction(10, 5); try //inorder to calculate Division user needs to call Validate() and d.validate(); double dd = d.calculate(); Console.WriteLine(dd); catch (Exception ex) Console.WriteLine(ex.Message);

65 65 P a g e To reduce the complexity to the end user we are calling Validate() in Calculate() method itself, so end user can use Calculate() to get Division of two numbers. The process of reducing the complexity to the end user is called as Encapsulation. namespace ////Data Abstraction(Providing only necessary details to the user) and Data Encapsulation(Hiding the complxity to the user) class DivideFunction public int FirstNumber; public int SecondNumber; public DivideFunction(int firstnumber, int secondnumber) FirstNumber = firstnumber; SecondNumber = secondnumber; public void Validate() if (SecondNumber == 0) throw new Exception("Divident must not be zero"); public double Calculate() Validate(); return FirstNumber / SecondNumber;

66 66 P a g e //Data Absraction and Data Encapsulation only DivideFunction d = new DivideFunction(10, 5); try //inorder to calculate Division,now user needs to call Calculate() method //Reducing the complexity to the end user is called as Encapsulation. double dd = d.calculate(); Console.WriteLine(dd); catch (Exception ex) Console.WriteLine(ex.Message); But still user can call the Validate() method as it is public method, lets hide Validate() by making it as private so user can t see the Validate(). The process of hiding unnecessary data to the end user is called as Data Abstarction. Here we are hiding the Validate() method to the end user. namespace ////Data Abstraction(Providing only necessary details to the user) and Data Encapsulation(Hiding the complxity to the user) class DivideFunction public int FirstNumber; public int SecondNumber; public DivideFunction(int firstnumber, int secondnumber) FirstNumber = firstnumber; SecondNumber = secondnumber; //Hiding the Validate() method by mentioning it as private,this process is calles as Data Abstraction

67 67 P a g e private void Validate() if (SecondNumber == 0) throw new Exception("Divident must not be zero"); public double Calculate() Validate(); return FirstNumber / SecondNumber; //Data Absraction and Data Encapsulation only DivideFunction d = new DivideFunction(10, 5); try //inorder to calculate Division,now user needs to call Calculate() method //Reducing the complexity to the end user is called as Encapsulation. double dd = d.calculate(); Console.WriteLine(dd); catch (Exception ex) Console.WriteLine(ex.Message); About Method Overloading? namespace

68 68 P a g e //Method Overloading //One ore more methods in same class with same name and same Method signature,is called as Method Overloading //Method oveloading doesn't include return type Program p = new Program(); p.add(5, 10); p.add(5, 10, 15); //Method Overloading public void Add(int a, int b) Console.WriteLine(a + b); public void Add(int a, int b, int c) Console.WriteLine(a + b + c); About Operator Overloading? namespace //Operator Overloading //Overloading operators to work with objects is called as operator overloading class Box private double length; // Length of a box private double breadth; // Breadth of a box private double height; // Height of a box

69 69 P a g e public Box() public Box(double _length, double _breadth, double _height) length = _length; breadth = _breadth; height = _height; public double getvolume() return length * breadth * height; //// Overload + operator to add two Box objects. public static Box operator +(Box b, Box c) Box box = new Box(); box.length = b.length + c.length; box.breadth = b.breadth + c.breadth; box.height = b.height + c.height; return box; //Method Overloading //////Operator Overloading Box Box1 = new Box(10, 20, 30); // Declare Box1 of type Box Box Box2 = new Box(40, 50, 60); // Declare Box2 of type Box Box Box3 = new Box(); // Declare Box3 of type Box double volume = 0.0; // Add two object as follows: //Here we are overloading + operator to add two objects Box3 = Box1 + Box2; // volume of box 3 volume = Box3.getVolume(); Console.WriteLine("Volume of Box3 : 0", volume);

1 P a g e. C#.Net. MakeMeSharp Enjoy unlimited learning!

1 P a g e. C#.Net. MakeMeSharp Enjoy unlimited learning! 1 P a g e C#.Net 2 P a g e Table of Contents 1. About.Net?... 8 2. About.Net Framework... 9 3. About Common Language Runtime (CLR) and its Services?... 13 4. What is managed code in.net?... 14 5. What

More information

ISRA University Faculty of IT. Textbook BARBARA DOYLE C# Programming: From Problem Analysis to Program Design 4 th Edition

ISRA University Faculty of IT. Textbook BARBARA DOYLE C# Programming: From Problem Analysis to Program Design 4 th Edition 4 Programming Fundamentals 605116 ISRA University Faculty of IT Textbook BARBARA DOYLE C# Programming: From Problem Analysis to Program Design 4 th Edition Prepared by IT Faculty members 1 5 Console Input

More information

Console Input / Output

Console Input / Output Table of Contents Console Input / Output Printing to the Console Printing Strings and Numbers Reading from the Console Reading Characters Reading Strings Parsing Strings to Numeral Types Reading Numeral

More information

Introduction to C# Applications

Introduction to C# Applications 1 2 3 Introduction to C# Applications OBJECTIVES To write simple C# applications To write statements that input and output data to the screen. To declare and use data of various types. To write decision-making

More information

Object-Oriented Programming

Object-Oriented Programming Object-Oriented Programming 1. What is object-oriented programming (OOP)? OOP is a technique to develop logical modules, such as classes that contain properties, methods, fields, and events. An object

More information

C# Fundamentals. Hans-Wolfgang Loidl School of Mathematical and Computer Sciences, Heriot-Watt University, Edinburgh

C# Fundamentals. Hans-Wolfgang Loidl School of Mathematical and Computer Sciences, Heriot-Watt University, Edinburgh C# Fundamentals Hans-Wolfgang Loidl School of Mathematical and Computer Sciences, Heriot-Watt University, Edinburgh Semester 1 2018/19 H-W. Loidl (Heriot-Watt Univ) F20SC/F21SC 2018/19

More information

DigiPen Institute of Technology

DigiPen Institute of Technology DigiPen Institute of Technology Presents Session Two: Overview of C# Programming DigiPen Institute of Technology 5001 150th Ave NE, Redmond, WA 98052 Phone: (425) 558-0299 www.digipen.edu 2005 DigiPen

More information

C# Types. Industrial Programming. Value Types. Signed and Unsigned. Lecture 3: C# Fundamentals

C# Types. Industrial Programming. Value Types. Signed and Unsigned. Lecture 3: C# Fundamentals C# Types Industrial Programming Lecture 3: C# Fundamentals Industrial Programming 1 Industrial Programming 2 Value Types Memory location contains the data. Integers: Signed: sbyte, int, short, long Unsigned:

More information

Industrial Programming

Industrial Programming Industrial Programming Lecture 3: C# Fundamentals Industrial Programming 1 C# Types Industrial Programming 2 Value Types Memory location contains the data. Integers: Signed: sbyte, int, short, long Unsigned:

More information

DC69 C# &.NET JUNE C# is a simple, modern, object oriented language derived from C++ and Java.

DC69 C# &.NET JUNE C# is a simple, modern, object oriented language derived from C++ and Java. Q.2 a. What is C#? Discuss its features in brief. 1. C# is a simple, modern, object oriented language derived from C++ and Java. 2. It aims to combine the high productivity of Visual Basic and the raw

More information

Computing is about Data Processing (or "number crunching") Object Oriented Programming is about Cooperating Objects

Computing is about Data Processing (or number crunching) Object Oriented Programming is about Cooperating Objects Computing is about Data Processing (or "number crunching") Object Oriented Programming is about Cooperating Objects C# is fully object-oriented: Everything is an Object: Simple Types, User-Defined Types,

More information

Contents. Figures. Tables. Examples. Foreword. Preface. 1 Basics of Java Programming 1. xix. xxi. xxiii. xxvii. xxix

Contents. Figures. Tables. Examples. Foreword. Preface. 1 Basics of Java Programming 1. xix. xxi. xxiii. xxvii. xxix PGJC4_JSE8_OCA.book Page ix Monday, June 20, 2016 2:31 PM Contents Figures Tables Examples Foreword Preface xix xxi xxiii xxvii xxix 1 Basics of Java Programming 1 1.1 Introduction 2 1.2 Classes 2 Declaring

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

Short Notes of CS201

Short Notes of CS201 #includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system

More information

Index COPYRIGHTED MATERIAL

Index COPYRIGHTED MATERIAL Index COPYRIGHTED MATERIAL Note to the Reader: Throughout this index boldfaced page numbers indicate primary discussions of a topic. Italicized page numbers indicate illustrations. A abstract classes

More information

CS201 - Introduction to Programming Glossary By

CS201 - Introduction to Programming Glossary By CS201 - Introduction to Programming Glossary By #include : The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with

More information

MCSA Universal Windows Platform. A Success Guide to Prepare- Programming in C# edusum.com

MCSA Universal Windows Platform. A Success Guide to Prepare- Programming in C# edusum.com 70-483 MCSA Universal Windows Platform A Success Guide to Prepare- Programming in C# edusum.com Table of Contents Introduction to 70-483 Exam on Programming in C#... 2 Microsoft 70-483 Certification Details:...

More information

Microsoft. Microsoft Visual C# Step by Step. John Sharp

Microsoft. Microsoft Visual C# Step by Step. John Sharp Microsoft Microsoft Visual C#- 2010 Step by Step John Sharp Table of Contents Acknowledgments Introduction xvii xix Part I Introducing Microsoft Visual C# and Microsoft Visual Studio 2010 1 Welcome to

More information

Index. object lifetimes, and ownership, use after change by an alias errors, use after drop errors, BTreeMap, 309

Index. object lifetimes, and ownership, use after change by an alias errors, use after drop errors, BTreeMap, 309 A Arithmetic operation floating-point arithmetic, 11 12 integer numbers, 9 11 Arrays, 97 copying, 59 60 creation, 48 elements, 48 empty arrays and vectors, 57 58 executable program, 49 expressions, 48

More information

DC69 C# and.net JUN 2015

DC69 C# and.net JUN 2015 Solutions Q.2 a. What are the benefits of.net strategy advanced by Microsoft? (6) Microsoft has advanced the.net strategy in order to provide a number of benefits to developers and users. Some of the major

More information

Object-Oriented Programming in C# (VS 2015)

Object-Oriented Programming in C# (VS 2015) Object-Oriented Programming in C# (VS 2015) This thorough and comprehensive 5-day course is a practical introduction to programming in C#, utilizing the services provided by.net. This course emphasizes

More information

Object-Oriented Programming in C# (VS 2012)

Object-Oriented Programming in C# (VS 2012) Object-Oriented Programming in C# (VS 2012) This thorough and comprehensive course is a practical introduction to programming in C#, utilizing the services provided by.net. This course emphasizes the C#

More information

C#.Net. Course Contents. Course contents VT BizTalk. No exam, but laborations

C#.Net. Course Contents. Course contents VT BizTalk. No exam, but laborations , 1 C#.Net VT 2009 Course Contents C# 6 hp approx. BizTalk 1,5 hp approx. No exam, but laborations Course contents Architecture Visual Studio Syntax Classes Forms Class Libraries Inheritance Other C# essentials

More information

Objectives. Introduce the core C# language features class Main types variables basic input and output operators arrays control constructs comments

Objectives. Introduce the core C# language features class Main types variables basic input and output operators arrays control constructs comments Basics Objectives Introduce the core C# language features class Main types variables basic input and output operators arrays control constructs comments 2 Class Keyword class used to define new type specify

More information

Absolute C++ Walter Savitch

Absolute C++ Walter Savitch Absolute C++ sixth edition Walter Savitch Global edition This page intentionally left blank Absolute C++, Global Edition Cover Title Page Copyright Page Preface Acknowledgments Brief Contents Contents

More information

Duhok Polytechnic University Amedi Technical Institute/ IT Dept. Halkawt Rajab Hussain

Duhok Polytechnic University Amedi Technical Institute/ IT Dept. Halkawt Rajab Hussain Duhok Polytechnic University Amedi Technical Institute/ IT Dept. By Halkawt Rajab Hussain 2016-04-02 Overview. C# program structure. Variables and Constant. Conditional statement (if, if/else, nested if

More information

How to be a C# ninja in 10 easy steps. Benjamin Day

How to be a C# ninja in 10 easy steps. Benjamin Day How to be a C# ninja in 10 easy steps Benjamin Day Benjamin Day Consultant, Coach, Trainer Scrum.org Classes Professional Scrum Developer (PSD) Professional Scrum Foundations (PSF) TechEd, VSLive, DevTeach,

More information

EEE-425 Programming Languages (2013) 1

EEE-425 Programming Languages (2013) 1 2 Namespaces Classes Fields Properties Methods Attributes Events Interfaces (contracts) Methods Properties Events Control Statements if, else, while, for, switch foreach Additional Features Operation Overloading

More information

Hierarchical inheritance: Contains one base class and multiple derived classes of the same base class.

Hierarchical inheritance: Contains one base class and multiple derived classes of the same base class. 1. What is C#? C# (pronounced "C sharp") is a simple, modern, object oriented, and type safe programming language. It will immediately be familiar to C and C++ programmers. C# combines the high productivity

More information

Microsoft Visual C# Step by Step. John Sharp

Microsoft Visual C# Step by Step. John Sharp Microsoft Visual C# 2013 Step by Step John Sharp Introduction xix PART I INTRODUCING MICROSOFT VISUAL C# AND MICROSOFT VISUAL STUDIO 2013 Chapter 1 Welcome to C# 3 Beginning programming with the Visual

More information

1 Epic Test Review 2 Epic Test Review 3 Epic Test Review 4. Epic Test Review 5 Epic Test Review 6 Epic Test Review 7 Epic Test Review 8

1 Epic Test Review 2 Epic Test Review 3 Epic Test Review 4. Epic Test Review 5 Epic Test Review 6 Epic Test Review 7 Epic Test Review 8 Epic Test Review 1 Epic Test Review 2 Epic Test Review 3 Epic Test Review 4 Write a line of code that outputs the phase Hello World to the console without creating a new line character. System.out.print(

More information

Learn C# Errata. 3-9 The Nullable Types The Assignment Operators

Learn C# Errata. 3-9 The Nullable Types The Assignment Operators 1 The following pages show errors from the original edition, published in July 2008, corrected in red. Future editions of this book will be printed with these corrections. We apologize for any inconvenience

More information

C#: framework overview and in-the-small features

C#: framework overview and in-the-small features Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer C#: framework overview and in-the-small features Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer

More information

SOFTWARE DEVELOPMENT 1. Strings and Enumerations 2018W A. Ferscha (Institute of Pervasive Computing, JKU Linz)

SOFTWARE DEVELOPMENT 1. Strings and Enumerations 2018W A. Ferscha (Institute of Pervasive Computing, JKU Linz) SOFTWARE DEVELOPMENT 1 Strings and Enumerations 2018W (Institute of Pervasive Computing, JKU Linz) CHARACTER ENCODING On digital systems, each character is represented by a specific number. The character

More information

Weiss Chapter 1 terminology (parenthesized numbers are page numbers)

Weiss Chapter 1 terminology (parenthesized numbers are page numbers) Weiss Chapter 1 terminology (parenthesized numbers are page numbers) assignment operators In Java, used to alter the value of a variable. These operators include =, +=, -=, *=, and /=. (9) autoincrement

More information

Chapter 1 Getting Started

Chapter 1 Getting Started Chapter 1 Getting Started The C# class Just like all object oriented programming languages, C# supports the concept of a class. A class is a little like a data structure in that it aggregates different

More information

Introduce C# as Object Oriented programming language. Explain, tokens,

Introduce C# as Object Oriented programming language. Explain, tokens, Module 2 98 Assignment 1 Introduce C# as Object Oriented programming language. Explain, tokens, lexicals and control flow constructs. 99 The C# Family Tree C Platform Independence C++ Object Orientation

More information

COPYRIGHTED MATERIAL. Contents. Part I: C# Fundamentals 1. Chapter 1: The.NET Framework 3. Chapter 2: Getting Started with Visual Studio

COPYRIGHTED MATERIAL. Contents. Part I: C# Fundamentals 1. Chapter 1: The.NET Framework 3. Chapter 2: Getting Started with Visual Studio Introduction XXV Part I: C# Fundamentals 1 Chapter 1: The.NET Framework 3 What s the.net Framework? 3 Common Language Runtime 3.NET Framework Class Library 4 Assemblies and the Microsoft Intermediate Language

More information

Java enum, casts, and others (Select portions of Chapters 4 & 5)

Java enum, casts, and others (Select portions of Chapters 4 & 5) Enum or enumerates types Java enum, casts, and others (Select portions of Chapters 4 & 5) Sharma Chakravarthy Information Technology Laboratory (IT Lab) Computer Science and Engineering Department The

More information

Course Hours

Course Hours Programming the.net Framework 4.0/4.5 with C# 5.0 Course 70240 40 Hours Microsoft's.NET Framework presents developers with unprecedented opportunities. From 'geoscalable' web applications to desktop and

More information

Learning C# 3.0. Jesse Liberty and Brian MacDonald O'REILLY. Beijing Cambridge Farnham Köln Sebastopol Taipei Tokyo

Learning C# 3.0. Jesse Liberty and Brian MacDonald O'REILLY. Beijing Cambridge Farnham Köln Sebastopol Taipei Tokyo Learning C# 3.0 Jesse Liberty and Brian MacDonald O'REILLY Beijing Cambridge Farnham Köln Sebastopol Taipei Tokyo Table of Contents Preface xv 1. C# and.net Programming 1 Installing C# Express 2 C# 3.0

More information

22c:111 Programming Language Concepts. Fall Types I

22c:111 Programming Language Concepts. Fall Types I 22c:111 Programming Language Concepts Fall 2008 Types I Copyright 2007-08, The McGraw-Hill Company and Cesare Tinelli. These notes were originally developed by Allen Tucker, Robert Noonan and modified

More information

DC69 C# &.NET DEC 2015

DC69 C# &.NET DEC 2015 Q.2 a. Briefly explain the advantage of framework base classes in.net. (5).NET supplies a library of base classes that we can use to implement applications quickly. We can use them by simply instantiating

More information

1 Shyam sir JAVA Notes

1 Shyam sir JAVA Notes 1 Shyam sir JAVA Notes 1. What is the most important feature of Java? Java is a platform independent language. 2. What do you mean by platform independence? Platform independence means that we can write

More information

Upcoming Features in C# Mads Torgersen, MSFT

Upcoming Features in C# Mads Torgersen, MSFT Upcoming Features in C# Mads Torgersen, MSFT This document describes language features currently planned for C# 6, the next version of C#. All of these are implemented and available in VS 2015 Preview.

More information

Introduction To C#.NET

Introduction To C#.NET Introduction To C#.NET Microsoft.Net was formerly known as Next Generation Windows Services(NGWS).It is a completely new platform for developing the next generation of windows/web applications. However

More information

COP 3330 Final Exam Review

COP 3330 Final Exam Review COP 3330 Final Exam Review I. The Basics (Chapters 2, 5, 6) a. comments b. identifiers, reserved words c. white space d. compilers vs. interpreters e. syntax, semantics f. errors i. syntax ii. run-time

More information

Java and C# in Depth Carlo A. Furia, Marco Piccioni, Bertrand Meyer

Java and C# in Depth Carlo A. Furia, Marco Piccioni, Bertrand Meyer Java and C# in Depth Carlo A. Furia, Marco Piccioni, Bertrand Meyer Exercise Session Week 2 Agenda Ø Quizzes Ø More quizzes Ø And even more quizzes 2 Quiz 1. What will be printed? Ø Integers public class

More information

Visual C# 2012 How to Program by Pe ars on Ed uc ati on, Inc. All Ri ght s Re ser ve d.

Visual C# 2012 How to Program by Pe ars on Ed uc ati on, Inc. All Ri ght s Re ser ve d. Visual C# 2012 How to Program 1 99 2-20 14 by Pe ars on Ed uc ati on, Inc. All Ri ght s Re ser ve d. 1992-2014 by Pearson Education, Inc. All 1992-2014 by Pearson Education, Inc. All Although commonly

More information

.Net Technologies. Components of.net Framework

.Net Technologies. Components of.net Framework .Net Technologies Components of.net Framework There are many articles are available in the web on this topic; I just want to add one more article over the web by explaining Components of.net Framework.

More information

Introduction to Visual Basic and Visual C++ Introduction to Java. JDK Editions. Overview. Lesson 13. Overview

Introduction to Visual Basic and Visual C++ Introduction to Java. JDK Editions. Overview. Lesson 13. Overview Introduction to Visual Basic and Visual C++ Introduction to Java Lesson 13 Overview I154-1-A A @ Peter Lo 2010 1 I154-1-A A @ Peter Lo 2010 2 Overview JDK Editions Before you can write and run the simple

More information

1 C# 6.0: Practical Guide 6.0. Practical Guide. By: Mukesh Kumar.

1 C# 6.0: Practical Guide 6.0. Practical Guide. By: Mukesh Kumar. 1 C# 6.0: Practical Guide C# 6.0 Practical Guide By: Mukesh Kumar 2 C# 6.0: Practical Guide Disclaimer & Copyright Copyright 2016 by mukeshkumar.net All rights reserved. Share this ebook as it is, don

More information

DOWNLOAD PDF CORE JAVA APTITUDE QUESTIONS AND ANSWERS

DOWNLOAD PDF CORE JAVA APTITUDE QUESTIONS AND ANSWERS Chapter 1 : Chapter-wise Java Multiple Choice Questions and Answers Interview MCQs Java Programming questions and answers with explanation for interview, competitive examination and entrance test. Fully

More information

Prerequisites: The student should have programming experience in a high-level language. ITCourseware, LLC Page 1. Object-Oriented Programming in C#

Prerequisites: The student should have programming experience in a high-level language. ITCourseware, LLC Page 1. Object-Oriented Programming in C# Microsoft s.net is a revolutionary advance in programming technology that greatly simplifies application development and is a good match for the emerging paradigm of Web-based services, as opposed to proprietary

More information

Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach.

Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach. CMSC 131: Chapter 28 Final Review: What you learned this semester The Big Picture Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach. Java

More information

CSC Java Programming, Fall Java Data Types and Control Constructs

CSC Java Programming, Fall Java Data Types and Control Constructs CSC 243 - Java Programming, Fall 2016 Java Data Types and Control Constructs Java Types In general, a type is collection of possible values Main categories of Java types: Primitive/built-in Object/Reference

More information

Stacks. stacks of dishes or trays in a cafeteria. Last In First Out discipline (LIFO)

Stacks. stacks of dishes or trays in a cafeteria. Last In First Out discipline (LIFO) Outline stacks stack ADT method signatures array stack implementation linked stack implementation stack applications infix, prefix, and postfix expressions 1 Stacks stacks of dishes or trays in a cafeteria

More information

Pace University. Fundamental Concepts of CS121 1

Pace University. Fundamental Concepts of CS121 1 Pace University Fundamental Concepts of CS121 1 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University October 12, 2005 This document complements my tutorial Introduction

More information

Functional programming in C#

Functional programming in C# Functional programming in C# A quick approach to another paradigm Nacho Iborra IES San Vicente This work is licensed under the Creative Commons Attribution- NonCommercial-ShareAlike 4.0 International License.

More information

STRUCTURING OF PROGRAM

STRUCTURING OF PROGRAM Unit III MULTIPLE CHOICE QUESTIONS 1. Which of the following is the functionality of Data Abstraction? (a) Reduce Complexity (c) Parallelism Unit III 3.1 (b) Binds together code and data (d) None of the

More information

C# s A Doddle. Steve Love. ACCU April 2013

C# s A Doddle. Steve Love. ACCU April 2013 C# s A Doddle Steve Love ACCU April 2013 A run through C# (pronounced See Sharp ) is a simple, modern, object-oriented, and type-safe programming language. C# has its roots in the C family of languages,

More information

What property of a C# array indicates its allocated size? What keyword in the base class allows a method to be polymorphic?

What property of a C# array indicates its allocated size? What keyword in the base class allows a method to be polymorphic? What property of a C# array indicates its allocated size? a. Size b. Count c. Length What property of a C# array indicates its allocated size? a. Size b. Count c. Length What keyword in the base class

More information

Instantiation of Template class

Instantiation of Template class Class Templates Templates are like advanced macros. They are useful for building new classes that depend on already existing user defined classes or built-in types. Example: stack of int or stack of double

More information

Getter and Setter Methods

Getter and Setter Methods Example 1 namespace ConsoleApplication14 public class Student public int ID; public string Name; public int Passmark = 50; class Program static void Main(string[] args) Student c1 = new Student(); Console.WriteLine("please..enter

More information

Interview Questions I received in 2017 and 2018

Interview Questions I received in 2017 and 2018 Interview Questions I received in 2017 and 2018 Table of Contents INTERVIEW QUESTIONS I RECEIVED IN 2017 AND 2018... 1 1 OOPS... 3 1. What is the difference between Abstract and Interface in Java8?...

More information

Language Specification

Language Specification # Language Specification File: C# Language Specification.doc Last saved: 5/7/2001 Version 0.28 Copyright? Microsoft Corporation 1999-2000. All Rights Reserved. Please send corrections, comments, and other

More information

GIS 4653/5653: Spatial Programming and GIS. More Python: Statements, Types, Functions, Modules, Classes

GIS 4653/5653: Spatial Programming and GIS. More Python: Statements, Types, Functions, Modules, Classes GIS 4653/5653: Spatial Programming and GIS More Python: Statements, Types, Functions, Modules, Classes Statement Syntax The if-elif-else statement Indentation and and colons are important Parentheses and

More information

Index. Cambridge University Press Functional Programming Using F# Michael R. Hansen and Hans Rischel. Index.

Index. Cambridge University Press Functional Programming Using F# Michael R. Hansen and Hans Rischel. Index. (),23 (*,3 ->,3,32 *,11 *),3.[...], 27, 186 //,3 ///,3 ::, 71, 80 :=, 182 ;, 179 ;;,1 @, 79, 80 @"...",26 >,38,35

More information

C # Language Specification

C # Language Specification C # Language Specification Copyright Microsoft Corporation 1999-2001. All Rights Reserved. Please send corrections, comments, and other feedback to sharp@microsoft.com Notice 1999-2001 Microsoft Corporation.

More information

Chapter 1 Summary. Chapter 2 Summary. end of a string, in which case the string can span multiple lines.

Chapter 1 Summary. Chapter 2 Summary. end of a string, in which case the string can span multiple lines. Chapter 1 Summary Comments are indicated by a hash sign # (also known as the pound or number sign). Text to the right of the hash sign is ignored. (But, hash loses its special meaning if it is part of

More information

Careerarm.com. Question 1. Orders table OrderId int Checked Deptno int Checked Amount int Checked

Careerarm.com. Question 1. Orders table OrderId int Checked Deptno int Checked Amount int Checked Question 1 Orders table OrderId int Checked Deptno int Checked Amount int Checked sales table orderid int Checked salesmanid int Checked Get the highest earning salesman in each department. select salesmanid,

More information

Methods: A Deeper Look

Methods: A Deeper Look 1 2 7 Methods: A Deeper Look OBJECTIVES In this chapter you will learn: How static methods and variables are associated with an entire class rather than specific instances of the class. How to use random-number

More information

MARKING KEY The University of British Columbia MARKING KEY Computer Science 260 Midterm #2 Examination 12:30 noon, Thursday, March 15, 2012

MARKING KEY The University of British Columbia MARKING KEY Computer Science 260 Midterm #2 Examination 12:30 noon, Thursday, March 15, 2012 MARKING KEY The University of British Columbia MARKING KEY Computer Science 260 Midterm #2 Examination 12:30 noon, Thursday, March 15, 2012 Instructor: K. S. Booth Time: 70 minutes (one hour ten minutes)

More information

Applied object oriented programming. 4 th lecture

Applied object oriented programming. 4 th lecture Applied object oriented programming 4 th lecture Today Constructors in depth Class inheritance Interfaces Standard.NET interfaces IComparable IComparer IEquatable IEnumerable ICloneable (and cloning) Kahoot

More information

Objectives. Describe ways to create constants const readonly enum

Objectives. Describe ways to create constants const readonly enum Constants Objectives Describe ways to create constants const readonly enum 2 Motivation Idea of constant is useful makes programs more readable allows more compile time error checking 3 Const Keyword const

More information

A Comparison of Visual Basic.NET and C#

A Comparison of Visual Basic.NET and C# Appendix B A Comparison of Visual Basic.NET and C# A NUMBER OF LANGUAGES work with the.net Framework. Microsoft is releasing the following four languages with its Visual Studio.NET product: C#, Visual

More information

Framework Fundamentals

Framework Fundamentals Questions Framework Fundamentals 1. Which of the following are value types? (Choose all that apply.) A. Decimal B. String C. System.Drawing.Point D. Integer 2. Which is the correct declaration for a nullable

More information

Francesco Nidito. Programmazione Avanzata AA 2007/08

Francesco Nidito. Programmazione Avanzata AA 2007/08 Francesco Nidito in the Programmazione Avanzata AA 2007/08 Outline 1 2 3 in the in the 4 Reference: Micheal L. Scott, Programming Languages Pragmatics, Chapter 7 What is a type? in the What is a type?

More information

VALLIAMMAI ENGINEERING COLLEGE

VALLIAMMAI ENGINEERING COLLEGE VALLIAMMAI ENGINEERING COLLEGE SRM Nagar, Kattankulathur 603 203 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK B.E. - Electrical and Electronics Engineering IV SEMESTER CS6456 - OBJECT ORIENTED

More information

Operators and Expressions

Operators and Expressions Operators and Expressions Conversions. Widening and Narrowing Primitive Conversions Widening and Narrowing Reference Conversions Conversions up the type hierarchy are called widening reference conversions

More information

OBJECT ORIENTED PROGRAMMING. Ms. Ajeta Nandal C.R.Polytechnic,Rohtak

OBJECT ORIENTED PROGRAMMING. Ms. Ajeta Nandal C.R.Polytechnic,Rohtak OBJECT ORIENTED PROGRAMMING Ms. Ajeta Nandal C.R.Polytechnic,Rohtak OBJECT ORIENTED PARADIGM Object 2 Object 1 Data Data Function Function Object 3 Data Function 2 WHAT IS A MODEL? A model is an abstraction

More information

Lecture 3. COMP1006/1406 (the Java course) Summer M. Jason Hinek Carleton University

Lecture 3. COMP1006/1406 (the Java course) Summer M. Jason Hinek Carleton University Lecture 3 COMP1006/1406 (the Java course) Summer 2014 M. Jason Hinek Carleton University today s agenda assignments 1 (graded) & 2 3 (available now) & 4 (tomorrow) a quick look back primitive data types

More information

Object oriented programming. Encapsulation. Polymorphism. Inheritance OOP

Object oriented programming. Encapsulation. Polymorphism. Inheritance OOP OOP Object oriented programming Polymorphism Encapsulation Inheritance OOP Class concepts Classes can contain: Constants Delegates Events Fields Constructors Destructors Properties Methods Nested classes

More information

02 Features of C#, Part 1. Jerry Nixon Microsoft Developer Evangelist Daren May President & Co-founder, Crank211

02 Features of C#, Part 1. Jerry Nixon Microsoft Developer Evangelist Daren May President & Co-founder, Crank211 02 Features of C#, Part 1 Jerry Nixon Microsoft Developer Evangelist Daren May President & Co-founder, Crank211 Module Overview Constructing Complex Types Object Interfaces and Inheritance Generics Constructing

More information

Lecture 12: Data Types (and Some Leftover ML)

Lecture 12: Data Types (and Some Leftover ML) Lecture 12: Data Types (and Some Leftover ML) COMP 524 Programming Language Concepts Stephen Olivier March 3, 2009 Based on slides by A. Block, notes by N. Fisher, F. Hernandez-Campos, and D. Stotts Goals

More information

CONTENTS. PART 1 Structured Programming 1. 1 Getting started 3. 2 Basic programming elements 17

CONTENTS. PART 1 Structured Programming 1. 1 Getting started 3. 2 Basic programming elements 17 List of Programs xxv List of Figures xxix List of Tables xxxiii Preface to second version xxxv PART 1 Structured Programming 1 1 Getting started 3 1.1 Programming 3 1.2 Editing source code 5 Source code

More information

C# Programming in the.net Framework

C# Programming in the.net Framework 50150B - Version: 2.1 04 May 2018 C# Programming in the.net Framework C# Programming in the.net Framework 50150B - Version: 2.1 6 days Course Description: This six-day instructor-led course provides students

More information

NOIDATUT E Leaning Platform

NOIDATUT E Leaning Platform NOIDATUT E Leaning Platform Dot Net Framework Lab Manual COMPUTER SCIENCE AND ENGINEERING Presented by: NOIDATUT Email : e-learn@noidatut.com www.noidatut.com C SHARP 1. Program to display Hello World

More information

Syllabus & Curriculum for Certificate Course in Java. CALL: , for Queries

Syllabus & Curriculum for Certificate Course in Java. CALL: , for Queries 1 CONTENTS 1. Introduction to Java 2. Holding Data 3. Controllin g the f l o w 4. Object Oriented Programming Concepts 5. Inheritance & Packaging 6. Handling Error/Exceptions 7. Handling Strings 8. Threads

More information

Question And Answer.

Question And Answer. Q.1 What would be the output of the following program? using System; namespaceifta classdatatypes static void Main(string[] args) inti; Console.WriteLine("i is not used inthis program!"); A. i is not used

More information

x = 3 * y + 1; // x becomes 3 * y + 1 a = b = 0; // multiple assignment: a and b both get the value 0

x = 3 * y + 1; // x becomes 3 * y + 1 a = b = 0; // multiple assignment: a and b both get the value 0 6 Statements 43 6 Statements The statements of C# do not differ very much from those of other programming languages. In addition to assignments and method calls there are various sorts of selections and

More information

Preface... (vii) CHAPTER 1 INTRODUCTION TO COMPUTERS

Preface... (vii) CHAPTER 1 INTRODUCTION TO COMPUTERS Contents Preface... (vii) CHAPTER 1 INTRODUCTION TO COMPUTERS 1.1. INTRODUCTION TO COMPUTERS... 1 1.2. HISTORY OF C & C++... 3 1.3. DESIGN, DEVELOPMENT AND EXECUTION OF A PROGRAM... 3 1.4 TESTING OF PROGRAMS...

More information

Java and C# in depth

Java and C# in depth Java and C# in depth ETH Zurich Date: 27 May 2013 Family name, first name:... Student number:.. I confirm with my signature, that I was able to take this exam under regular circumstances and that I have

More information

CS260 Intro to Java & Android 03.Java Language Basics

CS260 Intro to Java & Android 03.Java Language Basics 03.Java Language Basics http://www.tutorialspoint.com/java/index.htm CS260 - Intro to Java & Android 1 What is the distinction between fields and variables? Java has the following kinds of variables: Instance

More information

Industrial Programming

Industrial Programming Industrial Programming Lecture 4: C# Objects & Classes Industrial Programming 1 What is an Object Central to the object-oriented programming paradigm is the notion of an object. Objects are the nouns a

More information

What is an Object. Industrial Programming. What is a Class (cont'd) What is a Class. Lecture 4: C# Objects & Classes

What is an Object. Industrial Programming. What is a Class (cont'd) What is a Class. Lecture 4: C# Objects & Classes What is an Object Industrial Programming Lecture 4: C# Objects & Classes Central to the object-oriented programming paradigm is the notion of an object. Objects are the nouns a person called John Objects

More information

PROGRAMMING IN C AND C++:

PROGRAMMING IN C AND C++: PROGRAMMING IN C AND C++: Week 1 1. Introductions 2. Using Dos commands, make a directory: C:\users\YearOfJoining\Sectionx\USERNAME\CS101 3. Getting started with Visual C++. 4. Write a program to print

More information

Government Polytechnic, Muzaffarpur. Name of the Lab: OBJECT ORIENTED PROGRAMMING

Government Polytechnic, Muzaffarpur. Name of the Lab: OBJECT ORIENTED PROGRAMMING Government Polytechnic, Muzaffarpur. Name of the Lab: OBJECT ORIENTED PROGRAMMING THROUGH C++ Practical: OOPS THROUGH C++ Subject Code: 1618407 PROGRAM NO.1 Programming exercise on executing a Basic C++

More information

Outline. Parts 1 to 3 introduce and sketch out the ideas of OOP. Part 5 deals with these ideas in closer detail.

Outline. Parts 1 to 3 introduce and sketch out the ideas of OOP. Part 5 deals with these ideas in closer detail. OOP in Java 1 Outline 1. Getting started, primitive data types and control structures 2. Classes and objects 3. Extending classes 4. Using some standard packages 5. OOP revisited Parts 1 to 3 introduce

More information

PART A : MULTIPLE CHOICE Circle the letter of the best answer (1 mark each)

PART A : MULTIPLE CHOICE Circle the letter of the best answer (1 mark each) PART A : MULTIPLE CHOICE Circle the letter of the best answer (1 mark each) 1. An example of a narrowing conversion is a) double to long b) long to integer c) float to long d) integer to long 2. The key

More information