UNIVERSITY EXAMINATIONS: 2013/2014
ORDINARY EXAMINATION FOR THE BACHELOR OF SCIENCE
IN INFORMATION TECHNOLOGY
BIT 2105 APPLICATION PROGRAMMING
DATE: APRIL, 2014 TIME: 2 HOURS
INSTRUCTIONS: Answer Question ONE and any other TWO
QUESTION ONE
(a) List FOUR types of picture files that can be held in a Picture Box. (4 Marks)
(b) Differentiate between the following controls
(i) Picturebox and Image control
(ii) Option button and Check box control
(4 Marks)
(c) With help of examples explain the following functions
(i) Globalisation enumeration
(ii) CBool
(2 Marks)
(d) Define the following terms and clearly show how they are declared and
initialized:
(i) Variable
(ii) Constant
(iii) Array
(6 Marks)
(e) Describe the following argument passing mechanisms as used in VB.
(4 Marks)
(i) Passing by reference
(ii) Passing by Value
(f) Write a program to generate a Business Travel Expense attachment for an
income tax return. The program should request as input the name of the
organization visited, the date and location of the visit, and the expenses for
meals and entertainment, airplane fare, lodging, and taxi fares. (Only 50% of
the expenses for meals and entertainment are deductible as discount.) Design
and draw a possible form layout and write code for the program that would
compute the total costs minus the computed discount. Sub procedures should
be used for the input and output. (10 Marks)
QUESTION TWO
(a) Briefly explain the importance of comments in a program. (4 Marks)
(b) Briefly describe any TWO advantages of using sub procedures or functions in
a program. (4 Marks)
(c) Write a program that accepts money in US dollars through an Input Box
function and converts it to Kenya Shillings, through the use of a function
named convert. The program should output the Kenya Shilling value through
a Message Box function upon the click of a command button.
1 US Dollar = 80 Ksh (8 Marks)
(d) List four data properties of the Data Control Object (DAO) (4 Marks)
QUESTION THREE
(a) (i) Write a function procedure to calculate the area of a triangle when the
base and the height have been passed to the function (3 Marks)
(ii) Write a short program that makes use of the function in a (i) above to
calculate the area of the triangle. The base and height are entered through
inputbox functions and the result is displayed in a message box function
(3 Marks)
(iii) Sketch the GUI for your application (1 Mark)
(b) List the steps followed when: –
(i) Setting the start-up object for your application
(ii) Adding an Active-X object to your toolbar
(4 Marks)
(c) With the help of examples explain the use of the following: –
(i) Val
(ii) Cint
(iii) RGB
(iv) RND
(4 Marks)
(d) List the steps you would follow to convert your visual basic project into an
executable file (.EXE)
QUESTION FOUR
(a) A database in drive C:\ and is named dbKCA.mdb is contained in a folder
called students system. You are required to use a data control (DatKCA) to
link the database to a visual basic program. The following are the fields in the
database table named tblstudents, which are displayed using textboxes.
Admission Number, Name, Town, Course.
Required:
(i) State the values for each of the following properties of the data control.
Database name
Record source
(4 Marks)
(ii) State the values for the following properties of the bound controls (Text
Boxes)
Datasource
Datafield
(4 Marks)
(b) Write the codes to perform the following tasks. (6 Marks)
a. Add a new record
b. Update the record
c. Move to next record
(c) Write code to search for a value entered through an input box dialog given
that the RecordSetType setting of the data control is Dynaset. (6 Marks)
QUESTION FIVE
(a) (i) Describe the steps that are followed while connecting to a database using
the ADODC control. (6 Marks)
(ii) Explain how the ADODC differs from the DataEnvironment facility.
(2 Marks)
(b) Using the ADODC control, write appropriate VB procedures that will assist a
user to achieve the following at the click of a button.
(i) shift from one record to the next one. (3 Marks)
(ii) shift from one record to the previous one . (3 Marks)
(iii) (Use relevant control statements to ensure that an appropriate message
is displayed if a user tries to shift to the next record when on last
record, or to the previous record when already on first record).
(c) Briefly describe any THREE techniques for speeding up your VB
applications. (6 Marks)