Question 5: (20 Marks) - Dotcom Book

estrapadesherbetΛογισμικό & κατασκευή λογ/κού

18 Νοε 2013 (πριν από 3 χρόνια και 8 μήνες)

96 εμφανίσεις


1


Course Code



:

MCS
-
021

Course Title



:

Data and File Structures

Assignment Number


:

MCA(2)/021/Assign/08

Maximum Marks


:

100


Weightage



:

25%

Last Dates for Submission

:

15
th

October, 2008 ( for July,08 session)






15
th

April, 2009 (for Jan, 09 se
ssion)



Q1:


Given a linked list of integers sorted
in the ascending order
, and a pointer to a single node

containing an integer, insert the node in the linked list so that it remains sorted.



(10 Mar
ks)


Q 2:

Given two null terminated linked lists, combine their nodes so that the nodes of the new
list alternate between those of the two original nodes: <first node of first list, first node of
second list, second node of first list, second node of seco
nd list, ... >.

Note:
Do not allocate any new nodes.





(10 Marks)


Q 3:

A stirling number of the first kind is defined as follows
:


o

s(0,0) = 1

o

s(n,0) = 0, for all n > 0

o

s(n+1,k) = s(n,k
-
1)


n

*

s(n,

k), for

all n

0 and k>0


Write a recursive routine to calculate stirling numbers of the first kind.

(10 Marks)


Q4:

Given an array of size N, with its items in no particular order, and a number k with
0


k



N,
find the smallest item that is larger than or e
qual to at least k items, O( N) time. You

may rearrange the items of the array if you wish.


Hint: Consider how you can use the partition subroutine.


(10 Marks)


Q5:

A
deque
is a data s
tructure consisting of a list of items, on

which the following

operations

are possible:


push
(
x
)
: Insert
x
on the front end of the deque.


pop
( ):

Remove the front item from the deque and return it.


inject(
x
)
: Insert
x
on the rear end of the deque.


eject
( ):

Remove the rear item from the deque and return it.


Describe routines to support the deque that take constant number of steps for

each
operation. You may use array
-
based or pointer
-
based implementation.

(10 Marks)






2

Q6:

For each of the following program fragments, give an analysis of the running

time. You

may use summations to evaluate the running times of nested loops.


(a)
sum = 0


for i = 1 to n


for j = 1 to i * i


for k = 1 to j


sum ++



(b)
sum = 0


for

i = 1 to n


for j = 1 to i * i


if j mod i == 0


for k = 1 to j


sum ++




(10 Marks)


Q7:

Insert 2, 9, 4, 1, 7, 10, 3, 6, 5, 8 one by one into an initially empty AVL tree. Show

the

AVL tree aft
er each insertion
.









(10 Marks)






Q8:

A min
-
max heap is a data structure that supports both
DeleteMin

and
Dele
teMax

in
O
(
log
n
)
per operation. The structure is identical to a regular heap, but the

heap property
is that for any node
x
at even depth, the key in
x
is the smallest

in its subtree, and for any
node
x
at odd depth, the key in
x
is the largest in its

subtr
ee. Assume that the root is at
even depth of 0. For example, array 6, 81, 87,14, 17, 12, 28, 71, 25, 80, 20, 52, 78, 31,
42, 31, 59, 16, 24, 79, 63, 18, 19, 32,

13, 15, 48 represents a min
-
max heap.



(a)

How do you find the minimum in a min
-
max heap?

(b)


Describe how
DeleteMin

can be done in
O
(
log
n
)
time.

(c)

How do you find the maximum in a min
-
max heap?

(d)

Describe how
DeleteMax

can be done in
O
(
log
n
)
time.









(10 Marks)















3

Course Code



:

MCS
-
022

Course Title



:

Operating System Concepts and Networking

Management

Assignment Number


:

MCA(2)/022/Assign/08

Maximum Marks


:

100


Weightage



:

25%

Last Dates for Submission

:

15
th

October, 2008 ( for July,08 session)






15
th

April, 2009 (for Jan, 09 session)


Qu
estion 1:

(a
)

What is an IP address? How is it configured? Write all the steps.


(5

Marks
)

(b
)

List and explain the various features of Bridges with the help of a diagram
.
(5

Marks
)






Question 2:

(a)

Explain
the mapping scheme of virtual address to physical address.

(10

Marks
)

(b)

Describe the page replacement and
page allocation scheme in Linux.
(5

Marks
)


Question 3:

(a)

List and describe the security features in Windows 2000 OS
.


(5

Marks
)

(b)

What are the checks that should be done before installing Linux on a machine
?

(5

Marks
)

(c)

