Visual Basic .Net True / False                             Dr. Ebrahimi

 

 

Delete either T or F of each question and after you have finished the quiz email to ebrahimidr@gmail.com

i.e.

T - 1) SUNY Oldwestbury is the best college.

F - 2) SUNY Oldwestbury is the worst college.

 

Answer all 100 questions.

Name__________________________________Spring 2006                                     

 

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

 

F 2) A program is a set of hardware that tell a computer what to do.

 

T 3) Every character has its own ASCII code, such as 65 for uppercase A, 97 for lowercase a and 48 for zero.

 

F 4) Computer languages are ambiguous and natural languages are not ambiguous. (Ch. 1 Page 5)

 

F 5) Visual Basic.net was developed before Visual Basic and Basic. Sun Li to bring evidence.

 

F 6)The arithmetic expression  3+4*9 will evaluate to the same result as (3+4)*9. Parenthesis has higher precedence.  Order of Operation.  (Ch. 2 Page 37) There is a language called APL that starts from right to the left and no precedence.  (Ch. 1 Page 8)


F 7) Every problem has only one algorithm to solve it. You can do overtime pay with overtime calculation differently.

 

T 8) Human intervention is required to review logical statements, because the compiler will not catch logical errors.  What is a logical error?  For example instead of subtracting taxamount from netpay you add it.

 

T 9) In order to get an output from a program you must edit, compile, and execute the program.

 

F 10)  The symbol \ represents division in many languages including VB to represent division. (Ch.1 Page 18)

 

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. (Ch. 4 is decision making, Ch. 3 is loop)

 

T 13) The symbol  '  is used to comment a line of text in vb. (Website Ch. 3) 

 

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. (Ch. 1)

 

T 16) A comment will not executed by the program and compiler will ignore the translation of the comment . (Web Ch. & Class Notes)

 

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 and event programming language.

 

F 19) Visual Basic was developed before Basic and Visual Basic.net.

 

F 20) Visual Basic.net is user Friendly and were designed for teaching purposes.

 

F 21) A program consists of input, output and process respectively.

 

F 22) you can program any toolbox control by a single click.

 

T 23) An original Basic was line oriented therefore to execute multiple statements you must use goto statement with a line number.

 

F 24)  Basic was designed by two professors John F. Kennedy and Thomas Krutz from Dartmouth  College.

 

F 25)  HoursWorked=InputBox(“Enter the Employee Id”) is  logically a 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

 

F 28) The following will set a different tax rate depending on gross pay:

If grosspay > 500 Then

taxrate = 0.20

Else

taxrate = 0.20

                                    End If

 

 T 29) Overtime pay can be computed using the following:

If hoursworked > 40 Then

overtimehours = hoursworked - 40

overtimepay= overtimehours * hourlyrate *1.5

Else

overtimehours = 0

            overtimepay=0

end if

 

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

T 32) Every Else in a program must correspond to an If statement.

F 33) Both conditions need to be True for “Hellooooooo” to be displayed:

                                    If grosspay>50000 Or grosspay<0   Then MsgBox(“Hellooooooo”)

F 34) The following statement is always True: while (0).

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:  (web chapters)

 

                        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 (married, single) or credit card(Visa, Master 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.

 

T 42) The following statements will assign an employee with a gross pay of 0 a tax rate of 10%:

 

                        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. (people don't know the difference between "and" and "or".  If temperature is greater than 300 and less than -200 then shut it off.)

 

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)
 

(x will have 6 in it.  So it will display 6 twice.  Computer will forget, but humans do not forget, they don't remember.  You have to use an array to not forget.)

 

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.(page 65)

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 as integer is incorrect.
T 64) A dummy value that is used to stop a loop is known as a sentinel.
(PAGE 75)

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

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

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

F 68) To indent the statements within the 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.

 

F 71) By visualization, it means that Visual Basic will display the execution of program visually.

 

F 72) The following statement adds the two values in the textboxes:

TextBox3.Text = TextBox2.Text + TextBox1.Text (The compiler understands Val)  = val(textbox1.text)+val(textbox2.text)

 

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

                                       Dim tax rate As Single

                                       Tax rate = TextBox1.Text

(A variable cannot have space)

T 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.  Ex: Textbox1.text, Textbox2.text

 

T 75) When you start the VB environment, you are in the design mode rather than run mode. (You are in design mode no execution mode.)

 

F 76) You can change the name of a control in the Text property.

(There is a component called name, but be aware of it)

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

EndIF

 

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 a event-driven programming language, it is a procedural language. For example,  botton1_ click() or botton2_doubleclick()

(Also you have a timer, you can say tomorrow execute this program with a timer)

T 85) Text box can  use for input as well as output.

(You both enter and display the data)

F 86) To perform arithmetic operation in visual basic, * is used for multiplication and ÷ is used for division.  (You must us / for division)

 

F 87) In order to calculate overtime hours we need to know hourly rate in the textbox2

 

F 88) The grosspay variable will be declared as integer or string.

 

F 89) Declaring a variable or constant is an optional in visual Basic
 

 

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

(They are not if elseif)

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

 

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

 

T 98)  The input part is where the information is entered by the user and stored in a memory location.

 

 

F 99) In Visual Basic it is not necessary to declare the variable.

 

T 100) The difference between a single and a double is the way you request a  memory for the value from the compiler