Application Programming Question Paper
Application Programming
Course:Bachelor Of Science In Information Technology
Institution: Kca University question papers
Exam Year:2011
UNIVERSITY EXAMINATIONS: 2010/2011
SECOND YEAR STAGE EXAMINATION FOR THE DEGREE OF BACHELOR
OF SCIENCE IN INFORMATION TECHNOLOGY
BIT 2105: APPLICATION PROGRAMMING
DATE: APRIL 2011 TIME: 2 HOURS
INSTRUCTIONS: Answer question ONE and any other TWO questions
QUESTION ONE (30 marks)
a) Explain two differences between general procedure and functions in visual basic (6 Marks)
b) Define the following terms and clearly show how they are declared.
i) Variable
ii) Constant
iii) Array (6 Marks)
c) List any 3 objects and 3 events used in VB and explain their functions. (6 Marks)
d) List and briefly describe 4 flow control constructs supported by Visual Basic. (6 Marks)
e) Based on variable scope, variables in visual basic can be grouped into three. Explain (6 Marks)
QUESTION TWO (20 marks)
a) (i) Distinguish between run-time errors and logic(semantic) errors, briefly explaining any two(2)
causes for each. (6 Marks)
b) Identify and explain how to correct the error(s) in each of the following code segments: Assume
that the variables used are declared.
(i) The following code should print the values 1 to 10:
2
x = 1
do while (x < = 10)
print x
Loop (2 Marks)
(ii) for y = 0.1 To 1
print y
Next y (2 Marks)
(iii) The following code should output the even integers from 2 to 100:
counter = 2
Do
if (counter mod 2 = 0) then
Print counter
counter = counter + 2
end if
Loop While (counter <= 100)
(2 Marks)
c) Consider the following algorithm:
(i) Declare an array ‘score’ for storing 5 subject scores for each of the 30 students in
a class.
(ii) Repeat the following for all students:
• Input the 5 subject scores into the array.
• Compute the total and average mark for each student.
• If average is at least 50 and not more than 100, then output “Student
passed” otherwise output “Student failed”.
Write a program to implement the above.
(8 Marks)
QUESTION THREE (20 marks)
a) Compare and contrast option buttons and checkboxes as used in Visual Basic. (4 Marks)
b) Briefly explain the importance of comments in a program. (4 Marks)
3
c) Briefly describe any TWO advantages of using sub procedures or functions in a program.
(4 Marks)
d) 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 = 76 Kshs) (8 Marks)
QUESTION FOUR (20 marks)
Consider the table given below:
Table Name: ITEMS
ItemCode ItemName Supplier ItemCost TestPeriod(wks)
001 VBScript Microsoft 60,000 5
005 Eclipse Sun 100,000 10
007 VisualBasic Microsoft 90,000 6
008 BlueJ Sun 80,000 9
009 RationalRose
InformIT
50,000 7
a) Write SQL statements that will perform the following:
(i) Create the table structure above. (2 Marks)
(ii) Input the first two records into the table. (4 Marks)
(iii) Remove the column named TestPeriod(wks). (2 Marks)
(iv) Insert another column named YearOfManufacture. (2 Marks)
(v) Displays the average cost of those products that have a TestPeriod of less than 10 weeks
and are not from Sun. (2 Marks)
(vi) Differentiate between the two main SQL components providing an example code on how
each one of them is used. (2 Marks)
b) With the use of suitable code, explain how you would generate a report based on
parameterized queries, to print only those items, from the ITEMS table provided in
the table above, which cost more than 50,000 and have a TestPeriod of less than 10 weks.
(6 Marks)
4
QUESTION FIVE (20 marks)
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)
(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)
More Question Papers
Exams With Marking Schemes