0% found this document useful (0 votes)
18 views17 pages

AD Past Paper 04 (Answers)

The document outlines the examination details for the CS6004ES module on Application Development, including the exam format, types of questions, and instructions for candidates. It consists of multiple-choice questions and coding problems related to C# programming, database normalization, and software components. Additionally, it includes sample questions and answers to guide students in their preparation for the exam.

Uploaded by

dimanranwaka
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views17 pages

AD Past Paper 04 (Answers)

The document outlines the examination details for the CS6004ES module on Application Development, including the exam format, types of questions, and instructions for candidates. It consists of multiple-choice questions and coding problems related to C# programming, database normalization, and software components. Additionally, it includes sample questions and answers to guide students in their preparation for the exam.

Uploaded by

dimanranwaka
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

EXAMINATION RE SIT SAMPLE ANSWERS: Year 2018/2019

Module code: CS6004ES

Module title: Application Development

Module leader:

Date: TBA

Day / evening: Day

Start time: TBA

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 30% 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 form question two and three
from Section B. Each question carries 20 marks
No credit will be given for attempting further questions.

DO NOT TURN PAGE OVER UNTIL INSTRUCTED


© London Metropolitan University
Q1

Select output for the following set of code.


1. class Example
2. {
3. public int i;
4. public int[] arr = new int[10];
5. public void function1(int i, int val)
6. {
7. arr[i] = val;
8. }
9. }
10. class Program
11. {
12. static void Main(string[] args)
13. {
14. Example ex = new Example();
15. ex.i = 10;
16. Example.function1 (1, 5);
17. ex. function1 (1, 5);
18. Console.ReadLine();
19. }
20. }

a) ex.i = 10 cannot work as i is ‘public’


b) Example.function1(1, 5) will set value as 5 in arr[1] d) s. function1 (1, 5) will work
correctly
c) Example. function1 (1, 5) will not work properly
d) None of the above.

Answer: c

Q2
In which stage of the normalization process are transitive dependencies removed?

a) Unnormalized Form (UNF)


b) 1st Normal Form (1NF)
c) 2nd Normal Form (2NF)
d) 3rd Normal Form (3NF)
Answer: d

Q3

Select the output for the following set of Code for n= 1234

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) 1324
b) 1234
c) 4321
d) 2468

Answer: c

Q4

What is the process of defining a method in terms of itself that is a method that calls itself?

a) Polymorphism
b) Abstraction
c) Encapsulation
d) Recursion

Explain the above concept with a sample C# Code.

Q5

A type of class which does not have its own objects but acts as a base class for its subclass is
known as?
a) Static class
b) Sealed class
c) Abstract class
d) None of the mentioned

Answer : c
Q6

Correct statement about inheritance in C# .NET?

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

Answer : c, a

Q7

Which among the following is the correct statement? Constructors are used to…………….. a) initialize
the objects
b) construct the data members
c) both a & b
d) None of the mentioned

Explain the above answer with an example code.

Answer: a

Q8

What would be the output of following code? {

1. try
2. {
3. int i, total;
4. total = 10;
5. for (i = -1 ;i < 3 ;++i)
6. {
7. total = (total / i);
8. Console.Write ("{0} ",i);
9. }
10.
11. }
12. catch(ArithmeticException e)
13. {
14. Console.WriteLine("0");
15. }
16. Console.ReadLine();
17. }
a) -1
b) 0
c) -1 0
d) -1 0 -1

Answer : c

Q9

Which of the following searching techniques require the data to be in sorted form. (1 Mark)
Explain the answer with the algorithm using a sample array (3 Marks)
a) Binary Search
b) Linear Search
c) a and b both
d) None of the above

Answer: -a

Q9

Consider the following code.


static void Main(string[] args)
{
int a = 10, b = 20;
method(ref a, ref b);
console.writeline(a + " " + b);
}
static void swap(ref int i, ref int j)
{
int t;
t = i;
i = j;
j = t;
}

Select the correct output from the below list.

a) Call by reference
b) Call by value
c) Output parameter
d) parameter arrays
Answer :a
Q10

Consider the following code.


static void Main(string[] args)
{
int a ;
for (a = 1; a < 5; a++)
{
int b = 1;
b *= a;
Console. WriteLine(b);
}
Console. WriteLine( a + b);
Console. ReadLine();
}

Correct Output for the given set of programming code from the below list is ………….
(1 Mark)
a)1, 2, 6, 24
b) 2,4,6,8
c) Compile time error
d) 1, 2, 3, 4
Explain your answer.

Answer: c

Q11
You are developing a C# program. You write the following code:

int x = 11;

int y = ++x;

int z = y++;

What will be the value of the variable z after all the above statements are executed?

