Visual Basic .Net True / False                                               Dr. Ebrahimi

 

Name__________________________________                                     

 

F 1) A systematic way or step by step procedure to solve problem is known as an logarithm.

 

T 2) A program is a set of instructions that tell a computer what to do.

 

 F 3) Every character languages has its own ASCII code, such as 97 for uppercase A and 65 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 6.0 and Basic.

 

T  6) In Visual Basic.net the =  sign is used for the equality comparison as well as assignment statements.

 

 F 7) Every problem has only one algorithm to solve. For example computing overtime pay.

 

T  8) A compiler will not find a logical error, such as substituting addition instead of subtraction in net pay computation.

 

 F 9) In order to get an output (result) from a program you must first edit, execute and then compile it for syntax errors.

 

F 10) A data file (input file) is a program and can therefore be executed.

 

F 11) If there is a syntax error in visual Basic.net can you still execute the program.

 

F 12) Decision making is also called a repetition.

 

F 13) Comments in a program can be executed just as statements in the program.

 

F 14) Basic, Visual Basic, C, C++, Visual Basic .Net, Java, and C# are all known as  visual programming languages.

 

T  15) The binary state of a computer is represented as 0 and 1 at the lowest level of machine

 

T  16) With the symbol  ‘ single quote - you can create a single line of comment in a program.

 

 F 17)  Basic is better than Visual Basic 6.0 and Visual Basic.net since  it is Object Oriented and Event oriented

 

F 18) clicking on mouse or button  is known as object not event.

 

 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 by Microsoft.

 

F 21) A Visual Basic program has the extension .vb and a form in the program uses the extension .frm.

 

T 22) Visual Basic .net Toolbox consist of text boxes, command button, check boxes, list box and frame and more.

 

T  23) Basic was line oriented therefore to execute multiple statements in a If 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 different  tax rate depending on 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

F 31) An If statement that contains other If statements as part of its body is called a double 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.

 

 F 37) The following statement is logically correct:

 

If hoursworked > 40 Then

overtimehours = hoursworked – 40

Else

overtimehours = 10

End if

 

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

 

F 39) In order to calculate tax amount, we need to know net pay.

 

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 tax rate of 15% for a gross pay less than 300.  

                        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.

F 45)In VB  the result of 5+2* 3 is 21.

 

T 46) The reserved word While makes a program to loop depend on its condition.

 

F 47) To change a 5 times loop to 5000 times loop we need to modify several lines in the program. 

 

F 48) To sum a series of numbers you need to initialize the sum = 1 instead of 0.

 

 F 49) The following loop will read 5 employee id

dim counter as integer=0

dim empid as integer                       

While counter <=5

 empid =inputbox("ENTER EMPLYEE ID")

counter +=1 

  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 2>0   ..... 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)  VB gives a default number staring from 0 every time you choose a toolbox items such as button or textbox.

 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, therefore the  program is correct.

T 63) There is a logical error in the following declaration: Dim empid As Double.
T 64) A dummy value that is used to stop a loop is known as a sentinel.

T 65) A loop can have one or more statements enclosed.

T  66) When the condition of a while loop becomes false, the execution continues at the statement right after  the end while.

F 67) The While loop is more compact than For loop, since it keeps the loop control statements together.

 F 68) The position and style of writing the statements  in a loop is very important and you can’t choose your own style. 

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 will work with  tool box to get the input and display the output.

 

 F 72) The following statement adds the two values in the textbox1 and textbox3 and result will be in textbox2.

TextBox3.Text = TextBox2.Text + TextBox1.Text

 

 F 73) The following is a valid Visual Basic statement:

                                       Dim tax rate As Single

                                       Taxrate = TextBox1.Text

 

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  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 and clear the text of a textbox.

 

T 77) It is a Visual Basic convention to name a control with a shorthand prefix such as txthoursworked, 1b1hoursworked, 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

            If text

            Else

                 Textbox3.text = textbox1.text*textbox2.text

 

T  80) Every control can be programmed. For example a TextBox or a label1 can be programmed.

 

T 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) textbox1.text + textbox2.text always add two contents of two textboxes.

T 85) Text box can only be use for input as well as 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

 

F 88) The following loop always loop 5 times

dim n as integer

dim counter as integer =0

n=inputbox(ENTER NUMBER OF TIMES"

              while (counter <n)

             counter =counter +1

end while

F 89) You can use a variable and then declare it at later time \

 F 90) n=0

     n= n+1

 is a variable since the value of n is 1 and not changing after initialized to 0.

 

F 91) in VB addition has higher priority over subtraction.

 

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

 

T  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 to declare variables of integer, single, double, and string.

F 96) The following statement indicates that variable netpay is a whole number instead of fraction.

Dimension netpay as single

 

F 97)  msgbox("grosspay is "& netpay) will display the content of a grosspay.

 

T  98) The following one is valid:

            If textbox1.text=”ebrahimi” then

            Msgbox(“your salary is” & netpay)

            end if

 

F 99) In the invoice program the tax amount will be subtracted from the subtotal.

 

F 100) In the invoice program salestax will be different according to the amount of subtotal.