Write a shell script in Linux to shift all characters in a file forward by

five characters. (Th
us “a”
becomes

f’
”).


(5

Marks
)


Question 4:

(a)

Write a shell script that counts a number of unique word contained in the

file and print them in alphabetical order line by
line
.



(5

Marks
)


(b)

Explain the working scheme and design principles of DNS through appropriate

diagrams.


(15

Marks
)


Question 5:

(a)

Write the steps for installing a network printer in Windows 2000 and LINUX.




(10 Marks)

(b)

How does a domain differ from workgroup
?

(5

Marks
)

(c)

How

will you secure a guest account in Windows OS
?


(5

Marks
)















4


Course Code



:

MCS
-
023

Course Title



:

Introduction to Database Management Systems

Assignment Number


:

MCA(2)/023/Assign /08

Maximum Marks


:

100

Weightage



:

25%

Last Dates for Submission

:

15
th

October, 2008 ( for July,08 session)






15
th

April, 2009 (for Jan, 09 session)


Question 1:









(20 Marks)

(a)

What are

the advantages of having three
-
level database archit
ecture? How are they
related to Data Independence? Explain with the help of an example.

(b)

What are the different forms of integrity control in database management system?
Describe with the help of examples.

(c )

What is a Transaction? What are the probl
ems of concurrent transactions? Describe with
the help of examples.

(d)

What is locking? How does it solve the problem of concurrent transaction execution?
Describe with the help of examples.

(e)

What is database security? How can a database be made more
secure?

(f)

How can a database recover from failure when many transactions are going on? Describe
with the help of an example.

(g)

What is the purpose of a Primary and Secondary indices? Explain with the help of
examples.

(h)

Which of the two indices enha
nce performance more? Give reason.

(i)

What is a distributed database management system? How is it different to that of client
server database systems?


Question 2:










(20 Marks)

(a)

How can a Database recover from the failure of media? Explain

this with the help of an
example database of a Departmental store, where online purchases and sales transactions
are going on. Also write the pseudo
-
code for the transactions such that these transactions
do not have any concurrency related problems. Use L
ocks at appropriate places. Make
suitable assumptions, if any?











(b)

Prepare an E
-
R diagram for your study center showing all the entities, the associations
like the aggregation, specialization and generalization. Assumptions can be made
wherever

necessary.










Question 3:










(20 Marks)


Consider a “Library Management System” which keeps the following tables:

Book (isbn
-
no, book
-
title, author, publisher, edition, year
-
of
-
copyright)



BookAccession (access
ion
-
no, isbn
-
no, date
-
of
-
purchase)

Members (m
-
id, m
-
name, m
-
address, m
-
phone).


5

Issue
-
return (accession
-
no, m
-
id, expected
-
date
-
of
-
return, actual
-
date
-
of
-
return)


Please note that a member can be issued a book for a period of 15 days. The actual
-
date
-
of
-
ret
urn
is kept blank for the books that have not been returned. Write and run the following SQL queries
on the tables:





(i)

Find the m
-
id and m
-
name of the members who have got maximum number of un
-
returned
books.

(ii)

List the book details along with the number of

copies for that book in the library (issued or
not
-
issued both)

(iii)

Find the names of all those students who have got all the books issued to him of the author
named “ABC” .

(iv)

Find the books that are expected to be returned in this week.

(v)

Find those members who
have not got any book issued to him/her during last six months.


Make suitable assumptions, if any.


Question 4:










(20 Marks)

Consider the Relation R={A, B, C, D, E, F, G } and the set of functional dependencies.

A→F

B→CD

C→G


F →E

What is the key for R? With the help of a suitable example discuss the Insertion, Deletion and
Updation anomalies which can arise if the relation is not in 2NF and 3NF ? Decompose R into
2NF, 3NF and finally in BCNF relation.


Question 5:










(20 Marks)

Describe the relation between following with one example each.



(i)

Serialibililty and Precedence graph

(ii)

Access Control and B
-
tree

(iii)

Multivalued dependency and 4NF

(iv)

Primary and secondary indices

(v)

Deadlock and starvation















6

Course Code



:

MCS
-
024

Course Title



:

Object Oriented Technologies

and Java Programming

Assignment Number


:

MCA (2)/024/Assign/08

Assignment Marks


:

100

Maximum Marks


:

25%

Last Dates for Submission

:

31
st

October, 2008 ( for July,08 session)






30
th

April,
2009 (for Jan, 09 session)



Question 1:


(
a)

What is Object Orientation? Explain advantages of Object Orientation.




(5 Marks)






(
b)

Explain differ
ent applications of Java programming language.


(5 Marks)



