

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Main points of this past exam are: Binary Search Algorithm, Operation, Implement, User-Defined Data Type, Capable of Storing, Integer Co-Ordinates, Visual Basic
Typology: Exams
1 / 3
This page cannot be seen from the preview
Don't miss anything!


Answer ANY five questions. All questions carry equal marks.
Examiners: Mr. D. O’Donovan Mr. D. Denieffe Dr. P. O’Sullivan
1 5 7 8 10 15 20 23 25 40 Demonstrate the operation of the Binary Sort algorithm by searching for 7. [8 %]
(b) Write code to implement the Binary Search algorithm in BASIC. [12 %]
(b) Declare an array of 300 samples as defined in (a) called ‘sampleData’. [3 %]
(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. [6 %]
(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). [6 %]
(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 %]
(b) Write a program to implement a simple calculator as illustrated in Figure 4.1. (continued on next page)