Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Computer Science Exam Questions for Electronic Engineering Bachelor, Exams of Computer Science

Exam questions from a computer science module for students pursuing a bachelor of engineering in electronic engineering at cork institute of technology. The questions cover topics such as linked lists, stack data types, memory allocation, gaussian elimination, and binary search trees. Students are required to define data structures, write functions, and answer theoretical questions.

Typology: Exams

2012/2013

Uploaded on 03/30/2013

lallit
lallit 🇮🇳

4

(29)

134 documents

1 / 4

Toggle sidebar

Related documents


Partial preview of the text

Download Computer Science Exam Questions for Electronic Engineering Bachelor and more Exams Computer Science in PDF only on Docsity! Cork Institute of Technology Page 1 of 4 Bachelor of Engineering (Honours) in Electronic Engineering – Stage 2 (Bachelor of Engineering in Electronic Engineering – Stage 2) (NFQ – Level 8) Autumn 2005 Computer Science (Time: 3 Hours) Answer Question 1 and THREE other questions. All questions carry equal %. Examiners: Prof. C. Burkley Mr. D. O’Donovan Mr. J. G. Ryan Q1 (a) Define a structure capable of implementing a linked list based stack data type. Assume the information consists of one piece of data of type integer [3 %] (b) Write functions to implement the following for a linked-list based stack: i. Initialise the stack [2 %] ii. Push information onto the stack [10 %] iii. Pop information off the stack [5 %] (c) Why is it so important to deallocate the pointer when popping information from the stack in (b)? [3 %] (d) The C language makes great use of the system stack. Briefly describe the purpose and use of the stack in the context of the execution of a C program. [2 %] Q2. (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); } Page 2 of 4 void FunctionCall(int **q) { *q = (int *)malloc(sizeof(int)); } C Name Address in Memory y 1234 q 2468 Value returned from malloc 3579 Table 1 (i) Using diagrams, in conjunction with the addresses supplied in Table 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 %] Q3. (a) What is meant by the terms static and dynamic memory allocation? [4 %] (b) The prototype for the malloc()function in C is:- void *malloc(size_t numBytes); (i) Explain the purpose and operation of this function. (ii) What are the implications of the void * and size_t numBytes for the function’s typical use in a program? Illustrate your answer by example. [6 %] (c) Write a C program which performs the following operations.
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved