Examination question paper: May 2023 (Resit)
Module code: CS6004ES
Component number: Exam
Module title: Application Development
Module leader: Mr. Chamila Karunathilake
Date: 11th July 2024 Thursday
Start time: 2.00pm – 4.00pm
Duration: 2 hours
Exam type: Unseen
Materials supplied: None
Materials permitted: None
Warning: Candidates are warned that possession of
unauthorised materials in an examination is a serious
assessment offence.
Instructions to This exam is worth 40% of the assessment for the module.
candidates: Candidates MUST answer the SECTION A with 30 MCQ
questions (compulsory)
Each question carries 2 marks.
Answer Question One and any other Question from two and
three from Section B. Each question carries 20 marks
No credit will be given for attempting further questions.
If you use supplementary sheets, tie them up at the end of
your booklet but inside the cover sheet of the booklet.
DO NOT TURN PAGE OVER UNTIL INSTRUCTED
© London Metropolitan University
Page 1 of 12
SECTION A
Q-1 Which of the following statements are TRUE about the .NET CLR?
1. It provides a language-neutral development & execution environment.
2. It ensures that an application would not be able to access memory that it is not authorized to
access.
3. It provides services to run "managed" applications.
4. The resources are garbage collected.
5. It provides services to run "unmanaged" applications.
A. Only 1 and 2
B. Only 1, 2 and 4
C. 1, 2, 3, 4
D. Only 4 and 5
Q-2 Which of the following statements is correct about Managed Code?
A. Managed code is the code that is compiled by the JIT compilers.
B. Managed code is the code where resources are Garbage Collected.
C. Managed code is the code that runs on top of Windows.
D. Managed code is the code that is written to target the services of the CLR.
Q-3 Select the output for the following set of Code for n= 5342
1. static void Main(string[] args)
2. {
3. int n, r;
4. n = Convert.ToInt32(Console.ReadLine());
5. while (n > 0)
6. {
7. r = n % 10;
8. n = n / 10;
9. Console.Write(“ ”,r);
10. }
11. Console.ReadLine();
12. }
A. 3245 B. 2354 C. 2345 D. 5423
Q-4 Which of the following statements is correct about constructors in C#.NET?
A. Constructor cannot be declared as private B. A constructor cannot be overloaded
C. A constructor can be a static constructor D. None of the mentioned
Page 2 of 12
Q-5 When user request a web page by entering Uniform Resource Locator (URL) then which
method /verb/command is used in ASP.NET?
A. POST B. SET C. GET
D. All of the above.
Q-6 Which of the following is the root of the .NET type hierarchy?
A. System.Object C. System.Base
B. System.Type D. System.Parent
Q -7 Correct statement about inheritance in C# .NET? Write a sample C# code and explain the
object construction in the inheritance hierarchy.
A. In inheritance chain, object construction begins from base class towards derived class
B. Inheritance cannot extend base class functionality
C. A derived class object contains all non-private attributes and behaviours in the base class
data
D. All of the mentioned
Q-8 Which of the following constitutes the .NET Framework?
ASP.NET Applications
CLR
Framework Class Library
WinForm Applications
Windows Services
A. 1,2 B. 2,3 C. 3,4 D.2,5
Q-9 The process of defining a method in subclass having same name & type signature as a method
in its superclass is known as? Explain the concept with a sample C# Code.
A. Method overloading
B. Method overriding
C. Method hiding
D. None of the mentioned
Page 3 of 12
Q-10 Which of the following statements is correct about the C#.NET code snippet given below?
class Student s1, s2; // Here 'Student' is a user-defined class.
s1 = new Student();
s2 = new Student();
A. Contents of s1 and s2 will be exactly same.
B. The two objects will get created on the stack.
C. Contents of the two objects created will be exactly same.
D. The two objects will always be created in adjacent memory locations
Q-11 Which of the following is the correct way to create an object of the class Sample?
1. Sample s = new Sample();
2. Sample s;
3. Sample s; s = new Sample();
4. s = new Sample();
A. 1,3 B. 2,4 C.1,2,3 D. 1,4
Q-12 Choose the correct statements among the following. Explain the abstract class and an abstract
method with a sample C# code.
A. An abstract method does not have implementation
B. An abstract method can be declared only in abstract class
C. None of the above
D. both a & b
Q-13 In C#.NET if we do not catch the exception thrown at runtime then which of the following
will catch it?
A. Compiler B.CLR C. Linker D. Loader
Page 4 of 12
Q-14 What would be the output of following code?
{
try
{
int i, sum;
sum = 10;
for (i = -1 ;i < 3 ;++i)
{
sum = (sum / i);
Console.Write ("{0} ",i);
}
}
catch(ArithmeticException e)
{
Console.WriteLine("0");
}
Console.ReadLine();
}
A. -1
B. 0
C. -1 0
D. -1 0 -1
Q-15 Which of the following statements is correct about the C#.NET code snippet given below?
class Sample
{
private int i;
public Single j;
private void DisplayData()
{
Console.WriteLine(i + " " + j);
}
public void ShowData()
{
Console.WriteLine(i + " " + j);
}
}
A. j cannot be declared as public.
B. DisplayData() cannot be declared as private.
C. DisplayData() cannot access j.
D. There is no error in this class.
Page 5 of 12
Q-16 Which of the following should be used to implement a 'Has a' relationship between two
entities?
A. Polymorphism B. Templates C. Containership D. Encapsulation
Q-17 What are the Command Object Methods IN asp.net?
D. ExecuteNonQuery B. ExecuteReader C. ExecuteScalar D. All of the above.
Q-18 Which of the following statements is correct about the C#.NET code snippet given below?
int i;
int j = new int();
i = 10;
j = 20;
String str;
str = i.ToString();
str = j.ToString();
A. This is a perfectly workable code snippet.
B. Since int is a primitive, we cannot use new with it.
C. Since an int is a primitive, we cannot call the method ToString() using it.
D. i will get created on stack, whereas j will get created on heap.
Page 6 of 12
Q – 19 If a class Student has an indexer, then which of the following is the correct way to declare
this indexer to make the C#.NET code snippet given below work successfully?
Student s = new Student();
s[1, 2] = 35;
A. class Student
{
int[ ] a = new int[5, 5];
public property WriteOnly int this[int i, int j]
{
set
{
a[i, j] = value;
}
}
}
B. class Student
{
int[ , ] a = new int[5, 5];
public int property WriteOnly
{
set
{
a[i, j] = value;
}
}
}
C. class Student
{
int[ , ] a = new int[5, 5];
public int this[int i, int j]
{
set
{
a[i, j] = value;
}
}
}
D. class Student
{
int[ , ] a = new int[5, 5];
int i, j;
public int this
{
set
{
a[i, j] = value;
}
}
}
Page 7 of 12
Q-20. If Sample class has a Length property with get and set accessors then which of the following
statements will work correctly?
1 Sample.Length = 20;
2 Sample m = new Sample();
m.Length = 10;
3 Console.WriteLine(Sample.Length);
4 Sample m = new Sample();
int len;
len = m.Length;
5 Sample m = new Sample();
m.Length = m.Length + 20;
A. 1, 3 B. 2, 4, 5 C. 4 only D. 3, 5
Q-21 Which of the following are reuse mechanisms available in C#.NET?
1. Inheritance 2. Encapsulation 3. Templates 4. Containership 5. Polymorphism
A. 1, 4 B. 1, 3 C. 2, 4 D. 3, 5
Q-22 Which of the following statements is correct about the C#.NET program given below if a
value "6" is input to it?
using System;
namespace IndiabixConsoleApplication
{
class MyProgram
{
static void Main(string[] args)
{
int index;
int val = 44;
int[] a = new int[5];
try
{
Console.Write("Enter a number:");
index = Convert.Tolnt32(Console.ReadLine());
a[index] = val;
}
catch(FormatException e)
{
Console.Write("Bad Format");
}
catch(IndexOutOfRangeException e)
{
Console.Write("Index out of bounds");
}
Console.Write("Remaining program");
}
}
}
Page 8 of 12
A. It will output: Index out of bounds Remaining program
B. It will output: Bad Format Remaining program
C. It will output: Bad Format
D. It will output: Remaining program
Q-23 Which Of The Following Operator Can Be Used To Access The Member Function Of A
Class?
A. :
B. ::
C. .
D. #
Q-24 Which of the following statements should be added to the subroutine fun( ) if the C#.NET
code snippet given below is to output 9 13?
class BaseClass
{
protected int i = 13;
}
class Derived: BaseClass
{
int i = 9;
public void fun()
{
// [*** Add statement here ***]
}
}
A. Console.WriteLine(base.i + " " + i);
B. Console.WriteLine(i + " " + base.i);
C. Console.WriteLine(mybase.i + " " + i);
D. Console.WriteLine(i + " " + mybase.i);
Page 9 of 12
Q-25 Which statement will you add in the function fun() of class B, if it is to produce the output
"Welcome to IndiaBIX.com!"?
namespace IndiabixConsoleApplication
{
class A
{
public void fun()
{
Console.Write("Welcome");
}
}
class B: A
{
public void fun()
{
// [*** Add statement here ***]
Console.WriteLine(" to IndiaBIX.com!");
}
}
class MyProgram
{
static void Main (string[ ] args)
{
B b = new B();
b.fun();
}
}
}
A. base.fun();
B. A::fun();
C. fun();
D. mybase.fun();
Q-26
Which of the following is the root of the .NET type hierarchy?
A. System.Object B. System.Type C. System.Base D. System.Parent
Q-27
When we write <img src="img.png">, what "img.png" inside double quote implies?
A. element
B. attribute
C. value
D. operator
Page 10 of 12
Q-28
Which of following is not an attribute of <form> tag
A. Action B. Method C. name D. url
Q-29
Which of the following is the correct about class member variables?
A. Member variables are the attributes of an object (from design perspective) and they are
kept private to implement encapsulation.
B. These private variables can only be accessed using the public member functions.
C. Both of the above.
D. None of the above.
Q-30
What is the most suitable web server to publish an application developed by ASP.NET?
A. Apache B. Internet Information Services (IIS)
C. Apache Tomcat D. Oracle weblogic
Page 11 of 12
SECTION B
Question 1
a) What is namespace in C#? (5 Marks)
b) Differentiate value type and reference type in C#. (5 Marks)
c) List out the categories of controls supported in window based application and explain the
importance of each. (5 Marks)
d) How encapsulation is implemented in C#? (5 Marks)
Question 2
a) 1) Compare ASP with ASP.NET (5 Marks)
b) 2) What is MVC Architecture ? (7 Marks)
c) 3) What is ASP.NET Web service? (8 Marks)
Question 3
a) Explain what unit testing is and how it is useful (5 Marks)
b) Explain what black box testing is and how it is useful (5 Marks)
c) Explain what White box testing is and how it is useful (5 Marks)
d) What is the difference between functional and non-functional testing? (5 Marks)
*****End of the paper*****
Page 12 of 12