IS122 Final Exam Paper S2 2023 Sep-19-2023
IS122 Final Exam Paper S2 2023 Sep-19-2023
IS122 Final Exam Paper S2 2023 Sep-19-2023
Final Examination
Semester 2 2023
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
Name: ________________________________
Campus: _____________________________
Hand in this examination booklet to the supervisor when you complete the test.
Page 1 of 16
Name: __________________________ ID#: ________________________
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#: ________________________
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
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
Page 3 of 16
Name: __________________________ ID#: ________________________
8. What is the value of txtMsg after the following code snippet has been executed?
a. 6.25 c. (25\4)
b. 6 d. Error Invalid Code
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
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
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#: ________________________
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#: ________________________
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)
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#: ________________________
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#: ________________________
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
Page 16 of 16