Exam Questions for Electronic Engineering Students: Computer Science Part, Exams of Computer Science

Exam questions for students in the bachelor of engineering (honours) in electronic engineering program, specifically for the computer science module. The exam covers topics such as linked lists, passing by value and reference, memory management, and sorting algorithms. Students are required to answer question 1 and three other questions, each worth a specified percentage of the total marks. The exam is conducted by mr. O’donovan, dr. Foley, and prof. Hurley.

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
Bachelor of Engineering (Honours) in Electronic Engineering – Stage 2
(EELXE_8_Y2)
Summer 2008
Computer Science
(Time: 3 Hours)
Answer Question 1 and THREE other questions.
All questions carry equal %.
Examiners:
Mr. D. O’Donovan
Dr. S. Foley
Prof. W. Hurley
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 Exam Questions for Electronic Engineering Students: Computer Science Part and more Exams Computer Science in PDF only on Docsity!

Cork Institute of Technology

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

(EELXE_8_Y2)

Summer 2008

Computer Science

(Time: 3 Hours)

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

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

  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 mechanism of passing by value as used in C. Use an example and appropriate memory diagrams (C name, memory address and contents) to illustrate your answer. What is the drawback of this approach when trying to return multiple pieces of information from a function? [5 %] (b) Subsequently, describe the mechanism referred to as passing by reference. Use appropriate memory diagrams in your description. [5 %] (c) Given the following lines of C code: #include<stdio.h> #include<stdlib.h> #include<malloc.h> void Function (float **h); void main(void) { float *y; Function(&y); free(y); } void FunctionCall(float **h) { *h = (float *)malloc(sizeof(float)); }

C Name Address in Memory y (^) 0xFFFFA h 0xFFFFA Value returned from malloc 0xFFEBFC Table 3- (i) Using memory diagrams, in conjunction with the addresses supplied in Table 3- illustrate the variable assignments that occur in the above program. [7 %] (ii) Why is the double star i.e. ‘**’ notation required? [3 %]

(d) Using the unsorted sequence, A={2, 8, 5, 9, 3}, illustrate the operation of the Insertion Sort pseudocode supplied paying particular attention to the array, A , indexes (1- length[A]) Insertion Sort (A) for j ← 2 to length[A] do key ← A[j] i ← j- while i>0 and A[i] >key do A[i+1] ← A[i] i ← i- A[i+1] ← key [5 %]

  1. (a) What is recursion and discuss the attributes required by such a function. [3 %]

(b) Write a function to implement the Factorial function i.e. n! = ( n )( n − 1 )( n − 2 ),......., ( )( )( ) 3 21

AND use it to illustrate the attributes discussed in (a). [4 %]

(c) The merge sort algorithm is an example of a recursive sort algorithm. Write a C program to implement the merge sort algorithm. [18 %]

  1. (a) Compare the Direct methods and Iterative methods for solving numerical problems on a

computer. [5 %]

(b) Write a C program to implement the Newton-Raphson method for solving non-linear

equations. Use the following function: f ( x ) = 3 x^3^ + 2 x^2 − x + 4 [12 %]

(c) Describe the Bisection method for solving non-linear equations. [5 %]

(d) Compare the Bisection and the Newton-Raphson methods for solving non-linear equations. [3 %]