AD Past Paper 04 (Answers)
AD Past Paper 04 (Answers)
Module leader:
Date: TBA
Duration: 2 hours
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.
Answer: c
Q2
In which stage of the normalization process are transitive dependencies removed?
Q3
Select the output for the following set of Code for n= 1234
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
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
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
Answer: a
Q8
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
a) Call by reference
b) Call by value
c) Output parameter
d) parameter arrays
Answer :a
Q10
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
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
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
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.
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.
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.
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.
c)
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";
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
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.