IS122 Final Exam Paper S2 2023 Sep-19-2023

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

Name: __________________________ ID#: ________________________

IS122: Application Programming

School of Information Technology, Engineering, Mathematics, and Physics

Final Examination

Semester 2 2023

F2F and Online Mode

Duration of Exam: 3 hours + 10 minutes

Reading Time: 10 minutes

Writing Time: 3 hours

Instructions:

There are 4 sections in this paper. All sections and questions are compulsory.

All answers are to be written directly on the Question paper in the spaces provided

The test is worth 100 marks and contributes 50% towards the final grade. The

minimum passing mark is 40/100.

Number of pages -16

This is a closed-book exam

You may use your calculator in this exam

Name: ________________________________

Student ID: ____________________________

Campus: _____________________________

Mode: ☐ F2F ☐ Online

Hand in this examination booklet to the supervisor when you complete the test.

Page 1 of 16
Name: __________________________ ID#: ________________________

Section A: Multiple Choice Answering Grid


Use the grid below to answer multiple choice questions. Circle the correct answer for each
question.

1 A B C D

2 A B C D

3 A B C D

4 A B C D

5 A B C D

6 A B C D

7 A B C D

8 A B C D
9 A B C D
10 A B C D
11 A B C D
12 A B C D
13 A B C D
14 A B C D
15 A B C D
16 A B C D
17 A B C D
18 A B C D
19 A B C D
20 A B C D

Page 2 of 16
Name: __________________________ ID#: ________________________

Section A: Multiple Choice Questions (20 marks)


Each question is worth 1 mark. Circle the correct answers in the table provided on Page 2.
This section has 20 questions where there is only one answer per question.
1. The prefix used for a button object is ________ .
a. button c. but
b. bnt d. btn

2. Microsoft’s Visual Basic language was launched in ________.


a. 1980s. c. 1960s.
b. 1990s. d. 1970s.

3. The ______ contains the GUI objects that can be used when designing a graphical user
interface in Visual Basic.
a. Toolbar c. Task bar
b. Toolbox d. Properties window

4. A(n)_______allows users to select a single input as the answer to the question.


a. Radio button c. textbox
b. checkbox d. menu

5. Study the following lines of Code.

Dim RandomSeed As New System.Random()

Dim intRandomValue as Integer

intRandomValue= ?

Which of the following lines can be used to generate random integer between 50 and 100
and assign it the variable intRandomValue?
a. intRandomValue = RandomSeed.Next(49,99)
b. intRandomValue = RandomSeed.Next(51,101)
c. intRandomValue = RandomSeed.Next(50,100)
d. intRandomValue = RandomSeed.Next(100,50)

6. The _________ function can be used to test if data entered by the user is numeric.
a. IsInteger c. IsNumeric
b. IsNumber d. IsNonAlpha

7. IDE Stands for _____________________________.


a. Integrated Design Environment
b. Integrated Development Environment
c. Intelligent Definition Environment
d. Intelligent Development Environment

Page 3 of 16
Name: __________________________ ID#: ________________________

8. What is the value of txtMsg after the following code snippet has been executed?

txtMsg.Text = (25 / 4).toString()

a. 6.25 c. (25\4)
b. 6 d. Error Invalid Code

9. The argument in the argumentlist are separated by


a. period c. colon
b. comma d. semi-colon

10. A ______ -controlled loop tests the condition after the loop body has been executed.
a. top c. function
b. bottom d. key

11. The _____ method reads a line from a sequential access file
a. ReadALL c. Read
b. ReadLine d. ReadToNewline

12. A CheckBox’s checked property is true when a checkbox is selected and is false when it
is deselected. Which of the following pieces of code correctly displays imgSun when
chksun is selected and hides imgSun when chksun is unselected.

a. imgSun.Visible = True
b. imgSun.Visible = False
c. imgSun.Visible = chksun.Checked
d. imgSun.Show = chksun.Checked

13. Which of the following is a process-oriented programming language?


a. c c. c#
b. c++ d. Visual Basic

14. Which statement checks whether the value of intNum is between 0 and 50 (both inclusive)?
a. If intNum >= 0 OR intNum <= 50 Then
b. If intNum > 0 OR intNum < 50 Then
c. If intNum >= 0 AND intNum <= 50 Then
d. If intNum > 0 AND intNum < 50 Then

Page 4 of 16
Name: __________________________ ID#: ________________________

15. Which of the following clauses stops the loop when the value of intAge variable is less than
the number 0?
a. Do While intAge >= 0
b. Do Until intAge <= 0
c. Loop While intAge > 0
d. All of the above

16. Which of the following is the correct way of naming a Label with the name Majors

a. lblMajors
b. lbMajors
c. txtMajors
d. Majors
17. The extension of the executable file is __________
a. .exe
b. .vb
c. .cs
d. .vex

18. The prefix used for a textbox object is_________


a. text
b. txt
c. ttx
d. textb

19. Which of the following is the Visual Basic code to Exit the program
a. Me.Shutdown
b. Close
c. Me.Close()
d. Exit()

20. A hair styling salon needs help designing a form for the various services that they offer.
What would you suggest they use that will display all of the services, and will allow
customers to choose one or more items?

a. Check boxes
b. Radio buttons
c. Option Boxes
d. Labels

End of Section A

Page 5 of 16
Name: __________________________ ID#: ________________________

Section B: Short Answers (28 marks)


This section has eight questions. All are compulsory
1. Development Cycle. (6 marks)
One of the critical fundamentals that an application designer must exhibit is their ability to
use the Program Development Life Cycle. Identify and explain the missing phases in the
diagram.

