Exam 4: Variables and Arithmetic Operations

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

What are the rules for naming variables in Visual Basic? Providing examples of the good and the bad, discuss what impact good programming practice has on the naming of variables.

Free
(Essay)
4.8/5
(25)
Correct Answer:
Verified

The name must begin with a letter or an underline symbol (_). The name can contain letters, numbers, or the underline symbol. It cannot contain spaces or other special characters. Reserved words in Visual Basic cannot be used for variable names; reserved words appear in blue in the code window. Good programming practice dictates that the variable names you use should reflect the actual values to be placed in the variable. That way, anyone reading the program code can easily understand the use of the variable. For example, a good variable name for a string variable that will contain an employee's last name would be strEmployeeLastName. Names you should not use include strXXX, strLN, strEmp, or strName. Each of these names is imprecise and potentially misleading. You should consider the people who will be reading your code when you name the variables in your program. Your goal must be to make the task of reading your code as clear and easy as possible.

A(n) ____ Exception occurs when a calculation creates a value larger than one that can be processed by a procedure.

Free
(Multiple Choice)
4.8/5
(35)
Correct Answer:
Verified

D

A(n) ____________________ specifier is used to identify the number of positions to the right of the decimal point that should be returned when displaying numeric data.

Free
(Short Answer)
4.7/5
(38)
Correct Answer:
Verified

precision

A(n) ____________________ is a named grouping of program code.

(Short Answer)
4.8/5
(41)

The memory allocation for the Char data type is ____ bytes.

(Multiple Choice)
4.9/5
(39)

The dtm prefix is used to denote a(n) ____ data type.

(Multiple Choice)
4.9/5
(30)

The ____ indicates that a statement is an assignment statement.

(Multiple Choice)
4.9/5
(41)

When using ____ division (\), any remainder amount is dropped or truncated.

(Multiple Choice)
4.8/5
(35)

Does entering Dim intValue = 1 provide an error in Visual Basic 2015? Explain why or why not, and the significance of this.

(Essay)
4.9/5
(39)

A numeric data type must be used in arithmetic operations.

(True/False)
4.9/5
(45)

A(n) ____________________ will contain a permanent value throughout the execution of the program.

(Short Answer)
4.9/5
(42)

String data types can be used in arithmetic operations.

(True/False)
4.9/5
(31)

An Overflow Exception will occur if the user enters a value greater than the maximum value that can be processed by the statement.

(True/False)
4.8/5
(29)

The CancelButton property of the Windows Form object allows you to specify which button is activated when the CTRL key on the keyboard is pressed.

(True/False)
4.9/5
(35)

A local variable is a variable that can only be accessed in the region in which it was defined.

(True/False)
4.9/5
(42)

A prefix of ____ is used to denote that a variable has been defined as a Boolean data type.

(Multiple Choice)
5.0/5
(37)

The ____________________ property of a TextBox object controls the alignment of the text content.

(Short Answer)
4.7/5
(40)

A(n) ____________________ is a procedure that returns a value when it is called.

(Short Answer)
4.8/5
(34)
Identify the letter of the choice that best matches the phrase or definition.
Premises:
A procedure is a prewritten set of code that can be called by a statement in this
Responses:
procedure
constant
literal
Correct Answer:
Verified
Premises:
Responses:
A procedure is a prewritten set of code that can be called by a statement in this
procedure
(Matching)
4.8/5
(38)

A(n) ____________________ procedure does not return a value.

(Short Answer)
4.9/5
(35)
Showing 1 - 20 of 112
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)