Question 2:


(
a)


Explain the meaning of
super

with example in Java.


(3 Marks)



(
b)

Write a Java program to explain the use of

logical operators in Java.

(5 Marks)



(
c)

Explain need of abstract class in Java programming.




(2 Marks)


Question 3:


(
a)

What is
break
and

continue

in Java?. Write a program to explain the

uses of these
break

and

continue

in java
.

(5 Marks)


(
b)

Explain why main method

in Java is always static and public.

(
2 Marks)


(
c)

Explain the use of
final
in Java with an example.


(3 Marks)


Question 4:

(
a)

What is interface in Java ? Write a program i
n Java to explain interface


and
multiple i
nheritance.


(5 Marks)



(
b)

What is a constructor? Explain the need of constructors overloading in


a Java program.






(5 Marks)

Q
uestion 5:


(a)

What is exception? Explain how exceptions are handled in Java. What are
different types of exceptions in Jav
a.





(5 Marks)

(b)

Explain need of String classes in Java. Also write a program in Java show how
different String Class Constructors are used to create String object. (5 Marks)



7

Questio
n 6:

(
a)

What is Multithreading? Explain different ways of implementation of

multithreading in Java.

(5 Marks)



(
b)

What is Layout Manager? Expla
in different layout managers available in Java.



(5 Marks)




Question 7:


(
a)

What is Applet? Explain Applet lifecycle
.



(5

Marks)



(
b)

Explain Color Controls available in

Java.



(5 Marks)


Question 8:



a)

What is Proxy Sever? Explain Advantages of Proxy Server
.



(5 Marks)




b)

What is JDBC? Write a Java program to mak
e a JDBC connection.

(5 Marks)






























8

Course Code



:

MCSL
-
025

Course Title



:

Lab Course

Assignment Number


:

MCA(2)/025/Assign/08

Maximum Marks


:

100


Weightage



:

25%

Last Dates for Submission

:

31
st

October,
2008 ( for July,08 session)






30
th

April, 2009 (for Jan, 09 session)


PART
-
I: MCS
-
021

Companies and people often buy and sell stocks.


Often they buy the same stock for different
prices at different times.


For example
a person owns 1000 shares a certai
n stock (such as
Reliance
), s
/
he may have bought the stock in amounts of 100 shares over 10 different times with
10 different prices.

We will analyze two different methods of accounting
--

F
IFO

and L
IFO

accou
nting used for
determining the “
cost


of a stock
.


This information is typically calculated when a stock is sold to
determined if a profit / loss was made.



In our version of
FIFO

accounting, the price of a commodity is averaged starting with the first
purchase of that item.


Say
,

we sell 250 shares of

a stock, according to this method; the purchase
price is determined by averaging the prices on the
first
250 shares bought.


In our version of
LIFO

accounting, the price of a commodity is averaged starting with the last
purchase of that item.


Say we sell

250 shares of a stock, according to this method; the purchase
price is determined by averaging the prices on the
last
250 shares bought.

In this
lab
assignment, you will be using a queue for storing data for F
IFO

accounting, and a stack
for


L
IFO

account
ing.


You should use an array based implementation for your stack

and
a linked
list for implementing your queue.

Both your stack and queue should have records with the following fields:



The name of the stock (a string or int)



The number of shares of a stoc
k (an int)



The purchase price (can be a decimal)

You can assume that the first element of the structure is the security bought first, the second was
bought second, etc.

Your program should have the user able to enter information about various stocks, the a
mount of
shares, and the price.


The user can then enter a query about a certain stock and the cost according
to the L
IFO

and F
IFO

accounting methods for a certain number of shares.


9

The following could be your menu:

Press 1 to enter a new stock

Press 2 to
find the L
IFO

and F
IFO

price for a stock.

If 1 is pressed, the user needs to enter the stock symbol, and the number of shares, and the price.

If 2 is pressed, the user needs to enter the stock symbol being queried and the number of shares in
question.

Note
: You must execute the program and submit the program logic, sample inputs and outputs
along with the necessary documentation for this question
.
Assumptions can be made wherever
necessary.




PART
-
II: MCS
-
022


Question 1:

Write a shell script to compute fa
ctorial for a given number
n
. (2 Marks)


Question 2:

(i)

Connect and configure your computer with a local network printer. (2 Marks)



(ii)

How would you set the IP address of a LAN card in Linux?

(2 Marks)



Question 3:

(i)

Enable and configure IPSec Policy on a local computer. (2 Marks)


(ii)

Configure Windows 2000 client to use DHCP, DNS and WINS. (2 Marks)











10


PART
-
III: MCS
-
023