a) 10

b) 11

c) 12

d) 13

Answer: c) 12

Q12

Which of the following types of classes provides complete functionality but cannot be used as a base
class?

a) Derived class
b) Sealed class
c) Object class
d) Abstract class

Answer: b

Q13

Which of the following is not a part of the ASP.net implementation of Ajax object?

a) ScriptManager
b) UpdatePanel
c) XMLHttpRequest
d) Namespace
Answer: d

Q14
You need an application in which multiple child windows of your application interface could reside
under a single parent window. Which of the following you will select?

a) UDI
b) MDI
c) SDI
d) GUI

Answer: b

Q15
Which of the below type of applications are considered as Non-GUI applications.
a) Console Application
b) Windows Service Application
c) Windows Form Application
d) WPF Application
Answers: a, b

Q16
Which of the following technologies define how remote computers exchange messages?
a) WSDL
b) HTTP
c) SOAP
d) XML

Answer: c
Q17

Which of the following enables you to connect and interact with any database supported by ADO.NET?

a) SqlDataSource control

b) ObjectDataSource control

c) XmlDataSource control

d) LinqDataSource

Answer: a)

Q18
Which of the following is used to create interactive web applications in which the applications send
and retrieve data asynchronously in the background between a web page and the server?

a) DOM

b) Ajax

c) CSS

d) XSLT

Answer: b)

Q19
Which type of authentication uses a web page to input username and password?
a) Passport

b) Windows

c) Forms

d) None of the above

Answer: c)

Q20
Which of the following data structures allows the last added item to the collection to be removed
first?
a) Arrays
b) Linked Lists
c) Stacks
d) Queues
Answer: c
Q21
Which of the following focuses on testing the interface between software components?

a) Interface Testing
b) System Testing
c) Regression Testing
d) Unit Testing
Answer: a

Q22
Which of the following sorting algorithms compares elements to determine their order and then
swaps them accordingly?
a) Bubble sort
b) Insertion sort
c) Quick sort
d) Merge sort

Answer: a
Q23
Which of the following is used to modify values for various solutions, project forms, and controls?

a) Properties window

b) Solution Explorer window

c) Windows Form Designer

d) Program.cs

Answer: a

Q24
Which of the following Windows Forms container control is commonly used to contain other
controls but has no inherent functionality?
a) Panel

b) SplitContainer

c) TabControl

d) Groupbox

Answer: a

Q25
When debugging an application, which of the following do you insert into source code that tells
Visual Studio to pause execute at the indicated code line?
a) breakpoint

b) quick watch point

c) output point

d) memory point
Answer: a

Q26
What is the window that provides a centralized location within the Visual Studio environment to
manage and create connects to data sources and servers?
a) Server Explorer
b) Database Explorer
c) Internet Explorer
d) Solution Explorer

Answer: a

Q27
Which of the below is not a client-side state management technique?
a) Cookies
b) Session State
c) View State
d) Query Strings

Answer: b

Q28
What is the name of the process of finding the cause of errors in a program, locating the lines of code
that are causing those errors, and fixing those errors?

a) Exception Handling
b) Debugging
c) Testing
d) Deployment

Answer: b

Q31
What is the output of following programme?
1. int x = 10, y = 20;
2. if (x == 10 | (++y) == 20)
3. {
4. MessageBox.Show("x:" + x + ", y: " + y);
5. }
Options:
a) x: true, y: true
b) x: 10, y: 21
c) No output / Message box will not show
d) x: 10, y: 20
Answer: b
Q30
You are writing a method named PrintInvoice that doesn’t return a value to the calling code.
Which of the following keywords should you use in your method declaration to indicate this fact?
a) void

b) private

c) int

d) string

Answer: a

Part B
Answer Three out of four Questions. Each question carries 20 marks.
Question 1
1) What is de-normalization? (5 Marks)
2) Explain the importance of de-normalization in database creation? (5 Marks)
3) Explain the steps of database normalization. (5 Marks)
4) Normalize the below invoice and find 1NF,2NF and 3NF (5 Marks)
1)Database optimization is an essential step to improve website performance. Typically, developers
normalize a relational database, meaning they restructure it to reduce data redundancy and
enhance data integrity. However, sometimes normalizing a database isn’t enough, so to improve
database performance even further developers go the other way around and resort to database
denormalization.

2) Will enhance query performance

Typically, a normalized database requires joining a lot of tables to fetch queries; but the more joins,
the slower the query. As a countermeasure, you can add redundancy to a database by copying values
between parent and child tables and, therefore, reducing the number of joins required for a query.

Will make a database more convenient to manage

A normalized database doesn’t have calculated values that are essential for applications. Calculating
these values on-the-fly would require time, slowing down query execution.

