Visual Basic .Net True / False Dr. Ebrahimi
Name__________________________________
T 1) A systematic way or step by step procedure to solve a problem is known as an algorithm.
T 2) A program is a set of instructions that tell a computer what to do.
T 3) Every character has its own ASCII code, such as 65 for uppercase A and 97 for lowercase a.
F 4) Computer languages are ambiguous and natural languages are not ambiguous.
F 5) Visual Basic.net was developed before Visual Basic and Basic.
F 6) The input shown on the screen can be printed using the print command.
F 7) Every problem has only one algorithm to solve it.
T 8) Human intervention is required to review logical statements, because the compiler will not catch logical errors.
T 9) In order to get an output from a program you must edit, compile, and execute the program.
F 10) Dim fin As IO.StreamReader = IO.File.OpenText("*.txt") will read the data from all text files in your program's bin folder.
T 11) You can still execute a program even if there is a warning.
F 12) In Visual Basic .Net, an “ If …Then…Else” statement is used to create a loop.
F 13) The symbol # is used to comment a line of text in vb.
F 14) Basic, Visual Basic, C, C++, Visual Basic .Net, Java, and C# are all visual programming languages.
T 15) The binary state of a computer is represented as 0 and 1 at the lowest level.
T 16) With the symbol ‘ you can create a single line of comment.
F 17) Basic is better than Visual Basic and Visual Basic.net because it is simple object oriented.
T 18) Visual basic.net is an object oriented programming language.
F 19) Visual Basic was developed before Basic and Visual Basic.net.
F 20) Visual Basic and Visual Basic.net are user Friendly and were designed for teaching purposes only.
T 21) A Visual Basic program uses the extension .vb.
F 22) The ToolBox is usable when editing your code in the form view and design view.
T 23) Basic was line oriented therefore to execute multiple statements you must use goto.
F 24) Basic was designed by two professors John Kennedy and Thomas Krutz from Dartmouth College.
F 25) HoursWorked=Msgbox(“Enter the Employee Id”) is a logically correct statement
T 26) One way to make a decision in a program is to use an If statement.
F 27) To find the maximum of two numbers, the following If statement can be used:
If a = b Then
max = a
Else
max = b
End If
T 28) The following will set a different tax rate depending on the gross pay:
If grosspay > 500 Then
taxrate = 0.20
Else
taxrate = 0.05
End If
F 29) Overtime pay can be computed using the following:
If hoursworked > 40 Then
overtimehours = hoursworked - 40
Else
overtimehours = 0
grosspay = hoursworked * hourlyrate + overtimehours
T 30) This validation can be used to make sure gross pay is a positive value:
If grosspay > 0 Then
MsgBox(grosspay)
Else
MsgBox(“Error in gross pay”)
End If
T 32) Every Else in a program must correspond to an If statement.
F 33) Both a and b need to be True for “Hello” to be displayed:
If a Or b Then MsgBox(“Hello”)
F 34) The following statement is always True: True And False.
T 35) There is a logical error in the following:
If number > max Then
max = number
Else min = number
T 36) User interaction, comparison with stored data, and response are components of a search program.
T 37) The following statement is logically correct:
If hoursworked > 40 Then
overtimehours = hoursworked – 40
Else
overtimehours = 0
End if
T 38) The following statement can be used to verify that a number has been entered for hours worked before using it to compute gross pay:
If TextBox1.Text = “” Then
Msgbox(“ENTER A VALUE FOR HOURS WORKED”)
TextBox1.SetFocus
Else
TextBox3.Text = TextBox1.Text * TextBox2.Text
End If
F 39) Net pay is needed in order to calculate the tax amount.
F 40) CheckBox can be used when only one entry can be selected, for example, marital status or credit card.
F 41) When you have to choose two or more options among many, you have to use RadioButtons. For examples, health insurance likes full coverage, dental etc.
F 42) The following statements will assign an employee with a gross pay of 0 a tax rate of 20%:
If grosspay > 500 Then
taxrate = 0.20
ElseIf grosspay > 300 Then
taxrate = 0.15
Else
taxrate = 0.10
End If
T 43) The keyword And represents a logical operator that can be used in a condition for an If statement.
F 44) The keyword Or represents a logical operator that when used in a condition, the condition will be True only when both expressions are True.
T 45) In a sequential file system, often a large portion of the file must be read in order to find one specific item.
T 46) While counter is the same as While counter > 0.
T 47) In order to work with a file in your program you must open and indicate what you want to do with the file.
F 48) To sum a series of numbers you need to initialize the sum = 1.
T 49) The following loop will read all employeeid from a file one by one.
While myfile.Peek <> -1
employeeid = myfile.ReadLine
End While
F 50) The following loop will compute the gross pay for 20 employees:
For i = 0 To 20
grosspay= InputBox(“Enter hours worked: “)
Next
F 51) The values 5 and 6 will be displayed:
Dim x As Integer
x = 5
x = 6
MsgBox(x)
MsgBox(x)
T 52) In Visual Basic, the expression 2 < 3 always evaluates to true, and 0 is always false.
T 53) The statement While 1 … End While in a program will loop forever.
T 54) Reserved words While, For, and Do While can be used to loop.
T 55) The Not operator means negation.
T 56) The assignment statement c = c + 1 is same as c += 1.
F 57) To loop five times we need: Dim counter As Integer While counter >5 counter = counter + 1
End While.
F 58) When using end of file it is necessary to stop the loop by a counter variable in a loop
condition.
F 59) To loop a program 5 times, you must write the program 5 times.
F 60) To run a program with a large amount of data it is better to enter the data each time
interactively.
F 61) Every time you recompile a program you must also recompile its data file.
F 62) If there are no errors detected by the compiler, the program output is correct.
F 63) The
declaration: "Dim employeeid Integer" is correct.
T 64) A dummy value that is used to stop a loop is known as a sentinel.
T 68) In writing a program you can have a loop within a loop.
T 69) BASIC means Beginners‘ All-purpose Symbolic Instruction Code.
T 70) Visual Basic is a high level programming language evolved from the earlier DOS version called BASIC.
T 71) By visualization, it means that Visual Basic uses toolboxes.
F 72) The following statement adds the two values in the textboxes:
TextBox3.Text = TextBox2.Text + TextBox1.Text
F 73) The following is a valid Visual Basic statement:
Dim tax rate As Single
Tax rate = TextBox1.Text
T 74) If you don’t change the name for the toolbox controls all the name are defaulted with a number starting from 1.
T 75) When you start the VB environment, you are in the design mode rather than run mode.
T 76) You can change the name of a control in the Text property.
T 77) It is a Visual Basic convention to name a control with a shorthand prefix such as txthoursworked, lblhoursworked, btncomputenetpay.
F 78) The following statement is logically correct:
If hour>40 Then
Overtimehour = hour – 40
Else
Overtimehour = 10
End if
T 79) The following statement doesn’t compute grosspay when there is a blank in the textbox:
If textbox1.text = “” then
Msgbox(“ENTER A VALUE”)
Textbox1.setfocus
Else
Textbox3.text = textbox1.text*textbox2.text
T 80) Every control can be programmed. For example a TextBox can be programmed.
F 81) TextBox1.TextChanged will activate when you click the command button.
T 82) By using buttons or textboxes with the labels you can design interfaces such as telephone or calculators.
F 83) You can’t use code to change properties of any controls, for example
Textbox .text .visible = true, or text1.forecolor = color.green
F 84) Visual basic is not an event-driven programming language, it is a procedural language. For example, each control such as botton 1_ click() or botton2_doubleclick()
F 85) Text box can only be used for output.
F 86) It is not possible to compute the gross pay by simply re-entering the hourly rate.
F 87) In order to calculate overtime we need to know hourly rate in the textbox2
T 88) it is a good style to choose proper size for person name, hours works, and hourly rate in the labels and text boxes
F 89) Check box can be used when there is only one entry the needs to be selected, for example, marital status or credit cards.
F 90) When you have to choose two or more options among many, you have to use radio buttons. For examples, health insurance likes full coverage, dental etc.
F 91) Radio buttons must be grouped in a frame
F 92) the following are nested if statement:
If grosspay>500 then taxrate=0.20
If grosspay >300 then taxrate=0.15
if grosspay<=300 then taxrate=.10
T 93) the following if statement has the same taxrate as above
If grosspay>500 then
Taxrate=0.20
Elseif grosspay>300 then
taxrate=0.15
else
taxrate=0.10
end if
TF 94) the following statement will clear and end the program
textbox1.text=”“
End
End sub
T 95) dim is stand for dimension and it is used declare variables of integer, single, double, string. For example
F 96) the following statement indicates the variable netpay is a whole number instead of fraction
Dimension netpay as single
T 97) the following one is valid:
If textbox1.text=”ebrahimi” then
Msgbox(“your salary is” & netpay)
end if
F 98) Both a and b need to be True for “Help” to be displayed:
If a Or b Then MsgBox(“Help”)
F 99) The key word Or represent a logical operation that can be used by separate nested if statement.
T 100) the following is not a valid statement:
If radio1.checked = true Then
checkbox.checked= true
End If