0% found this document useful (0 votes)
72 views15 pages

2021 CMIS216 VB - Net Assignments

This document contains instructions for computer programming assignments in VB.NET for a Diploma in Management Information Systems course. It provides details on submitting assignments such as emailing files to a provided email address and includes notes to submit project files. The document outlines 15 sample questions that could be chosen for Assignment 1 covering topics like object-oriented programming, .NET languages, comments, errors, and programming elements. It also provides 12 sample questions for Assignment 2 involving conditional statements, data types, controls, functions, and arrays. Students are instructed to include code snippets in their answers and submit assignments by the provided due dates with penalties for late submissions.
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)
72 views15 pages

2021 CMIS216 VB - Net Assignments

This document contains instructions for computer programming assignments in VB.NET for a Diploma in Management Information Systems course. It provides details on submitting assignments such as emailing files to a provided email address and includes notes to submit project files. The document outlines 15 sample questions that could be chosen for Assignment 1 covering topics like object-oriented programming, .NET languages, comments, errors, and programming elements. It also provides 12 sample questions for Assignment 2 involving conditional statements, data types, controls, functions, and arrays. Students are instructed to include code snippets in their answers and submit assignments by the provided due dates with penalties for late submissions.
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/ 15

Trust Academy

In Collaboration with

Midlands State University

Diploma in Management Information Systems

CMIS 216: COMPUTER PROGRAMMING (VB.NET) ASSIGNMENTS

Email to: [email protected]

Or inbox: 0775 506 850

NOTE: SUBMIT THE PROJECT FILES AS WELL

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

Email to: [email protected]

Or inbox: 0775 506 850

ASSIGNMENT:

COMMENTS:
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________

NOTE: SUBMIT THE PROJECT FILES AS WELL

Page |2
ASSIGNMENT 1 DUE: 19/02/2021
Your answers should always be accompanied by Code Snippets and Syntaxes for
programs.

NOTE: SUBMIT THE PROJECT FILES AS WELL


Choose 4 Questions

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]

NOTE: SUBMIT THE PROJECT FILES AS WELL

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

NOTE: SUBMIT THE PROJECT FILES AS WELL


Answer 1 – 4 and Choose Two from 5 to 12

Question 1) Give code snippets showing examples of :


i) Conditional Operators
ii) If Statements
iii) Select Case Statements [10]
Question 2) List types of errors and how does .NET’s Integrated Development Environment
(IDE) help you to find them? [10]
Question 3)
a) Differentiate between a message box and an input box. [10]
b) Explain the select case statement, show syntax and an example. [10]
Question 4)
i. With the aid of an example, briefly explain type casting [3]
ii. What is an Integrated Development Environment (IDE)? [2]
iii. Discus the following components of IDE
a) Project Window
b) Property window
c) Menu window
d) Form Window
e) Code Editor Window [5]

Page |6
Choose Two Questions
Question 5)
a) Briefly explain this program using comments for each line. [10]

Private Sub Button1_Click ( ByVal sender As system.Object, ByVal e As_


system.EventArgs)_Handles_Button1.Click

IF Textbox1.text = “” AND Textbox2.Text = “” Then


Msgbox(“Please fill in the blanks”)
Exit Sub
End IF
IF Textbox1.text = “Student” AND Textbox2.Text = “12345” Then
Me.Hide()
Main.Show()
Else
MsgBox(“username or password wrong try to get the correct one”)
End IF

End Sub

‘This for exit buttons


Private Sub Button2_Click (ByVal sender As system.Object, ByVal e As_
system.EventArgs)_Handles_Button2.Click

End

End sub

b) Briefly explain the following VB.Net Program:

Dim sngPurchasePrice As Single

sngPurchasePrice = 150.95

If (sngPurchasePrice < 1000 ) Then


MsgBox (“ Less Than 1000”)
ElseIf (sngPurchasePrice < 500 ) Then
MsgBox (“ Less than 500”)
ElseIf (sngPurchasePrice < 100 ) Then
MsgBox (“ Less than 100”)
Else MsgBox (“ Other Value”)
End If
End Sub

