Вы находитесь на странице: 1из 14

Department of Electrical and Computer Engineering

Computer Stream

Written Exam for Assistance Lecture

Academic Year, 2009 E.C Examination Date, 30/10/2009

Time Allowed, 3:30 Max Mark, 60%

Name: _____________________________Code_________________________

General Instructions

Switch off your mobile phone


Any kind of cheating will disqualify your result

For Instructors Use Only

PART 1 PART 2 PART 3 Total

Good Luck!

Page 1
Part I (Explain)

1. Write down OSI model layers and their major function or tasks(3 pts)

Answer: Attached on the separate sheet

Page 2
2. Write down TCP/IP model layers and their major function tasks.(3 pts)

Answer: Attached on the separate sheet

Page 3
3. Define the following network protocols, terms and words. (4 pts)

SMTP
TCP
UDP
Https

Answer: Attached on the separate sheet

Page 4
4. Write a pseudo code for insertion-sort algorithm? (4 pts)

Answer:

For j= 2 to A.Length

Key = A[j]

i= j-1

while j>0 and A[i]>Key

A[i+1] = A[i]

i= i-1

A[i+1] = key

Page 5
5. What is operating system and list its major functions? (3 pts)

Answer:

An operating system (OS) is system software that manages computer hardware and software
resources and provides common services for computer programs. All computer programs,
excluding firmware, require an operating system to function.

I. Process Management:
II. Memory Management:
III. Scheduling

Page 6
6. Briefly explain the difference between stack and queue? (3 pts)

Answer:

Queue is also an abstract data type or a linear data structure, in which the first element is inserted
from one end called REAR(also called tail), and the deletion of exisiting element takes place
from the other end called as FRONT(also called head). This makes queue as FIFO data
structure, which means that element inserted first will also be removed first.

The process to add an element into queue is called Enqueue and the process of removal of an
element from queue is called Dequeue

Stack is an abstract data type with a bounded (predefined) capacity. It is a simple data structure
that allows adding and removing elements in a particular order. Every time an element is added,
it goes on the top of the stack; the only element that can be removed is the element that was at
the top of the stack, just like a pile of objects.

Page 7
7. Clearly explain stored program concept with the help of neat block
diagram? (3 pts)

Answer:

A computer program could be represented in a form suitable for storing in memory


alongside the data. Then, a computer could get its instructions by reading them from
memory, and a program could be set or altered by setting the values of a portion of
memory.

Page 8
8. What is pipelining and explain its advantage? (3 pts)

Definition:

Pipelining is a form of computer organization in which successive steps of an instruction


sequence are executed in turn by a sequence of modules able to operate concurrently, so
that another instruction can be begun before the previous one is finished.

Advantage:

Enhance the performance of a computer by increasing its throughput.

Page 9
9. Compare and contrast two popular computer architectures? (4 pts)

Answer:

No Vonueman Architecture Harvard Architecture


1 Data and program stored in the same memory Data and program stored in different
memory
2 The code is executed serially and take more clock Code executed in parallel
cycles
3 Absence of barrel shifter Presence of barrel shifter
4 Program can be optimized in lesser size The program tend to grow big in size

Page 10
Part II (programming using Java/C++)

1. Write a function that accepts an array of non-negative integers and


returns the second largest integer in the array. Return -1 if there is no
second largest. (5 pts)

Answer:

Static int a1(int[] a)


{
int max1 = -1;
int max2 = -1;

for (int i=0; i<a.length; i++)


{
if (a[i] > max1)
{
max2 = max1;
max1 = a[i];
}
else if (a[i] != max1 && a[i] > max2)
max2 = a[i];
}

return max2;
}

Page 11
2. Write a function that accepts a character array, a zero-based start
position and a length. It should return a character array containing
length characters starting with the start character of the input array
[sub array]. The function should do error checking on the start position
and the length and return null if the either value is not legal.(5 pts)

Answer:
static char[] a3(char[] a, int start, int length)
{
if (length < 0 || start < 0 || start+length-1>=a.length)
{
return null;
}

char[] sub = new char[length];


for (int i=start, j=0; j<length; i++, j++)
{
sub[j] = a[i];
}

return sub;
}

Page 12
Part III (Design)

1. Assume your client approached you to design a microcontroller based


door lock system with the following functional modules (units)
Authentication Module, Alert Module, Display Unit and Actuation
Module.(10 pts 2.5 for each)

I. Draw the block diagram for your proposed hardware design?


II. Draw Schematic diagram for your proposed hardware design?
III. Draw the flow chart for your proposed firmware (Microcontroller
code) design?
IV. List the necessary materials for your proposed design?

Answer: attached on another sheet

Page 13
2. A database is being constructed to keep track of the teams and games of
a sports league. A team has a number of players, not all of whom
participate in each game. It is desired to keep track of the players
participating in each game for each team, the positions they played in
that game, and the result of the game. Design a Relational Database
Schema diagram for this application, stating any assumptions you
make. Use football as sport league.(10 pts)

Answer: attached on another sheet

Page 14

Вам также может понравиться