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