Electronic Engineering Exam - Computer Science (Autumn 2006), Exams of Computer Science

The instructions and questions for a bachelor of engineering (honours) in electronic engineering exam in the computer science subject. The exam covers topics such as linked lists, passing by reference, recursion, binary trees, and matrix operations. Students are required to answer questions related to defining data structures, writing functions, and implementing algorithms.

Typology: Exams

2012/2013

Uploaded on 03/30/2013

lallit
lallit 🇮🇳

4

(27)

150 documents

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Cork Institute of Technology
Page 1 of 4
Bachelor of Engineering (Honours) in Electronic Engineering- Stage 2
(NFQ Level 8)
Autumn 2006
Computer Science
(Time: 3 Hours)
Answer Question 1 and THREE other questions.
All questions carry equal marks.
Examiners: Mr. D. O’Donovan
Prof. G. Hurley
Dr. S. Foley
1. (a) A traffic monitoring system is required to determine the behaviour of motorists in the Cork
city area. The system requires the entry from the keyboard of the:
model
make
registration number
as the cars pass an observation point.
Using a linked-list approach, define a C language data structure capable of storing the above
information. [4 %]
(b) Write a function which will add an entry to the linked list. [8 %]
(c) Determine the number of Volvo cars which passed the observation point. [6 %]
(d) Delete the list. [7 %]
pf3
pf4

Partial preview of the text

Download Electronic Engineering Exam - Computer Science (Autumn 2006) and more Exams Computer Science in PDF only on Docsity!

Cork Institute of Technology

Bachelor of Engineering (Honours) in Electronic Engineering- Stage 2

(NFQ Level 8)

Autumn 2006

Computer Science

(Time: 3 Hours)

Answer Question 1 and THREE other questions. All questions carry equal marks.

Examiners: Mr. D. O’Donovan Prof. G. Hurley Dr. S. Foley

  1. (a) A traffic monitoring system is required to determine the behaviour of motorists in the Cork city area. The system requires the entry from the keyboard of the: ‰ (^) model ‰ make ‰ registration number as the cars pass an observation point. Using a linked-list approach, define a C language data structure capable of storing the above information. [4 %] (b) Write a function which will add an entry to the linked list. [8 %] (c) Determine the number of Volvo cars which passed the observation point. [6 %] (d) Delete the list. [7 %]
  1. (a) Describe the operation of the mechanism referred to as passing by reference. [3 %]

(b) Given the following lines of C code: #include<stdio.h> #include<stdlib.h> #include<malloc.h> void FunctionCall(int **q); void main(void) { int *y; FunctionCall(&y); free(y); } void FunctionCall(int **q) { *q = (int *)malloc(sizeof(int)); }

C Name Address in Memory y (^1234) q 2468 Value returned from malloc 3579 Table 2- (i) Using diagrams, in conjunction with the addresses supplied in Table 2-1 illustrate the variable assignments that occur in the above program. [6 %]

(ii) Why is the double star i.e. ‘**’ notation required? [4 %]

(c) Write a function(s) using the C language to add a new node to a linked list with zero nodes. The structure of the node is as follows: typedef struct List, *ListPtr;struct List { (^) int Element; ListPtr NextElement; }; [12 %]

  1. (a) Define the ‘big-O’ notation with regard to algorithm complexity and give an intuitive explanation of this definition. Indicate typical ‘big-O’ values. [5 %]

(b) In the following sequence 50 is chosen as the pivot. Illustrate how the QuickSort algorithm would insert the pivot into its correct position:

50, 30, 20, 80, 90, 70, 95, 85, 10, 15, 75, 25 [5 %]

(c) Write C code to implement the QuickSort algorithm. [15 %]