Question 1:











Below given is
a database underlying the operations of a
XYZ

company that manages multiple
automobile dealerships throughout the United States.

The following are the data requirements of
the company:



A
car

is described by a vehicle identific
ation number (VIN), make (Example:
Toyota
),
model (Example:

Prius), year, mileage, and two prices: the
asking price

(how much the
dealership would like to sell the car for) and the
invoice price

(how much the deale
rship
paid for the car). This information is maintained for every car currently in any
dealership's inventory, and also for every car that has ever been sold by one of the
dealerships.



A
dealership

is a single location where the company sells cars. The co
mpany manages
many dealerships, each one being described by a unique dealership ID, a name (
Example:

Irvine Toyota Sales), street address, city, and state.



The company employs a number of salespeople. Each salesperson is assigned a unique
salesperson ID.



Salespeople work at one or more dealerships each month, and are paid a monthly
base
salary

at each, regardless of how many cars they sell. Additionally, they are paid a
commission on each car they sell.



Information is maintained about all salespeople who

ever worked for any dealership.



The following information is kept about each customer: Social Security Number
(necessary for the purposes of performing a credit check), name, street address, city, and
state.



Salespeople are arranged in a strict hierarch
y, with e
ach salesperson reporting to a
“managing salesperson”.




It is necessary to keep track of the inventory of cars currently available at each
dealership. Of course, a particular car can only be in the inventory of one dealership at
any given time.



A

long
-
term record of all car sales is maintained. For each sale, the company tracks what
car was bought, what customer bought it, what salesperson sold it, what dealership it was
sold by, what price it was sold for, and what date it was sold. (It is assume
d that no car
will ever be sold by the company more than once, though this is a possibility in a real car
dealership.)

Keeping in mind the data requirements described above,
create the database

as shown below
,
with the attributes making up the primary key

of each relation underlined.

car(
vin
, make, model, year, mileage, asking_price, invoice_price)

dealership(
dealership_id
, dealership_name, dealership_street_address, dealership_city,

11

dealership_state)

salesperson(
salesperson_id
, salesperson_name)

customer
(
social_security_number
, customer_name, customer_street_address, customer_city,
customer_state)

reports_to(
salesperson_id
, managing_salesperson_id)

works_at(
salesperson_id
,
dealership_id
,
month_worked
, base_salary_for_month)

inventory(
vin
, dealership_id)

s
ale(
vin
, social_security_number, salesperson_id, dealership_id, sale_price, sale_date)

Add some meaningful data for each of the tables of the database created.

Write and run the SQL statements for each of the following:

i.

Find the names of all salespeople wh
o have ever worked for the company at any
dealership.

ii.

Find the names of all salespeople who are
managed by a salesperson named “
Joe
Jones

.

iii.

List the VIN, make, model, year, and mileage of all cars in the inv
entory of the
dealership named “
Irvine Toyota S
ales

.

iv.

List the VIN, year, and mileage of all Toyota Camrys in the inventory of
the
dealership named “Irvine Toyota Sales”
. (Note that a Toyota Camry
is indicated by
the make being “
Toy
ota” and the model being “Camry”).


v.

Find the name and Social Security
Number of all customers who bought a car at a
dealership located in a state other than the state in which they live.

vi.

Find the names of all salespeople who do not have a manager.

vii.

Find the name of the salesperson that made the largest base salary working a
t the
dealership named "Irvine Toyota Sales" during January 200
8
.

viii.

Find the salesperson ID and name of all salespeople who have worked at each one of
the company's dealerships at some point in time.

ix.

List the name, salesperson ID, and total sales amount fo
r each salesperson who has
ever sold at least one car. The total sales amount for a salesperson is the sum of the
sale prices of all cars ever sold by that salesperson.

x.

Find the name and salesperson ID of the salesperson who sold the most cars for the
com
pany at dealerships located in California between
April
1, 200
7

and March 31,
200
8
.








(10 Marks)












12

PART
-
IV: MCS
-
024


Question 1:

(i)

Write a Java program to demonstrate how Exceptions are handled in Java
.
(2 Mark
s
)

(ii
)

Write a Java program, which create variable size array in Java.

(1 Mark)



Question 2:

(i)

Write a Java to demonstrate the advantage of Inheritance in Object Oriented

Programming.

(2 Marks)

(ii)

Write a Java program to check whether a given thread is alive or not. (1 Mark)


Question 3:

(i)

Write a java program to check whether a given fi
le is existing or not and if the file is not
existing create a file of that name.


(2 Marks)

(ii)

Create an Applet program, which takes keeps different GUI components in
BorderLayout.


(2 Marks)