Visual Programming - Prog2104c PDF

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

BSc (Hons) Computer Science with Network

Security
Cohort: BCNS/18A/FT

Examinations for 2019 / Semester 1

Resit Examinations for BCNS/15B/FT,


BCNS/16A/FT & BCNS/16B/FT

MODULE: Visual Programming

MODULE CODE: PROG 2104C

Duration: 3 Hours

Instructions to Candidates:

1. This question paper consists of two sections: Section A and Section B.


2. Section A is compulsory.
3. Answer ANY TWO questions from Section B.
4. Questions may be answered in any order but question number should be
clearly specified on the answer sheet.
5. Always start a new question on a fresh page
6. Total marks 100.

This Examination paper contains 4 questions and 9 pages.

Page 1 of 9
Visual Programming (PROG2104C) SITE/June 2019 Sem 1
SECTION A (Compulsory)

QUESTION 1: (40 MARKS)


a) With reference to user interface design what do you understand by the term
“Control”? Give two examples of controls you know. List two properties and
two methods for the two controls.
(8 marks)

b) VB.Net is said to be a modern “Object Oriented Programming Language”.


Give five reasons why VB.Net is so popular as a programming language.
(5 marks)

c) The Norman’s design guideline applied to user interface design of computer


applications consist of six principles. With the help of examples, and using
diagrams where necessary, write short notes on any two Norman’s design
principles.
(12 marks)

d) Name any three programming languages you know under the .Net
Framework.
(3 marks)

e) The .Net Framework consists of several components. Name and briefly


describe any three main components supporting your answer with an
appropriate diagram.
(9 + 3 marks)

Page 2 of 9
Visual Programming (PROG2104C) SITE/June 2019 Sem 1
SECTION B
(Answer any two questions)

QUESTION 2: (30 MARKS)


a) Cobalt 60, a radioactive element used in cancer therapy, decays over a period of
time. Each year 12% of the amount present at the beginning of the year will be
decayed. If a container of Cobalt 60 initially contains 15 gms, write a VB.NET
program to determine the amount of this element remaining after 8 years.
Assume that you input amount and years in textboxes txtAmount and txtYear
respectively. Write a VB.NET program to display your result in a list box lstDecay
as shown below. You should format your output with appropriate zones.

(10 marks)

Fig 2.1

b) You are given the following listbox as shown below. Write codes to
implement the four buttons: Add Item, Delete Item, Clear, and Item Count.

(3 + 2 + 2 + 2 + 2 marks)

Page 3 of 9
Visual Programming (PROG2104C) SITE/June 2019 Sem 1
Fig 2.2

Fig 2.3

Page 4 of 9
Visual Programming (PROG2104C) SITE/June 2019 Sem 1
c) Identify the four different types of Windows menus shown in the screenshots
below.

(4 marks)
Fig 2.4

d) Fill in the blank in the following VB.Net code.


Line 1 Private Sub btnFunc_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnFunc.Click
Line 2 Dim top As Integer = Integer.Parse(txtTop.Text)
Line 3 Dim left As Integer = Integer.Parse(txtLeft.Text)
Line 4 Dim width As Integer = Integer.Parse(txtWidth.Text)
Line 5 Dim height As Integer = Integer.Parse(txtHeight.Text)

Line 6 Dim bm As New __________(width, _________)

Line 7 Using gr As _________ = Graphics.FromImage(bm)

Line 8 Dim src_rect As New Rectangle(left, top, width, height)


Line 9 Dim dst_rect As New Rectangle(0, 0, width, height)

Line 10 gr.DrawImage(picOriginal.Image, dst_rect, ___________,


GraphicsUnit.Pixel)
Line 11 End Using

Line 12 picResult.Image = __________


Line 13 End Sub (5 marks)

Page 5 of 9
Visual Programming (PROG2104C) SITE/June 2019 Sem 1
Question 3 (30 Marks)
Fig 3 shows some screenshots of a small application to display the details of some
birds on sale. It consists of the ID (integer), Bird (String), Gender (String), Age
(Number) and the Price (Integer). All the details are stored in a table named ‘tblBird’
in an MS Access database named ‘Ajit_Bird.mdb’. Once the ‘Display in textbox’
button is pressed, the first record is displayed in the textboxes. Navigation buttons
are also provided to browse through the different records.

Fig 3 (a) (i)

(a) Write VB.Net codes:


(i) to declare all necessary global variables for all procedures.
(2 marks)
(ii) to connect to the database, test for its connection and get the total number of
records in the table named ‘tblBird’ using the FormLoad() event.
(15 marks)

Page 6 of 9
Visual Programming (PROG2104C) SITE/June 2019 Sem 1
(iii) to display the data (first record) in the text boxes using the button ‘Display in
textboxes’ which calls a dedicated procedure named ‘display_record ()’
to exclusively display the data.
(4 marks)
(iv) to display all the records at one go in the datagrid (dgBird).
(3 marks)

Fig 3 (a) (ii)

Page 7 of 9
Visual Programming (PROG2104C) SITE/June 2019 Sem 1
Fig 3 (a) (iii)

(b) Write VB.Net codes to implement the ‘First’ and the ‘Next’ buttons. Your codes
should call the ‘display_record ()’.
(4 + 2 marks)

Question 4 (30 Marks)

Fig 4 shows some screenshots of a small application to display the details of some
birds on sale. It consists of the ID (integer), Bird (String), Gender (String), Age
(Number) and the Price (Integer). All the details are stored in an external plain text
file (Notepad File) named ‘myBird.txt’. Once the ‘Display records in Listbox’ button
is pressed, all the records are displayed in the Listbox named ‘lstAllRecords’. When
the ‘Classify by Gender’ button is pressed the records are displayed in different list
boxes based on their ‘Gender’.

Write VB.Net codes for these buttons:


(a) ‘Display records in Listbox’ (14 marks)
(b) ‘Classify by ‘Gender’. (16 marks)

Page 8 of 9
Visual Programming (PROG2104C) SITE/June 2019 Sem 1
Fig 4.1

Fig 4.2

***END OF QUESTION PAPER***

Page 9 of 9
Visual Programming (PROG2104C) SITE/June 2019 Sem 1

You might also like