Figure 1 Development Cycle

a) Phase A: ________________________________________________________ (1 mark)


Description: (2 marks)

b) Phase B: ________________________________________________________ (1 mark)


Description: (2 marks)

Page 6 of 16
Name: __________________________ ID#: ________________________

2. Differentiate between a variable and a constant. When would you use a constant? Use an
example to justify your answer. (4 marks)

3. Describe the term ‘application programming’ in your own words. How do programmers
play a role in it? (3 marks)

4. What is the definition of an array? Briefly describe a major limitation of using arrays, use
examples to discuss. (3 marks)

5. Why do programmers create and use functions? Give two reasons. (2 marks)

6. In the context of variable scope, what are two reasons for avoiding global variables within
your program? (2 marks)

Page 7 of 16
Name: __________________________ ID#: ________________________

7. Differentiate between the pre-test loop and the post-test loop? Give an example of each
type of loop. (4 marks)

8. Assume that a and b are Integer arrays and that i, j, and k are Integer variables. (Assume
the arrays are declared of an appropriate size)
a. Write the statement that adds 6 to element k of a. (1 mark)

b. Write the statement that copies element i of b to element k+1 of b. (1.5 marks)

c. Write the statement that sums elements i and k of a and places the results in element
j+5 of b. (1.5 marks)

End of Section B

Page 8 of 16
Name: __________________________ ID#: ________________________

Section C: User Interface Design (22 marks)


This section has two questions. All are compulsory
1. Pacific Hotels Ltd, a small hotel in Suva, has requested you to develop a Sales
application which helps the receptionist generate a quote for a hotel room sale for a one
night stay in the hotel. The hotel has 3 types of rooms only and provides buffet breakfast
and dinner for a fee. Apart from Internet, Entertainment and Spa services, all other hotel
amenities are free of charge.
The cost of staying in the hotel for a night is dependent on the following factors:

i. Room Type (either Luxury, Superior or Standard)


ii. Meal options iii. Amenities
a. Breakfast a. Internet
b. Dinner b. Entertainment
c. Spa Services

Your application should also display an image for each room type selected respectively and
display the final cost in a label in the form of a quotation.

Design an appropriate User Interface for this application. (Note: Code is not required)
(10 marks)

Page 9 of 16
Name: __________________________ ID#: ________________________

2. Figure 2 below shows a possible user interface for the weather reporter program.
a) Name the controls and name properties indicated by labels a) to h) in Figure 2. (use
the spaces provided in Figure 2) (8 marks)

Figure 2 Weather Reporter Interface

b) What is the difference between the controls labelled as h) and f). Can the two controls
be used interchangeably? (4 marks)

End of Section C

Page 10 of 16
Name: __________________________ ID#: ________________________

Section D: Coding (30 marks)


This section has three questions. All are compulsory
1. Write Visual Basic code that will use a loop to calculate the sum of all integer
numbers between 5 and 100 that are divisible by both 5 and 6. You may choose
to use any looping structure. Use the following variable declarations. (5 marks)

2. You need to write an application that allows a small company ABC based in Suva
to display a shipping destination that is based on the number of items a customer
orders. The order amounts and shipping destinations are listed in the following table.

Suppose in your application you have stored the minimum orders and maximum
orders in a four-element, one-dimensional Integer array named MinOrdered,
MaxOrdered respectively and shipping destinations in another four-element one
dimensional String array named Shipping. The declarations of these arrays are as
follows:

Page 11 of 16
Name: __________________________ ID#: ________________________

Suppose the customer makes orders within the range 1-500 in the text box called
txtOrdered, implement the code under the click event handler of the Display button
that will display the correct shipping destinations in a label named lblShipping;
using the above arrays. Implement your answer using a For Next loop to go
through the arrays. (Assume the number of orders entered is valid. Declare any
other variable necessary).

(10 marks)

Page 12 of 16
Name: __________________________ ID#: ________________________

3. You are to write an enhanced greetings program with the following


specifications:
Read in data from a data file to load up a list box and an array of structure.
Input File:
The file called “Greetings.txt” contains names, matching greetings and country
capital. Given below are the contents of the file. There are only 5 records.

Refer to the figure 3 below to visualize the interface design.

Figure 3 Pacific Greetings Interface

When the user clicks on an item in the list box (country name) called lstCountries,
the corresponding greeting is accessed (from a structure array)to update the label
called lblGreetings on the form.
i. Write a structure statement that defines a structure named Greeting.The
structure should contain three-member variables: strCountry, strGreetings,
and strCapital. (5 marks)

Page 13 of 16
Name: __________________________ ID#: ________________________

ii. We’ll store the information from Greetings.txt file in a Greeting variable array
called greetingList. Write a declaration of the greetingList array. What scope
would you give to this array? (2.5 marks)

iii. The next thing to do is to write the complete Form Load event handler that
opens the Greetings.txt file, reads the file contents one by one, populates the
structure array with the country name, greeting and capital; and then loads
the list box with the country name.
To help you out your friend has written the following code for the Form
Load event handler.

However, you have found that though the code above is all that the Form
Load event handler should do; the statements are not written in the correct
order.
Rearrange your friend’s code in correct logical order. (Indicate the order
by writing the line #. You do not have to write the code statements)
(7.5 marks)

Page 14 of 16
Name: __________________________ ID#: ________________________

THE END

Page 15 of 16
Name: __________________________ ID#: ________________________

Extra Sheet

This page is intentionally left Blank

Page 16 of 16

You might also like