0% found this document useful (0 votes)
4 views4 pages

Sit104 Visual Basic Programming (1)

This document outlines the examination paper for the Visual Basic Programming course at Machakos University for the 2021/2022 academic year. It includes instructions, a series of questions covering various aspects of Visual Basic programming, such as components of the Integrated Development Environment, variable declarations, user-defined data types, and error handling. The exam consists of five questions, requiring students to answer question one and any two additional questions.

Uploaded by

kengashkg7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views4 pages

Sit104 Visual Basic Programming (1)

This document outlines the examination paper for the Visual Basic Programming course at Machakos University for the 2021/2022 academic year. It includes instructions, a series of questions covering various aspects of Visual Basic programming, such as components of the Integrated Development Environment, variable declarations, user-defined data types, and error handling. The exam consists of five questions, requiring students to answer question one and any two additional questions.

Uploaded by

kengashkg7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

MACHAKOS UNIVERSITY

University Examinations for 2021/2022

SCHOOL OF ENGINEERING AND TECHNOLOGY


DEPARTMENT OF COMPUTING AND INFORMATION TECHNOLOGY
FIRST YEAR SPECIAL / SUPPLEMENTARY EXAMINATIONS FOR
BACHELOR OF SCIENCE (INFORMATION TECHNOLOGY)
SIT104: VISUAL BASIC PROGRAMMING
DATE: 29/8/2022 TIME: 8.30-10.30 AM
INSTRUCTIONS:
This paper consists of FIVE questions
Answer question one and other two questions in this paper

1. (a) (i) Describe each of the following components of the Visual Basic Integrated
Development Environment.
I. ToolBox;
II. Form designer. (4 marks)
(ii) John, a program prefers to use Visual Basic programming language to create
applications. Outline three features of Visual Basic language that could have
led to this preference. (3 marks)
(b) (i) Describe each of the following Visual Basic objects:
I. Picture Box;
II. Vertical ScrollBar;
III. Shape. (6 marks)
(ii) Distinguish between explicit and implicit variable declaration as used in
Visual Basic programming. (4 marks)

(c) (i) State the prefix associated with each of the following Visual Basic controls:
I. CommandButton;
II. TextBox;
III. Label;
IV. ListBox. (2 marks)

Examination Irregularity is punishable by expulsion Page 1 of 4


(ii) Describe each of the following types of procedures:
I. Event procedure;
II. Property procedure. (4 marks)
(d) Write a Visual Basic program that would prompt a user to enter either a rectangle or
a circle. The program then prompts the user to enter the dimensions of the selected
figure and then computes and outputs the area using a function. All the entries are
through input box and the output is through a message box. (7 marks)
2. (a) (i) State whether or not each of the following terms are valid Visual Basic
variables:
II. County//
III. Student_Name
IV. String (4 marks)
(ii) Assuming Visual Basic programming language, state the order of execution
of the following statement.
Y = X ^3 + Y – A * (B / C) (2 marks)
(b) (i) Write the output generated by each of the following Visual Basic string
functions.
I. Len(Machakos University)
II. Trim( Valentine ) (2 marks)
(ii) Write the output generated when the following Visual Basic statement is
executed:
A = sgr(B) given that B = 16 (2 marks)

(c) Distinguish between local and static variables as used in Visual Basic programs.
(4 marks)
(d) Write a Visual Basic program that will generate the following output on a form.

The value of a is: 10


The value of a is: 15
The value of a is: 20 (6 marks)
3. (a) (i) Explain the term user defined data type as used in programming. (2 marks)
(ii) Creat a data type that would be able to store a product details that include
productID, productName, quantity and price in a visual basic program.
(4 marks)

Examination Irregularity is punishable by expulsion Page 2 of 4


(b) (i) Explain two methods used to connect a Visual Basic program to a database.
(4 marks)

(ii) Describe two components that are necessary for the creation of a Visual
Basic report. (4 marks)

(c) A program prompts a user to enter the number of students in a lecture room. The
program then prompts a student to the fee paid in the semester. A message “You
have cleared” is displayed when a student has paid all the fee, otherwise a message
“You have not cleared” is displayed.
Draw a flow chart that could be used to implement the program logic. (6 marks)
4. (a) (i) Outline three data types other than integer used in Visual Basic programming
language. (3 marks)
(ii) Study the following Visual Basic program code and then answer the question
that follows:
Private Sub cmdResults_Click()
Dim Num1, Num2, Num3, Num4 As Integer
Num1 = (InputBox(“Enter an Integer”))
Num2 = (InputBox(“Enter an Integer”))
Num3= Num1/Num2
Num4 = Num1 mod Num2
Print Num3
Print Num4
End Sub

State the output generated given that Num1 = 10 and Num = 5 (4 marks)
(b) (i) Construct a truth table for the AND logical operator. (4 marks)
(ii) Represent the while..loop in a flow chart segment. (3 marks)
(c) Mashinani University allows applicants to apply for courses online. The application
form consists of a label, a text box, option buttons, combobox and a command
button.
The label is placed next to the text box to identify it, the applicant types his/her name
in the textbox, selects the appropriate option for the gender and then selects a course
through the combo box. The information is then submitted by clicking the command
button.

Examination Irregularity is punishable by expulsion Page 3 of 4


Assuming Visual Basic programming language environment, sketch the interface
that could be used to implement this logic. (6 marks)
5. (a) Sketch the output generated when the following Visual Basic statement is executed.
(3 marks)
RegNo = InputBox ("Enter the registration number", “Reg Number”,
xxxx)
(b) Write a Visual Basic program that would generate the following output on a form.
50 60 70
50 60
50
Attach the code to a command button. (4 marks)
(c) Distinguish between do while.. loop and do.. loop while iteration statements as used
in Visual Basic programs. (4 marks)
(d) (i) Outline three functions used to handle errors in Visual Basic programming.
(3 marks)
(ii) Explain three types of errors that could be encountered in programming.
(6 marks)

Examination Irregularity is punishable by expulsion Page 4 of 4

You might also like