WhatsApp-00963951432013 Admin
عدد المساهمات : 2429 نقاط : 302124 السٌّمعَة : 4 تاريخ التسجيل : 20/09/2008 العمر : 54 الموقع : www.aoua.123.st
| موضوع: Faculty of Computer Studies Course Code: M107 Course Title: Introduction to C# Programming Spring 2015- 2016-Tutor Marked Assignment- Solution Cut-Off Date: Total Marks: 80 Contents Part I: Theoretical Questions [20 Marks] Part II: Outpu الإثنين مارس 21, 2016 7:11 pm | |
|
Faculty of Computer Studies Course Code: M107 Course Title: Introduction to C# Programming Spring 2015- 2016-Tutor Marked Assignment- Solution Cut-Off Date: Total Marks: 80 Contents Part I: Theoretical Questions [20 Marks] Part II: Output and Debugging Questions [20 Marks] Part III: Problem Solving Questions [40 Marks]
Plagiarism Warning: As per AOU rules and regulations, all students are required to submit their own TMA work and avoid plagiarism. The AOU has implemented sophisticated techniques for plagiarism detection. You must provide all references in case you use and quote another person's work in your TMA. You will be penalized for any act of plagiarism as per the AOU's rules and regulations. Declaration of No Plagiarism by Student (to be signed and submitted by student with TMA work): I hereby declare that this submitted TMA work is a result of my own efforts and I have not plagiarized any other person's work. I have provided all references of information that I have used and quoted in my TMA work. Name of Student: Signature: Date:
Part I: Theoretical Questions (4 marks each) [20 Marks]
1. What is Common Type System (CTS) in .NET?
2. State the differences between dispose ( ) and finalize ( ).
3. Differentiate between an abstract class and interface in C#. 4. What is a static class? Explain with an example.
5. Consider the following program. Convert if-else statement into switch-case and all three for loops to while loops. class Program { static void Main(string[] args) { int a,i; a = 1; if (a == 1) for (i = 0; i < 2; i++) { Console.WriteLine("morning"); } else if (a==2) for (i = 0; i < 2; i++) { Console.WriteLine("evening"); } else for (i = 0; i < 2; i++) { Console.WriteLine("night"); } Console.ReadLine(); } }
Part II: Output and Debugging Questions (10 marks each) [20 Marks]
1. What is the output of the following program? [10 Marks]
namespace ConsoleApplication1 { class Program { static void Main(string[] args) { int i, j; int[, ] arr = new int[ 5, 5]; for (i = 0; i < 5; ++i) { for (j = 0; j < 5; ++j) { arr[i, j] = i * 2 + i * 2; Console.Write(arr[i, j] + " "); } Console.ReadLine(); } } }}
2. What is the output of the following program? [6 Marks]
namespace ConsoleApplication1 { struct Sample { public int i; } class Program { static void Main(string[] args) { Sample x = new Sample(); x.i = 10; fun(ref x); Console.Write(x.i + " "); Console.ReadLine(); } public static void fun(ref Sample y) { y.i = 20; Console.Write(y.i + " "); } } } 3. Consider the following program. Will it generate an output? If no, explain the reason. [4 marks]
namespace ConsoleApplication1 { class Program { static void Main(string[] args) { int I, X; for (I = 1; I <= (9 % 2 + I); I++) { X = (I * 3 + I * 2) / I; Console.WriteLine(X); } Console.ReadLine(); } } }
Part III- Problem Solving Questions [40 Marks]
1. Using loops, write a C# program to print the following pattern. [10 Marks]
1****** 12***** 123**** 1234*** 12345** 123456* 1234567
2. Write a C# application that asks the user to input the required data to implement the four methods below: [15 Marks] (Use Method Overloading to write the methods) a. Method Addition that take as input two int values ‘a’ and ‘b’, calculates the sum, and displays it. b. Method Addition that take as input three int values ‘a’ , ‘b’ and ‘c’, calculates the sum, and displays it. c. Method Addition that takes as input two float values ‘p’ and ‘q’, calculates the sum, and displays it. d. Method Addition that take as input three float values ‘p’ , ‘q’ and ‘r’, calculates the sum, and displays it.
Sample Input & Output
3. Write a C# application that asks the user to input ‘A’ and ‘B’ and prints the sum of squares of all even numbers between ‘A’ and ‘B’. [15 Marks] Sample Input & Output
| |
|