0% found this document useful (0 votes)
12 views6 pages

2020 Dev2 Test1-Memo

Uploaded by

siwesapepa02
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views6 pages

2020 Dev2 Test1-Memo

Uploaded by

siwesapepa02
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 6

WALTER SISULU UNIVERSITY

2021 NATIONAL DIPLOMA TEST


TEST 1 MEMO

SUBJECT : DEVELOPMENT SOFTWARE 2

SUBJECT CODE : DEV21P0, EDV21P0, DEV21B0, EDV21B0, DEV21Q0

QUALIFICATION : ND – INFORMATION & COMMUNICATION TECHNOLOGY

EXAMINER/S : Mr N. NGQULU, Mr A. MABOVANA & Dr O. A. OKI

MODERATOR : MR. P TAMBA-TAMBA

DURATION : 1½ HOURS (90 MINUTES)

MARKS : 40

NUMBER OF PAGES : 5 (including cover page)

INSTRUCTIONS
This is a closed book test.
No student is allowed to borrow anything from another student.
All cell phones must be switched off.
Calculators may be used but cell phones may not be used as calculators.
Answer all questions.

EXAMINATION RULES ARE NOW IN FULL FORCE AND EFFECT.


2

Part A (Multiple Choice) 15marks Each of questions 1-15 is 1 mark

1) Visual Basic is a(n) _______.


a. Procedural programming language
b. Object-oriented programming language
c. Hyperlink programming language
d. Sequential programming language

2) Which is a valid statement for declaring a variable?


a. Const Form As Integer
b. Const myForm As Integer
c. Dim Form As Integer
d. Dim myForm As Integer

3) Which of the following converts the expression to decimal data type?


a. CDbl(expression)
b. CDec(expression)
c. CInt(expression)
d. CLng(expression)

4) In Visual Basic, we work with objects that have _______.


a. Programmer preference
b. Projects, solutions, and procedures
c. Classes, actions, and disciplines
d. Properties, methods, and events

5) When you plan a Visual Basic program, you follow a three-step process that should end with
_______.
a. Setting the properties
b. Writing the Basic code
c. Coding all of the remark statements
d. Defining the user interface

6) After the steps for planning a Visual Basic project are completed, you can begin actually
constructing a program by _______.
a. Setting the properties
b. Creating the interface
c. Writing the code
d. Executing the next step based on the programmer's preference

7) Which For…Next header alters the control variable from 1 to 50 in increments of 5?


a. For I As Integer = 1 To 5 Step 50
b. For 1 To 50 Step 50
c. For I As Integer = 1 To 50 Step = 50
d. For I As Integer = 1 To 50 Step 5

8) Which of the following shows the correct order for creating a Visual Basic program?
a. Set the properties, create the interface, write the code
b. Create the interface, set the properties, write the code
c. Create the interface, write the code, set the properties
d. Write the code, set the properties, create the interface

2020 DEVELOPMENT SOFTWARE – II TEST 1 QUESTION PAPER


3

9) The Visual Studio environment contains many different windows. Which window will be
the user interface when the project is running?
a. The Toolbox
b. The Solution window
c. The Properties window
d. The Form Designer window
10) Which window do you open if you want to see all of the objects that you can add to a form?
a. The Toolbox
b. The Solution window
c. The Properties window
d. The Form Designer

11) Which of the following statements assigns the first three characters in the strName variable
to strCode?
a. strCode = strName.Assign(0, 3)
b. strCode = strName.Sub(0, 3)
c. strCode = strName.Substring(0, 3)
d. strCode = strName.Assign(3, 1)

12) The symbol ______ is not a Visual Basic operator.


a. *
b. ^
c. %
d. < >
13) The caption displayed in form1 can be changed to TEST by the following line of code:
a. form1.Title = “TEST”
b. form1.Name = “TEST”
c. form1.Text = “TEST”
d. none of the above

14) Variable declarations in event handlers begin with the keyword ______.
a. Declare
b. Dim
c. Sub
d. Integer

15) You can use the ______ instruction to terminate a running application.

a. Me.Close( )
b. Me.Displace( )
c. Me.Finish( )
d. Me.Stop( )

2020 DEVELOPMENT SOFTWARE – II TEST 1 QUESTION PAPER


4

Part B (Essay Questions)15marks.


Each of Questions 16 – 20 is 3 marks (1 mark for mentioning the correct type of error and 2 marks for
correcting the error/s).

State the type of error in the following program and then rewrite the code without any errors.

16) Private sub btnOutput_click(…)Handles btnOutput.Click


txtBox.Text = Hello
End Sub

Error type (1 mark): Syntax error


Correct code (2 marks): txtBox.Text = “Hello”

17) Private sub btnOutput_click(…)Handles btnOutput.Click


txtFirst.ForeColor = Red
End Sub

Error type (1 mark): Syntax error


Correct code (2 marks): txtFirstColor = Color.Red

18) Private sub btnCalculate_click(…)Handles btnCalculate.Click


Dim a; b As Double
lstOutput.Items.Add(5
lstOutput.Items.Add(n)
End Sub

Error type (1 mark): Syntax error


Correct code (2 marks): Dim a, b, n As Double 1 mark
lstOutput.Items.Add(5) 1 mark
lstOutput.Items.Add(n)
End Sub

19) The VB code below is expected to calculate the average of any two numbers. State the type
of error in the VB code below and correct the error if there is any

Average = num1 + num2 / 2

Error type (1 mark): Logical error


Correct code (2 marks): Average = (num1 + num2)/2

20) Suppose that the file Quiz1.txt is stored in the root folder of the D drive. A statement with
“C:\Quiz1.txt” filespec was executed and the program stop executing and produce a
message box with the title: FileNotFoundException was unhandled.
State the type of error and rewrite the command without any error.

Error type (1 mark): Run-time error


Correct code (2 marks): “D:\Quiz1.txt”

2020 DEVELOPMENT SOFTWARE – II TEST 1 QUESTION PAPER


5

Part C (Essay Questions) 10 marks


Each of Questions 21 – 25 is 2 marks

What will be displayed in the message box when the following VB code is executed?

21) Dim x As Integer


x=4
Select Case x / 2
Case 1
MsgBox("One")
Case 2 To 3
MsgBox("More than two")
Case 2
MsgBox("Two")
Case Else
MsgBox("Invalid number")
End Select

More than two (2 marks)

22) Dim m As Integer = 60


Dim g As String
If m >= 90 Then
g = "A"
Else
If m >= 80 Then
g = "B"
Else
If m > 60 Then
g = "C"
Else
g = "D"
End If
End If
End If
g = "Grade " & g
MsgBox(g)

Grade D (2 marks)

23) Dim i As Integer


For i = 1 To 10 Step 2
lstTest.Items.Add(i)
i=i+2
Next
1
5
9

2020 DEVELOPMENT SOFTWARE – II TEST 1 QUESTION PAPER


6

24) Dim n As Integer = 7


n += 3
n=2*n
lstTest.Items.Add(n)

20

25) Dim num As Integer


num = 5
For i As Integer = num To (num * 2 - (num - 1))
lstTest.Items.Add(i)
Next

5
6

2020 DEVELOPMENT SOFTWARE – II TEST 1 QUESTION PAPER

You might also like