[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:

Dim Guess, SecretNumber, NumberOfGuesses As Integer


Dim Number As New Random

SecretNumber = Number.Next(1, 10)


Guess = InputBox("What is your guess? ")
NumberOfGuesses = 1
While Guess <> SecretNumber And NumberOfGuesses < 10
If Guess > SecretNumber Then
TextBox1.Text = "Input a smaller number: "
End If
If Guess < SecretNumber Then
TextBox1.Text = "Input a larger number: "
End If
Guess = InputBox("What is your guess? ")
NumberOfGuesses = NumberOfGuesses + 1
End While
If Guess = SecretNumber Then
MessageBox.Show(" Well done. It took you " & NumberOfGuesses & " guesses.")
Else
MessageBox.Show(" You did not guess the number. It was " & SecretNumber)
End If
[8]
b) Write a program that outputs the difference between the amounts of your income versus
the amount your expenses, as well as printing a message that indicates whether you are
spending more than you are making.
Use textboxes for input and a MsgBox for output [8]

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?

Private Sub btnDisplay_Click(…) Handles btnDisplay.Click


Dim amt1 As Integer = 1, amt2 As Integer = 2
lstOutput.Items.Add(amt1 & “ ” & amt2)
Swap(amt1, amt2)
lstOutput.Items.Add(amt1 & “ ” & amt2)
End Sub

Sub Swap(ByRef num1 As Integer, ByVal num2 As Integer)


Dim temp As Integer
temp = num1
num1 = num2
num2 = temp
lstOutput.Items.Add(num1 & “ ” & num2)
num2 = 3
End Sub [4]

Page |9
a) What is the output of the following program when the button is clicked?

Private Sub btnDisplay_Click(...) Handels btnDisplay.Click

Dim word1, word2, newWord As String


word1 = “memory”
word2 = “feather”
newWord = word1.Substring(2,2) & word2.Substring(3,4)
If newWord.Length > 3 Then
txtBox.Text = newWord
Else
txtBox.Text = “Sorry, not found.”
End If

End Sub [4]

d) Simplify the following code:

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]

NOTE: SUBMIT THE PROJECT FILES AS WELL

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

Answer question 1 to 2 and Choose 4 from the remaining questions

NOTE: SUBMIT THE PROJECT FILES AS WELL


Question 1)
a) With the aid of clearly explained examples, distinguish between the two ways of
calling a function procedure in VB. [4]
b) Explain the difference between event driven and procedural programming paradigms.
[4]
c) Write the advantages of using iterative structures in programming. [7]
d) What is the difference between a variable that has local scope and one that has a global
scope? [2]
e) Write the code for setting the Text property of a control named txtnumber to an empty
string. [2]
f) Explain how you can create an executable program in Visual Basic. [5]
Question 2)
a) Create a Student table using Microsoft Access that will contain the following fields:
Student No, Student Name, Student Surname, Student Date of birth, Address.
b) Add 5 valid customer details in Microsoft Access.

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]

Question 9) Write a program that simulates a times table program. [20]


Question 10)
a) With the aid of an example, clearly explain what a ReDim keyword is and its use. [4]
b) What is a jagged array? [2]
c) Give any two operators that can be used for string concatenation in VB [2]
d) Clearly describe the following access modifiers:
i) Friend
ii) Public
iii) Protected
iv) Private [4 x 3]
Question 11)
Synteck (Pvt) Ltd. Employs salespeople. The manager wants him to enter a bonus rate. The
application should use rate and an amount for an employee to calculate the salesperson’s bonus
amount. It should calculate the bonus paid to the salesperson. The application should display
salesperson number and bonus amount as well as the total bonus paid in the interface. Design the
application for Synteck (Pvt) Ltd. [15]
Name the data structure to use in order to incorporate the a company of 8 employees.

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]

Select Case Grade


Case "A"
Textbox1.Text = “Top Grade"
Case "F” , "U"
Textbox1.Text = "Fail"
Case “B” To "E"
Textbox1.Text = "Pass”
Case Else
Textbox1.Text = “Invalid Grade”
End Select
[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]

NOTE: SUBMIT THE PROJECT FILES AS WELL

E.N.D

P a g e | 15

You might also like