Bubble Sort algorithm - Computer Systems and Programming - Exam, Exams of System Programming

Main points of this past exam are: Bubble Sort Algorithm, Operation, Implement, User-Defined Data Type, Storing, Amplitude and Time, Sample Data

Typology: Exams

2012/2013

Uploaded on 03/30/2013

lalchand
lalchand 🇮🇳

4.4

(67)

117 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Cork Institute of Technology
Page 1 of 3
Higher Certificate in Engineering in Electronic Engineering – Award
(NFQ – Level 6)
Autumn 2006
Computer Systems & Programming
(Time: 3 Hours)
Answer ANY five questions.
All questions carry equal marks.
Examiners: Mr. D. O’Donovan
Mr. J. Berry
Dr. Ronan O Dubhghaill
1. (a) Describe the operation of the Bubble Sort algorithm. Use the list:
A F S V W Q Z X Y L
To illustrate the results after one pass of a Bubble sort in ascending order. [8 %]
(b) Write code to implement the Bubble sort algorithm in BASIC. [12 %]
2. (a) Define a user-defined data type, called ‘sample’, capable of storing two integer co-ordinates
– called amplitude and time. [4 %]
(b) Declare an array of 300 samples as defined in (a) called ‘sampleData’. [2 %]
(c) Write Visual BASIC code such that when the command Button ‘Read’ on the program form
is clicked i.e. ‘Read_click()’ event occurs, the sample data from a file called ‘c:\input.dat’ is
loaded into the array defined in (b). The data should be read until the end of file is reached.
The data is stored in the format: amplitude1, time1, amplitude2, time2, amplitude3, time3,
etc. [7 %]
(d) Write Visual BASIC code for the button ‘Average_click()’ event to calculate the average of
the amplitude values extracted from the file in (c). [7 %]
pf3

Partial preview of the text

Download Bubble Sort algorithm - Computer Systems and Programming - Exam and more Exams System Programming in PDF only on Docsity!

Cork Institute of Technology

Higher Certificate in Engineering in Electronic Engineering – Award

(NFQ – Level 6)

Autumn 2006

Computer Systems & Programming

(Time: 3 Hours)

Answer ANY five questions. All questions carry equal marks.

Examiners: Mr. D. O’Donovan Mr. J. Berry Dr. Ronan O Dubhghaill

  1. (a) Describe the operation of the Bubble Sort algorithm. Use the list: A F S V W Q Z X Y L To illustrate the results after one pass of a Bubble sort in ascending order. [8 %]

(b) Write code to implement the Bubble sort algorithm in BASIC. [12 %]

  1. (a) Define a user-defined data type, called ‘sample’, capable of storing two integer co-ordinates
    • called amplitude and time. [4 %] (b) Declare an array of 300 samples as defined in (a) called ‘sampleData’. [2 %] (c) Write Visual BASIC code such that when the command Button ‘Read’ on the program form is clicked i.e. ‘Read_click()’ event occurs, the sample data from a file called ‘c:\input.dat’ is loaded into the array defined in (b). The data should be read until the end of file is reached. The data is stored in the format: amplitude1, time1, amplitude2, time2, amplitude3, time3, etc. [7 %] (d) Write Visual BASIC code for the button ‘Average_click()’ event to calculate the average of the amplitude values extracted from the file in (c). [7 %]
  1. (a) Explain each of the following terms as they apply to Visual BASIC giving a typical example where appropriate: o Event procedures o Methods o Properties o Form o Module [10 %] (b) What is meant by the ‘scope’ of a variable in Visual BASIC? How would you make a variable visible to all modules and forms of a program? [5 %]

(c) Which methods are used to determine the following information about a listbox? i. Number of elements ii. The currently selected item iii. The array containing the data iv. Add an element to the list v. Remove an element [5 %]

  1. (a) State and describe the important properties of the:
    • command button
    • scrollbar
    • option box
    • timer [8 %] (b) Write a program to implement a simple calculator as illustrated in Figure 4.1. (continued on next page)