Professional Documents
Culture Documents
M109 MTA Fall 2018
M109 MTA Fall 2018
M109
.NET Programming
Mid-term Examination – (MTA)
Fall Semester 2018/2019
Date: 14/11/2018
Instructions:
1. This exam consists of three parts هذا االمتحان مكون من ثالثة اجزاء يجب.1
you should answer all on the االجابة على جميع االجزاء فى كراسة االجابة
separate answer sheet booklet. .المنفصلة مع ذكر رقم السؤال
2. Calculators without memory are يسمح باستخدام االلة الحاسبة التى ال تحتوى.2
allowed. .ذاكرة تخزين
3. Devices with a memory are not ال يسمح باستخدام اى آلة ذات ذاكرة تخزين مثل.3
allowed (example: mobile). .الهاتف المحمول
4. Total Mark: 60
4) Which of the following is the correct output for the C#.NET code snippet
given below?
Console.WriteLine(13 / 2 + " " + 13 % 2);
a. 6.5 1
b. 6.5 0
c. 60
d. 61
5) Which of the following statement is correct about the C#.NET code snippet
given below?
if (mo > 55 && no < 111)
a = 100;
a. The statement a = 100 will get executed if any one condition is True.
b. The condition no < 111 will be evaluated only if mo > 55 evaluates to
False.
c. The statement a = 100 will get executed if both the conditions are
True.
d. None of the above
1. The following C# code contains syntax errors. Identify the errors and write the
correction opposite to each line of code. If there is no error in a line, write NO
ERROR.
CODE ERRORS
class Program
{
static void Mian(string[] args)
{
int a=100, b = =104
do
{
Console.WriteLine[b];
a--;
} while (a > 0)
Console.ReadLine();
}
}
class Program
{ static void Main(string[] args)
{ int a, b, sum, subtr;
a = 100;
b = 20;
sum = a + b;
subtr = a - b;
3. In the given set of code, write the correct ‘if-else statement’ to find the number
of positive numbers and negative numbers in a given array.
class Program
{ static void Main(string[] args)
{ int[] num = { 12, -10, 21, 8, 3, -2 };
int pos = 0, neg = 0;
for (int i = 0; i < num.Length; i++)
{
/* __________________ */
}
Console.WriteLine("Positive Numbers:" + pos);
Console.WriteLine("Negative Numbers:" + neg);
Console.ReadLine();
}
}
1. Write a C# program to allow the user to input 10 numbers. Count the number
of zero’s in the input and display the count. [15 marks]
Sample I/O
2. Write a C# program to calculate the sum of the series: 22+ 42+ 62+…….+ 122
[10 marks]
Output
End of Questions