You can denormalize a database to provide calculated values. Once they’re generated and added to
tables, downstream programmers can easily create their own reports and queries without having in-
depth knowledge of the app’s code or API.

Will facilitate and accelerate reporting

Often, applications need to provide a lot of analytical and statistical information. Generating reports
from live data is time-consuming and can negatively impact overall system performance.

Denormalizing your database can help you meet this challenge. Suppose you need to provide a total
sales summary for one or many users; a normalized database would aggregate and calculate all invoice
details multiple times. Needless to say, this would be quite time-consuming, so to speed up this
process, you could maintain the year-to-date sales summary in a table storing user details.

3)

Arranging data into logical groupings such that each group describes a small part of the whole;
minimizing the amount of duplicate data stored in a database; organizing the data such that, when
you modify it, you make the change in only one place; and building a database in which you can access
and manipulate the data quickly and efficiently without compromising the integrity of the data in
storage.

As per First Normal Form, no two Rows of data must contain repeating group of information i.e each
set of column must have a unique value, such that multiple columns cannot be used to fetch the same
row.

As per the Second Normal Form there must not be any partial dependency of any column on primary
key.

Third Normal form applies that every non-prime attribute of table must be dependent on primary key,
or we can say that, there should not be the case that a non-prime attribute is determined by another
non-prime attribute.

4)

UNF:

1NF
2NF

3NF
Question 2

a) A namespace is designed for providing a way to keep one set of names separate from
another. The class names declared in one namespace does not conflict with the same class
names declared in another.

b) How encapsulation is implemented in C#? (5 Marks)


Encapsulation is implemented by using access specifiers. An access specifier defines the
scope and visibility of a class member. C# supports the following access specifiers −
Public
Private
Protected
Internal
Protected internal

c)

Button This section contains information about the programming elements


used with button controls.

ComboBox A combo box consists of a list and a selection field.

DateandTime This section contains information about the programming elements


Picker used with date and time picker controls.

4) Write a database application only to INSERT the details of customer table details

{
OleDbConnection conn = new OleDbConnection();
conn.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=C:\Users\kenny\Documents\Visual Studio 2010\Projects\Copy
Cegees\Cegees\Cegees\Customer.accdb";

String cutomerid = TEXTID.Text;


String customername = TEXTName.Text;
String customerContact=TxtContact.Text;

OleDbCommand cmd = new OleDbCommand("INSERT into Customer (cid,

cname,contactNum) Values(@cutomerid, @customername,@customerContact)");

cmd.Connection = conn;

conn.Open();

if (conn.State == ConnectionState.Open)
{
cmd.Parameters.Add("@cutomerid", OleDbType.VarChar).Value =
cutomerid;
cmd.Parameters.Add("@customername", OleDbType.VarChar).Value =
customername;

cmd.Parameters.Add("@customerContact", OleDbType.VarChar).Value =
customerContact;

try
{
cmd.ExecuteNonQuery();
MessageBox.Show("Data Added");
conn.Close();
}
catch (OleDbException ex)
{
MessageBox.Show(ex.Source);
conn.Close();
}
}
else
{
MessageBox.Show("Connection Failed");
}
}
}
} (5 Marks)

Question 3

1) Compare ASP with ASP.NET (5 Marks)


The most important difference between ASP and ASP.Net is that ASP uses interpreted VBScript or
JScript, and ASP.net uses any .Net language (including VB.Net, C#, J#, etc.) compiled. ASP 3.0 left all
its code in the front of the application. ... ASP is mostly written using VB Script and HTML intermixed.

2) What is MVC Architecture ? (5Marks)

Model View Controller or MVC as it is popularly called, is a software design pattern for developing
web applications. A Model View Controller pattern is made up of the following three parts −

• Model − The lowest level of the pattern which is responsible for maintaining data.
• View − This is responsible for displaying all or a portion of the data to the user.
• Controller − Software Code that controls the interactions between the Model and View.

c)

Server-Side Validation

In the Server-Side Validation, the input submitted by the user is being sent to the server and validated
using one of server-side scripting languages such as ASP.Net, PHP etc. After the validation process on
the Server Side, the feedback is sent back to the client by a new dynamically generated web page. It
is better to validate user input on Server Side because you can protect against the malicious users,
who can easily bypass your Client-Side scripting language and submit dangerous input to the server.

Client-Side Validation

In the Client-Side Validation, you can provide a better user experience by responding quickly at the
browser level. When you perform a Client-Side Validation, all the user inputs validated in the user's
browser itself. Client-Side validation does not require a round trip to the server, so the network traffic
which will help your server perform better. This type of validation is done on the browser side using
script languages such as JavaScript, VBScript or HTML5 attributes.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy