Programming Chapter 3 Test

Name: ______Hour: ______

True/False

Indicate whether the statement is true or false.

____1.A variable of type Double is initialized to 0 by default.

____2.A local declaration allows a variable to be accessible to any code in the Form class.

____3.A run-time error will occur if a text box contains data that does not match the variable type.

____4.It is good programming practice to keep the scope of variable declarations as wide as possible.

____5.Identifiers are case sensitive.

____6.The Val() function converts text box data to a numeric value.

____7.Modulus division truncates the decimal portion of the quotient to result in an integer.

____8.An identifier can contain spaces.

____9.Commenting out selected lines of text is a debugging technique.

____10.A variable must be declared before it is used.

____11.A variable of type String is initialized to 0 by default.

____12.A program with a semantic error will produce unexpected results.

____13.A run-time error halts program execution at the statement that cannot be executed.

____14.Nothing is a keyword.

____15.A variable is a name for a value stored in memory.

____16.A global declaration allows a variable to be accessible only in the procedure it is declared in.

____17.A constant value can be changed from its initial assignment.

____18.Grouping variables together in a single statement is good programming style only when the variables represent related items.

____19.The value of a declared constant can be changed anywhere in the program code.

____20.Debugging is the process of getting an application to work correctly.

____21.A breakpoint is a statement that has been marked as a stopping point.

____22.Values represented by the Double data type are referred to as floating point.

____23.A Visual Basic application can be published to a website.

____24.The value of a constant can be assigned only in the declaration.

____25.An error will be generated when hello is assigned to an Integer variable.

____26.A Char assignment requires double-quotation marks (").

Multiple Choice

Identify the choice that best completes the statement or answers the question.

____27.How many values can a variable store at one time?

a. / 1 / c. / 5
b. / 2 / d. / 10

____28.Which operator is used for modulus division?

a. / / / c. / %
b. / \ / d. / Mod

____29.The statement weight=Val("Forty-eight kilograms") returns a value of

a. / forty-eight. / c. / 0.
b. / 48. / d. / 48 kilograms.

____30.Which type of error occurs in statements that are syntactically correct, but produce undesired or unexpected results?

a. / syntax error / c. / run-time error
b. / semantic error / d. / exception error

____31.Which statement declares the variable radius and assigns it a value of 15?

a. / Dim radius = 15 / c. / Dim radius As Integer = 15
b. / Dim radius As Integer == 15 / d. / Dim radius = 15 As Integer

____32.Which data type declares a variable that stores a positive or negative whole number?

a. / Integer / c. / Char
b. / Double / d. / Boolean

____33.Which should be used to let a user know what input is expected in an application?

a. / a variable / c. / a prompt
b. / an identifier / d. / a keyword

____34.Which data type declares a variable that stores a true or false value?

a. / Integer / c. / Char
b. / Double / d. / Boolean

____35.In the assignment statement Dim x As Integer = 20, the value 20 is called

a. / a variable / c. / an initializer
b. / a literal / d. / an expression

____36.Which is not a Visual Basic keyword?

a. / Date / c. / False
b. / Const / d. / Start

____37.What is the final value offinalNumberafter the last statement executes?

Dim startingNumber As Integer = 10

Dim finalNumber As Integer = 25

startingNumber = finalNumber / 5

finalNumber = startingNumber + 5

a. / 5 / c. / 20
b. / 10 / d. / 25

____38.How many bytes are used to store an Integer variable?

a. / 2 / c. / 8
b. / 4 / d. / 16

____39.What is the result of the following expression when x is 125?

x Mod 6

a. / 0 / c. / 20
b. / 5 / d. / 20.5

____40.What is the result of the following expression whenxis 3576?

(x\10) Mod 10

a. / 6 / c. / 76
b. / 7 / d. / 357

____41.Which is executed when the user types in a text box?

a. / a variable assignment. / c. / a function.
b. / a TextChanged event procedure. / d. / an exception.

____42.Which Visual Basic keyword is used to clear labels?

a. / Default / c. / Nothing
b. / Erase / d. / Static

____43.A named memory location which stores a value that cannot be changed from its initial assignment is called a

a. / constant. / c. / procedure.
b. / variable. / d. / function.

____44.Which keyword does a constant declaration begin with?

a. / Static / c. / Integer
b. / Const / d. / Final

____45.Which is a valid identifier?

a. / $12 / c. / 55
b. / Integer / d. / diameter

____46.The statement weight=Val("48 kilograms") returns a value of

a. / forty-eight and a half kilograms. / c. / 0.
b. / 48. / d. / 48000.

____47.In the assignment statement Dim x As Integer = 5.6, x is assigned the value

a. / 0. / c. / 5.6.
b. / 5. / d. / 6.

____48.Which operator is used to assign a new value to a variable?

a. / = / c. / *
b. / == / d. / –

____49.A statement that has been marked as a stopping point is called a

a. / watching statement. / c. / debug statement.
b. / breakpoint. / d. / stop point.

____50.The TextBox control TextAlign property

a. / sets the alignment of the text box to match it corresponding label.
b. / determines what text is displayed in the text box.
c. / sets the alignment of the text relative to the form.
d. / sets the alignment of the text relative to the text box.

____51.Which data type is most appropriate for the number of students in a class?

a. / Integer / c. / Boolean
b. / Double / d. / Char

____52.A Watch window can be used to

a. / display the application interface.
b. / examine values during the execution of a program.
c. / switch to the Code window.
d. / display online help.

____53.Which is not a primitive data type?

a. / Integer / c. / String
b. / Double / d. / Boolean

____54.Which type of error occurs when a statement violates the rules of Visual Basic?

a. / syntax error / c. / run-time error
b. / semantic error / d. / exception error

____55.Which statement declares a constant named PRICE with a value of 5.25?

a. / Const PRICE = 5.25 / c. / Const As Double PRICE = 5.25
b. / Const PRICE As Double = 5.25 / d. / Final PRICE As Double = 5.25

____56.Which is a valid declaration statement?

a. / Dim height and width As Integer
b. / Dim height, width As Integer
c. / Dim height As Integer, width As Integer
d. / Dim height, Dim width As Integer

____57.The TextBox control Text property

a. / sets the alignment of the text relative to the text box.
b. / identifies a control for the programmer.
c. / determines what text is displayed in the text box.
d. / sets the alignment of the text relative to the form.

____58.A procedure that performs a task and returns a value is called

a. / an assignment. / c. / a function.
b. / a TextChanged event. / d. / an event procedure.

____59.Which data type is most appropriate for whether an employee qualifies for a bonus?

a. / Integer / c. / Boolean
b. / Decimal / d. / Char

____60.The TextBox control (Name) property

a. / sets the alignment of the text relative to the text box.
b. / identifies a control for the programmer.
c. / determines what text is displayed in the text box.
d. / sets the alignment of the text relative to the form.