2021 CMIS216 VB - Net Assignments
2021 CMIS216 VB - Net Assignments
In Collaboration with
Page |1
TRUST ACADEMY
In Collaboration With
MIDLANDS STATE UNIVERSITY
NAME: M
SURNAME: N
PROGRAMME: D
LECTURER: M. NDLOVU
EMAIL: n
TEL: +263 77
COURSE: CMIS 216: COMPUTER
PROGRAMMING (VB.NET)
ASSIGNMENTS
ASSIGNMENT:
COMMENTS:
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
Page |2
ASSIGNMENT 1 DUE: 19/02/2021
Your answers should always be accompanied by Code Snippets and Syntaxes for
programs.
Question 1)
i) Define Object Oriented Programming (OOP) [4]
ii) What are the benefits of OOP [6]
Question 2) Define the following
i) Namespace
ii) Variable
iii) User define data type
iv) Methods
v) Array [10]
Question 3)
i) State five (5) languages supported by Dot Net framework. [5]
ii) How are single line and multiple line comments written in a vb.net program? [5]
Question 4) Distinguish the following:
i) Method and Property.
ii) Functions and subs.
iii) Call by Val and Call by ref.
iv) Syntax error and runtime error.
v) Single line comment and multiple line comments. [10]
Question 5) Define the following terms
i) Encapsulation
ii) Inheritance
iii) Polymorphism
iv) Garbage collection [10]
Question 6) Show how the following elements are declared. Please write down the syntax first
and then give an example:
Page |3
i) Variable
ii) Array
iii) Constant
iv) String
v) User defined data type [10]
Question 7) How are errors handed in VB.Net? Show using an example how a try, catch and
finally clauses are implemented. [10]
Question 8) With aid of examples explain how any three iteration structures are implemented
in VB.Net. [10]
Question 9) What are the 3 steps taken when designing a VB.Net program? [10]
Question 10) Explain the following
i) Project
ii) Properties
iii) ToolBox. [10]
Question 11) Differentiate
i) Method and Property.
ii) Functions and Sub.
iii) Syntax and Semantic errors.
iv) Char and Chars()
v) Call By Val or By Ref.
vi) Local Variable and Global Variable. [10]
Question 12)
a) State five (5) languages supported by Dot Net framework. [5]
b) How are single line and multiple line comments written in a vb.net program? [5]
Question 13) Define the following terms:
i) Class
ii) Method
iii) Object
iv) Instantiation
v) Attributes [10]
Question 14) Using examples explain the following types of programming paradigms:
i) Low-level programming paradigm
Page |4
ii) Imperative programming paradigm
iii) Object-oriented programming paradigm
iv) Declarative programming paradigm [10]
Question 15) Briefly explain the following stages in the program development cycle:
i) Problem solving
ii) Design
iii) Coding
iv) Translation
v) Execution
vi) Testing [10]
E.N.D
Page |5
ASSIGNMENT 2 DUE: 12/03/2021
Test 1 due: 12/03/2021
Your Answers should always be accompanied by Code Snippets and Syntaxes where
required – Penalty for late submission = 20% per delayed day
Page |6
Choose Two Questions
Question 5)
a) Briefly explain this program using comments for each line. [10]
End Sub
End
End sub
sngPurchasePrice = 150.95
[10]
Page |7
Question 6) Using VB.Net write a program that simulates a calculator. [20]
Question 7)
a) What is the purpose of indentation in a program? [2]
b) Analyze the following program and explain its use:
c) Design an interface for your program in part a using appropriate controls. [2]
Question 8)
a) Write a program using functions and subs that checks if you have correctly entered a
username and a password. [10]
b) Using any iteration structure of your choice how would one design an application that
requests a till operator to enter items and store them in an array as well as their prices for
sale. The program is supposed to total the groceries and calculate change. [10]
Page |8
Question 9)
a) Briefly explain the following using examples:
i) Multi - dimensional array
ii) Jagged array
iii) Dynamic array. [10]
b) Write a VB.Net code that allows the user to enter a range of numbers and determines the
following:
i) All odd numbers.
ii) All prime numbers in the range.
iii) All multiples of 3 in the range. [10]
Question 10)
Write a program that checks whether a student has passed out of 8 subjects namely
English, Mathematics, Science, Geography, History, Art, Computer Science and Music. A
student passes if he/she passes at least 5 subjects including English, Maths and Science.
[20]
Question 11)
a) Design and write code for a simple application that accepts names of 5 cities and add to a
comboBox. The program must also allow user select a city and remove it from comboBox,
clear all cities as well as exit. [10]
b) What is the output from the following code snippets?
Page |9
a) What is the output of the following program when the button is clicked?
If (a < b) Then
If (b < c) Then
txtOutput.Text = b & “is between “ & a & “ and “ & c
End If
End If [2]
Question 12)
a) Write a code which accepts names of 5 cities and add them into a comboBox. After the
user select a city from comboBox the program must allow the user to remove it from
comboBox. [10]
b) Write a program using functions and subs that checks if you have correctly entered a
username and a password. [10]
END
P a g e | 10
ASSIGNMENT 3 DUE: 26/03/2021
Test 2 due: DUE: 26/03/2021
Your Answers should always be accompanied by Code Snippets and Syntaxes – Penalty
for late submission = 20% per delayed day
Connect to the Database using Visual basic and display all the records in the Database using the
data grid control. [20]
P a g e | 11
Choose 4 questions
Question 3)
Create a windows application that contains a List Box control and a Button control. In the Click
event for the button, create a For . . . Next loop that will count from l to 10 and display the results
in the listbox. Then create another for . . . Next loop that will count backwards from 10 to l and
also display those results in the listbox. [20]
Question 4)
Design a program that allows the user to input student name, and 5 exams that he has written that
year. The program must then calculate the average mark for all subjects per student, the mean for
every exam.
NB: Use input box and arrays and structures. [20]
Question 5) Create a simple Windows application with a Textbox control and two Button
controls. Set the buttons to open a file and to save a file. Use the OpenFileDialog class (not
the control) and the SaveFileDialog class to open and save your files.
Hint: To use the corresponding classes for the controls - use the following statements:
Dim objOpenFileDialog As New OpenFileDialog
Dim objSaveFileDialog As New SaveFileDialog [20]
Question 6) Develop a VB application program to simulate the traffic signals, by using
following conditions.
a) Form controls of three signals RED, YELLOW and GREEN in an order of column wise.
b) Form controls of one timer label, to display the time out of the signal
c) While transforming the signal from RED to GREEN, signal travel to YELLOW signal.
d) Time out for RED signal is 180 Secs, GREEN signal is 120 Secs, YELLOW is 60 Secs.
[20]
Question 7)
i) Using a select case design a program that will accept a value in the form of a number
and determines whether the corresponding month has 31 days, 30 days or is the
month of February. For example, if the user enters 1, the program should display a
statement “The month of January has 31 days”. [15]
P a g e | 12
ii) Explain the difference between an InputBox () and a MsgBox (). Demonstrate the use
of each in a VB program. [5]
Question 8) Write a program that accepts marks for n number of students and determines the
following;
iii) The Highest Mark
iv) The Lowest Mark
v) The Average Mark
vi) Marks above the average
Using at least two different types of loops for each part question. [20]
Write the code for the declaration and assignment of this structure. [5]
P a g e | 13
Question 12)
i) Write a program to take as input the length and width of a rectangular garden. The
program is to calculate and output the surface area. [5]
ii) Write a program to take as input a temperature in degrees Fahrenheit. The program is
to convert and output the temperature in degrees Celsius
(Hint: DegreesC = (DegreesF – 32) * 5/9) [5]
iii) Briefly explain the following programs:
If x < 0 Then
Textbox1.Text = " Negative "
Elseif x = 0 Then
Textbox1.Text = " Zero "
Else
Textbox1.Text = “ Positive "
End If [5]
Question 13)
With aid of clear examples, demonstrate your understanding of the following string manipulation
methods and properties as used in VB:
i) Concatenation.
ii) Length Property.
iii) ToUpper.
iv) ToLower.
v) Trim. [20]
P a g e | 14
Question 14)
i) Write a program that asks the user for an integer between 1 and 5 (inclusive).
The program is to check that the input is within the range and if not, prompt the user for a valid
integer until the input is within the range. [10]
ii) Write a program to take as input two positive integers. The program is to output
integers counting from the first integer to the second integer. For example, the input
3, 7 will output: 3 4 5 6 7 [10]
Question 15) Given that a text file with several lines of text was created in a text editor (for
example Notepad).
i) Write a program to read this text file and output the contents. [7]
ii) Amend your program from (i) to output the text from the first text file to another text
file. [7]
iii) Amend your program from (i) to add another line of text to the text file (append).
[6]
E.N.D
P a g e | 15