Technion C# Fundamentals INFO
This post was created in order to assist me teaching the ‘C# Fundamentals’ module, that belongs to the ‘.NET Software Development’ long term course delivered in the Technion.
This C# module includes 24 meetings of 5 academic hours each, it starts on June 21st 2010 and it takes place on Mondays and Thursdays in the Technion, Canada Building, Haifa.
The main topics this module covers include the following:
Introduction
C# Basic
Objects
Classes
Inheritance
Arrays
Strings
Operators
Delegates
Events
Generics
Collections
Reflections
Exceptions
Memory
Reflection
Threads
Networking
LINQ
Assemblies
Serialization
The detailed plan can be found at http://docs.google.com/View?id=dcncp28t_177ck73jbc3.




























July 22nd, 2010 at 1:10 pm
you can find the google group of this course at http://groups.google.com/group/technion-net-june-2010.
good luck!
haim.
August 14th, 2010 at 7:32 pm
[...] to teach is recursion. One of the recursive problems I included in my recent C# Programming course in the Technion was the Hanoi Towers. Following the request from some of my students I created a [...]
August 16th, 2010 at 10:51 am
Please find below the mid-term exam that was delivered on August 15th. I hope you can find this copy useful on your end. The exam includes the following four questions:
Q1
You should define a the class NumbersBaseFormatter so that the output of the following code would be the translation of the given number into the required base (in this case the base is 2 so the output is 101).
string str = string.Format(new MyCustomizedFormatter(),"{0:B2}",5);
Console.WriteLine(str);
The supported bases are 2,3,4,5,6,7,8,9 and 10. We specify those bases using B2, B3, B4, B5, B6, B7, B8, B9 and B10. You should develop a simple application that shows a simple usage for your class.
Q2
You should define the Student class. You are free to define any variable, property, indexer and method you want. You should define Student class in order to allow the following code to calculate a student average.
double total=0;
Student std = new Student("dave",2342445);
std["math"] = 88;
std["physics"] = 90;
std["english"] = 92;
std["history"] = 86;
foreach(double num in std)
{
total+=num;
}
Console.WriteLine("average="+(total/std.NumberOfTopics));
Q3
The following code includes the definition for a linked list based on object addresses. You should add the definition for the following methods (inside the LinkedList class).
1. RemoveFirst() should remove the first element and return it.
2. RemoveLast() should remove the last element and return it.
3. Size() should return the number of elements.
namespace Com.Abelski.CSharp.Solutions
{
public class DisposableDemo
{
unsafe public static void Main()
{
using (LinkedList list = new LinkedList())
{
Node n1 = new Node(234,null);
Node n2 = new Node(545,null);
Node n3 = new Node(224,null);
Node n4 = new Node(654,null);
list.Add(&n1);
list.Add(&n2);
list.Add(&n3);
list.Add(&n4);
Console.WriteLine(list);
}
}
}
public unsafe struct Node
{
public int Value;
public Node* Next;
public Node(int val, Node* address)
{
Value = val;
Next = address;
}
}
public unsafe struct LinkedList : IDisposable
{
private Node* head;
public void Dispose()
{
Console.WriteLine("Dispose() is executed...");
head = null;
}
public void Add(Node* node)
{
node->Next = head;
head = node;
}
public override string ToString()
{
StringBuilder sb = new StringBuilder();
Node* node = head;
while (node != null)
{
sb.Append(node->Value);
sb.Append("\n");
node = node->Next;
}
return sb.ToString();
}
}
}
Q4
Develop the Calculator class in accordance with the following code and in order to allow it to execute sucessfully.
Calculator ob = new Calculator();
Console.WriteLine(ob["/"](ob["*"](7,5),ob["+"](1,4))); //output should be 7
August 16th, 2010 at 1:32 pm
Tanya Kovalyov was the first student to solve this exam. She wrote excellent short and clear code. You can download her solution at http://www.lifemichael.com/download/code/tanya.zip. (Tanya, thanks for the code!)