WorksheetsQuiz 2 Sept 2021 FBT0025 Visual Programming
Total questions: 30
Worksheet time: 1hrs 1mins
A variable declared inside an event procedure is said to have local scope
True
False
The value returned by InputBox is a string
True
False
Option Explicit requires you to declare every variable before its use
True
False
What is the correct statement when declaring and assigning the value of 100 to an Integer variable called numPeople
Dim numPeople =
Dim numPeople = Int(100)
numPeople = 100
Dim numPeople As Integer = 100
Which of the following arithmetic operations has the highest level of precedence ?
+ –
* /
^ exponentiation
( )
What value will be assigned to the numeric variable x when the following statement is executed ? x = 2 + 3 * 4
20
14
92
234
Which of the following is a valid name for a variable ?
Two_One
2One
Two One
Two.One
What is the proper syntax when using a message dialog box ?
MessageBox.Show(“Hi there”, “Hi”)
MessageBox.Show(Hi there, Hi)
MessageBox.Show “Hi There”, “Hi”
MessageBox.Show Hi There, Hi
Which of the following is a valid Visual Basic conditional statement ?
2 < n < 5
2 < n Or < 5
2 < n Or 5
(2 < n) Or (n < 5)
The three main logical operators are ________, _________, and ________.
And, Or, Not
And, Not, If
Or, Not, If
False, And, True
Suppose a variable is passed by value to a parameter of a Sub procedure, and the parameter has its value changed inside the Sub procedure. What will the value of the variable be after the Sub procedure has executed ?
It will have the newly modified value from inside the Sub procedure
Its value cannot be determined without more information
It will retain the value it had before the call to the Sub procedure
None of the above
Suppose the variable myName is declared in a Dim statement in two different Sub procedures. Which statement is true ?
The program will malfunction when it is executed
When the value of myName is changed in one Sub procedure, it will also be changed in the other Sub procedure
Visual Basic’s smart editor will alert you that this is an error before the program is executed
The two variables will be local to their respective Sub procedures
The Properties window plays an important role in the development of Visual Basic applications. It is mainly used
To change how objects look and feel
When opening programs stored on a hard drive
To allow the developer to graphically design program components
To set program related options like Program Name, Program Location, etc
Which of the properties in a control’s list of properties is used to give the control a meaningful name ?
Text
ContextMenu
ControlName
Name
A tool is selected by double clicking it or drag it onto the form.
True
False
Different version of VB.NET may have different set of tools.
True
False
Forms and controls are objects which produces/responds to events.
True
False
What is the prefixes for control names below :
Radio Button
(a)
What is the constant value for button in the MessageBoxStyle : vbYesNoCancel ? It able to display Yes, No and Cancel buttons.
1
2
3
4
A variable is a storage location in the computer's memory, used for holding permanently while the program is running.
True
False
Which of the following are not the data type of integer ?
Long
Integer
Decimal
Byte
lblDate.Text = "Today is " & Date.TimeOfDay
The statement above is to retrieving the current date and time. Which one is the keyword yield the current time only ?
Today is
TimeOfDay
lblDate
&
(a) variables are declared in general declarations area (before any code is entered) with Dim statement. It can be recognized by all the procedures in the class
Which of the following is a false statement for constants variable ?
Any changes after the calculation will effect the data inside constant
Name all constant for your program in one location
To change the value of a constant, we need to change where we declare it
Use of constant will ease every programmer in reading the code
An if statement is considered as a relational operators where its condition will return true result only.
False
True
OrElse operator is more efficient than Or because
OrElse stops evaluating and turn the entire expressions to TRUE when the first TRUE expression is found, but Or evaluates all
OrElse stops evaluating and turn the entire expressions to TRUE when the first FALSE expression is found, but Or evaluates all
Module decisions
Sub Main()
Dim a As Integer = 100
If (a < 20) Then
Console.WriteLine("a is less than 50")
Else
Console.WriteLine("a is not less than 80")
End If
Console.WriteLine("value of a is : {0}", a)
Console.ReadLine()
End Sub
End Module
a is not less than 80
value of a is : 100
a is less than 80
value of a is : 100
a is not less than 50
value of a is : 100
a is less than 50
value of a is : 100
What is the answer if A = 1 OR B = 0 ?
(a)
How to close a CASE statements ?
Select Case
Select End
Endif
End Select
Can be used to compare numerical data and string data.
Logical Operators
Relational Operators
