# Variables and Arithmetic Operations MCQs

Chapter 4: Variables and Arithmetic Operations

MULTIPLE RESPONSE

Modified Multiple Choice

1. ____ is an arithmetic operation.
 a. Comparison c. Addition b. Division d. Multiplication

ANS:  B, C, D           PTS:   1                    REF:   196

1. A variable is ____.
 a. a place where data is stored c. defined in the coding of the program b. a named location in RAM d. a location in memory

ANS:  A, B, C, D       PTS:   1                    REF:   213|225

1. The Double data type can store a ____.
 a. floating point number c. huge positive number b. very small negative number d. value to the right of the decimal point

ANS:  A, B, C, D       PTS:   1                    REF:   221

1. The Decimal data type can represent ____.
 a. dollar amounts c. large numbers b. very precise decimal numbers d. numbers accurate to 280 digits

ANS:  A, B, C           PTS:   1                    REF:   221

1. A ____ can be represented by using the Char data type.
 a. letter c. punctuation symbol b. very large number d. symbol

ANS:  A, C, D           PTS:   1                    REF:   222

MODIFIED TRUE/FALSE

1. As utilized in the accompanying figure, a PredefinedTextBox object is a text box that allows the use of predefined layouts for the data a user must enter. _________________________

PTS:   1                    REF:   205

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

ANS:  F, ESC

PTS:   1                    REF:   211

1. A green squiggly underline beneath a variable name in a declaration statement indicates that the variable is unused in the program. _________________________

ANS:  T                                                     PTS:   1                    REF:   216

1. The Void procedure clears any data currently placed in the Text property of a TextBox object. _________________________

ANS:  F, Clear

PTS:   1                    REF:   242

1. The ampersand character at the end of a line in the code editor indicates that the line of code continues on the next line. _________________________

ANS:  F, underscore

PTS:   1                    REF:   246

MULTIPLE CHOICE

1. The prefix ____ should be used for naming a TextBox object.
 a. tbox c. txt b. txtbox d. obj

ANS:  C                    PTS:   1                    REF:   199

1. When naming a Label object, the ____ prefix should be used.
 a. label c. lab b. lbl d. txtlbl

ANS:  B                    PTS:   1                    REF:   209

1. As shown in the accompanying figure, the ____ property of the form specifies which button will be activated when the ENTER key on the keyboard is pressed.
 a. GoButton c. EnterButton b. AcceptButton d. ReturnButton

ANS:  B                    PTS:   1                    REF:   210

1. The event handler of a button designated as the Cancel button will be processed when the user presses the ____ key on the keyboard.
 a. ESC c. CTRL b. ENTER d. ALT

ANS:  A                    PTS:   1                    REF:   211

1. When defining a variable, the keyword ____ appears at the beginning of the statement.
 a. Assign c. Define b. Declare d. Dim

ANS:  D                    PTS:   1                    REF:   213

1. When defining a variable to be used to hold textual information containing multiple characters, the declaration statement should have ____ at the end of the statement.
 a. As Char c. As String b. As Char Type d. As String Type

ANS:  C                    PTS:   1                    REF:   213

1. The ____ indicates that a statement is an assignment statement.
 a. keyword Set c. equal sign (=) b. ampersand (&) d. keyword Assign

ANS:  C                    PTS:   1                    REF:   214

1. A ____ beneath a variable name in a declaration statement indicates that the variable has not been used in the program.
 a. blue squiggly underline c. red squiggly underline b. green squiggly underline d. yellow squiggly underline

ANS:  B                    PTS:   1                    REF:   216

1. A(n) ____ data type must be used in arithmetic operations.
 a. string c. character b. numeric d. either A or B

ANS:  B                    PTS:   1                    REF:   219

1. A variable that will be used to contain only whole numbers should be declared as a(n) ____ data type.
 a. Decimal c. Integer b. Double d. Single

ANS:  C                    PTS:   1                    REF:   220

1. The memory allocation for the Char data type is ____ bytes.
 a. 2 c. 8 b. 4 d. 16

ANS:  A                    PTS:   1                    REF:   222

1. A variable that will be used to hold only True or False values should be declared as a(n) ____ data type.
 a. Boolean c. Integer b. Decimal d. Single

ANS:  A                    PTS:   1                    REF:   222

1. A(n) ____ variable should be used for values that will consist of a single character only.
 a. Boolean c. Decimal b. Char d. Integer

ANS:  B                    PTS:   1                    REF:   222

1. A prefix of ____ is used for variables defined as a String data type.
 a. chr c. str b. wrd d. txt

ANS:  C                    PTS:   1                    REF:   224

1. A prefix of ____ is used to denote a variable defined as an Integer data type
 a. num c. nbr b. dec d. int

ANS:  D                    PTS:   1                    REF:   224

1. A prefix of ____ is used to denote a variable defined as a Decimal data type.
 a. dec c. num b. dml d. int

ANS:  A                    PTS:   1                    REF:   224

1. A prefix of ____ is used to denote a variable defined as a Char data type.
 a. str c. txt b. chr d. wrd

ANS:  B                    PTS:   1                    REF:   224

1. A prefix of ____ is used to denote that a variable has been defined as a Boolean data type.
 a. tru c. bln b. tfl d. trf

ANS:  C                    PTS:   1                    REF:   224

1. The dtm prefix is used to denote a(n) ____ data type.
 a. Boolean c. Single b. Char d. Date

ANS:  D                    PTS:   1                    REF:   224

1. A variable that has been defined as a Single data type is denoted with the ____ prefix.
 a. sng c. num b. sin d. sge

ANS:  A                    PTS:   1                    REF:   224

1. The prefix ____ should be used for a Double variable.
 a. dbl c. dou b. dub d. dob

ANS:  A                    PTS:   1                    REF:   224

1. The character D is the literal-type character for the ____ data type.
 a. Single c. Double b. Integer d. Decimal

ANS:  D                    PTS:   1                    REF:   225

1. The character C is the literal-type character for the ____ data type.
 a. Char c. Integer b. Short d. Decimal

ANS:  A                    PTS:   1                    REF:   225

1. The ____ of a variable specifies where a variable can be referenced within a program.
 a. range c. scope b. lifetime d. scale

ANS:  C                    PTS:   1                    REF:   227

1. The ____ of a variable indicates how long the variable remains active.
 a. lifetime c. range b. scope d. duration

ANS:  A                    PTS:   1                    REF:   228

1. The ____ statement prevents automatic conversion of data types.
 a. Manual Conversion On c. Manual Conversion Off b. Option Strict Off d. Option Strict On

ANS:  D                    PTS:   1                    REF:   231

1. The \ operator is the arithmetic operator for ____ division.
 a. integer c. modular b. decimal d. linear

ANS:  A                    PTS:   1                    REF:   233

1. The ____ operator is used for exponentiation.
 a. * c. ~ b. ^ d. \

ANS:  B                    PTS:   1                    REF:   233

1. When using ____ division (\), any remainder amount is dropped or truncated.
 a. modular c. linear b. integer d. decimal

ANS:  B                    PTS:   1                    REF:   236 | 237

1. Used with the ToString function, the ____ format specifier will display the value 8976.43561 as 8,976.44.
 a. Fixed (F) c. Currency (C) b. Number (N) d. General ( G)

ANS:  B                    PTS:   1                    REF:   241

1. Used with the ToString function, the ____ format specifier will display the value 8976.43561 as 8976.44.
 a. Fixed (F) c. General (G) b. Number (N) d. Currency (C)

ANS:  A                    PTS:   1                    REF:   241

1. Used with the ToString function, the ____ format specifier will display the value 8976.43561 as \$8,976.44.
 a. Fixed (F) c. General (G) b. Number (N) d. Currency (C)

ANS:  D                    PTS:   1                    REF:   241

1. Used with the ToString function, the ____ format specifier will display the value 8976.43561 as 8976.43561.
 a. Fixed (F) c. General (G) b. Number (N) d. Currency (C)

ANS:  C                    PTS:   1                    REF:   241

1. When the user interacts with an object in the graphical user interface, the ____ shifts to that object.
 a. scope c. visibility b. focus d. precision

ANS:  B                    PTS:   1                    REF:   244

1. The ____ operator is used to concatenate two strings.
 a. & c. @ b. # d. +

ANS:  A                    PTS:   1                    REF:   246

1. The process of joining two string values together is called ____.
 a. addition c. combination b. alignment d. concatenation

ANS:  D                    PTS:   1                    REF:   246

1. A ____ Exception occurs when the user enters data that a statement cannot properly handle.
 a. Style c. Format b. Substance d. Setting

ANS:  C                    PTS:   1                    REF:   248

1. A(n) ____ Exception occurs when the user enters a value larger than the maximum value that can be processed by the statement.
 a. Excessive input c. Stack b. MaxSize d. Overflow

ANS:  D                    PTS:   1                    REF:   250

1. A(n) ____ Exception occurs when a calculation creates a value larger than one that can be processed by a procedure.
 a. Excessive input c. Stack b. MaxSize d. Overflow

ANS:  D                    PTS:   1                    REF:   250

1. A ____ Exception occurs when code attempts to divide a number by zero.
 a. Divide by Zero c. Zero error b. Zero denominator d. Division Error

ANS:  A                    PTS:   1                    REF:   250

TRUE/FALSE

1. A TextBox object allows a user to enter programming code into the program at runtime.

ANS:  F                    PTS:   1                    REF:   197

1. The maximum size of a TextBox object often is determined by the design of the user interface, so it looks and feels good in the user interface.

ANS:  T                    PTS:   1                    REF:   199

1. The style of the text displayed in a TextBox object can be set using the Font property.

ANS:  T                    PTS:   1                    REF:   201

1. By default, a text box will display as many lines of text as the user enters.

ANS:  F                    PTS:   1                    REF:   204

1. When setting up a mask for a MaskedTextBox object, select the Use Validating Type check box to cause the object to verify that the user entered valid numeric data.

ANS:  T                    PTS:   1                    REF:   207

1. Whenever data is stored in RAM, it does not need to be stored as a particular data type.

ANS:  F                    PTS:   1                    REF:   213

1. A String data type allows for the storing of the standard English letters only.

ANS:  F                    PTS:   1                    REF:   213

1. The variable name on the left of an assignment statement is the variable that receives the data that results from the evaluation of the expression on the right side of the assignment statement.

ANS:  T                    PTS:   1                    REF:   214

1. A numeric data type must be used in arithmetic operations.

ANS:  T                    PTS:   1                    REF:   219

1. String data types can be used in arithmetic operations.

ANS:  F                    PTS:   1                    REF:   219

1. A Double variable can be used in arithmetic operations.

ANS:  T                    PTS:   1                    REF:   219

1. You must enclose a value in parentheses to assign it to a variable declared as Char data type.

ANS:  F                    PTS:   1                    REF:   222

1. Char variables can be used in arithmetic operations.

ANS:  F                    PTS:   1                    REF:   223

1. A Short data type is used for a very short string value of 10 bytes or less.

ANS:  F                    PTS:   1                    REF:   223

1. Integer variables can be used to store fractional values.

ANS:  F                    PTS:   1                    REF:   224

1. To force a literal value to be treated as a specific data type, you must use a literal-type character designator.

ANS:  T                    PTS:   1                    REF:   225

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

ANS:  T                    PTS:   1                    REF:   227

1. A variable that can be used in multiple regions of code is called a universal variable.

ANS:  F                    PTS:   1                    REF:   228

1. A procedure that does not return a value is called a function.

ANS:  F                    PTS:   1                    REF:   229

1. A property identifies a value required by a procedure that must be passed into the procedure when it is called.

ANS:  F                    PTS:   1                    REF:   229

1. The Option Strict On statement enables automatic data type conversions.

ANS:  F                    PTS:   1                    REF:   231

1. Calculations are preformed from right to left, working towards the equal sign.

ANS:  F                    PTS:   1                    REF:   238

1. MOD operations occur before any other arithmetic operations.

ANS:  F                    PTS:   1                    REF:   238

1. The ToString function requires a format specifier argument.

ANS:  F                    PTS:   1                    REF:   240

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

ANS:  T                    PTS:   1                    REF:   250

COMPLETION

1. A(n) ____________________ object allows users to enter data into a program.

ANS:  TextBox

PTS:   1                    REF:   197

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

ANS:  TextAlign

PTS:   1                    REF:   202

1. A(n) ____________________ text box allows the user to enter multiple lines in a text box.

ANS:  MultiLine

PTS:   1                    REF:   204

1. As illustrated in the accompanying figure, the term ____________________ refers to a predefined layout for the data a user must enter.

PTS:   1                    REF:   205

1. As shown in the accompanying figure, a(n) ____________________ object allows you to specify the data format of the value typed into the text box.

PTS:   1                    REF:   205

1. The event handler of a button designated as the Accept button will be processed when the user presses the ____________________ key on the keyboard.

ANS:

ENTER

enter

return

PTS:   1                    REF:   210

1. A(n) ____________________ is a named location in RAM that can store a value that may change during program execution.

ANS:  variable

PTS:   1                    REF:   213

1. In an assignment statement, the value to the right of the equal sign will be ____________________ to the variable on the left.

ANS:

copied

assigned

PTS:   1                    REF:   214

1. The ____________________ data type holds a nondecimal whole number value.

ANS:

Integer

PTS:   1                    REF:   220

1. A(n) ____________________ variable as defined in the accompanying figure will contain a permanent value throughout the execution of the program.

ANS:  constant

PTS:   1                    REF:   226

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

ANS:  Sub

PTS:   1                    REF:   229

1. A(n) ____________________ identifies a value required by a procedure that must be passed when the procedure is called.

ANS:  argument

PTS:   1                    REF:   229

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

ANS:

function

Function procedure

PTS:   1                    REF:   229

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

ANS:  class

PTS:   1                    REF:   229

1. The * operator is the ____________________ arithmetic operator.

ANS:  multiplication

PTS:   1                    REF:   233

1. The ^ operator is the ____________________ arithmetic operator.

ANS:  exponentiation

PTS:   1                    REF:   233

1. The ____________________ function available with each of the numeric data types will convert data from the numeric data type to the String data type.

ANS:  ToString

PTS:   1                    REF:   239

1. 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.

ANS:  precision

PTS:   1                    REF:   241

1. The ____________________ procedure clears any data currently placed in the Text property of a TextBox object.

ANS:  Clear

PTS:   1                    REF:   242

1. The process of joining two different values into a single string is called ____________________.

ANS:  concatenation

PTS:   1                    REF:   246

MATCHING

Identify the letter of the choice that best matches the phrase or definition.

 a. program f. method b. ToString g. class c. constant h. procedure d. precision specifier i. local e. function j. literal
1. When you include a value in an assignment statement, the value is called this
1. A special variable whose value cannot be changed at runtime
1. The general rule of this is that a variable can be referenced only from within the region in which it was defined
1. The code between the Sub statement and the End Sub statement
1. A procedure is a prewritten set of code that can be called by a statement in this
1. A procedure that returns a value
1. Another name for a procedure
1. Function in which all values are rounded based on the digit after the last digit to be displayed
1. Indicates how many digits to the right of a decimal place are to be returned
1. A variable that must be used by more than one procedure should be defined at this level
1. ANS:  J                     PTS:   1                    REF:   224
1. ANS:  C                    PTS:   1                    REF:   226
1. ANS:  I                     PTS:   1                    REF:   227
1. ANS:  H                    PTS:   1                    REF:   227
1. ANS:  A                    PTS:   1                    REF:   228
1. ANS:  E                    PTS:   1                    REF:   229
1. ANS:  F                    PTS:   1                    REF:   239
1. ANS:  B                    PTS:   1                    REF:   240
1. ANS:  D                    PTS:   1                    REF:   241
1. ANS:  G                    PTS:   1                    REF:   247

ESSAY

1. 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.

ANS:

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. No Visual Basic reserved words (words that appear in blue in the code editing window) can be used for variable names. 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.

PTS:   1                    REF:   213|214          TOP:   Critical Thinking

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

ANS:

Visual Basic 2010 now allows you to omit the data type without error, so this line of code does not generate an error because the compiler infers that the value of the intValue is an Integer data type. This is called type inference. While you are learning beginning programming, however, it is best to use the data types to understand the changes as you convert one data type to another.

PTS:   1                    REF:   220                TOP:   Critical Thinking

1. Discuss five rules that apply to variables as defined in the accompanying figure.

ANS:

1. The declaration of a constant variable begins with the letters Const, not the letters Dim.
2. You must assign the value to be contained in the constant on the same line as the definition of the constant.
3. You cannot attempt to change the value in the constant variable anywhere in the program. If you do, it will produce a compiler error.
4. The letter c often is placed before the prefix of the constant variable name to identify throughout the program that it is a constant variable and cannot be changed.
5. Other than the letter c constant variable names are forced using the same rules and techniques as nonconstant names.

PTS:   1                    REF:   226                TOP:   Critical Thinking

CASE

Critical Thinking Questions

Case 4-1

Brian is trying his best to understand the concept of variable scope, so he calls his friend Molly for guidance.

1. Brian has defined a variable named strNumberOfSongs within the click event handle for a Submit button, and he has been frustrated in his efforts to refer to this variable in the click event handler for a Clear button. What does Molly tell him is going on?
 a. The variable strNumberOfSongs has no scope. c. The variable strNumberOfSongs was not declared correctly. b. The variable strNumberOfSongs is a local variable. d. The variable strNumberOfSongs is a global variable.

ANS:

B

PTS:   1                    REF:   227

1. Brian has defined another variable called strNumberOfSingers within a procedure, and he asks Molly what the lifetime of that variable is. What does she tell him?
 a. It is “alive” for the entire duration of the program. c. It is “alive” until the procedure is called by the larger program. b. It is “alive” with the same contents during all executions of the procedure by the program. d. It is “alive” from the time the procedure begins executing until the procedure ends.

ANS:

D

PTS:   1                    REF:   228

Critical Thinking Questions

Case 4-2

The arithmetic operators in your program are not behaving the way you think they should be, so you decide to brush up on your operators and the hierarchy of operations.

1. You perform the operation 12\5 and you do not get the same number as your program does. What is the correct answer?
 a. 2 c. 2.4 b. 2.6 d. 3

ANS:

A

PTS:   1                    REF:   228

1. What is the correct order among the following operations?
 a. exponentiation, multiplication, integer division, MOD, addition b. multiplication, exponentiation, MOD, integer division, addition c. integer division, multiplication, exponentiation, MOD, addition d. multiplication, integer division, exponentiation, MOD, addition

ANS:

A

PTS:   1                    REF:   238

hihi

## Cite This work.

Assignment Hippo (2021) . Retrive from http://www.assignmenthippo.com/sample-assignment/variables-and-arithmetic-operations-mcqs

"." Assignment Hippo ,2021, http://www.assignmenthippo.com/sample-assignment/variables-and-arithmetic-operations-mcqs

Assignment Hippo (2021) . Available from: http://www.assignmenthippo.com/sample-assignment/variables-and-arithmetic-operations-mcqs

[Accessed 11/04/2021].

Assignment Hippo . ''(Assignment Hippo,2021) http://www.assignmenthippo.com/sample-assignment/variables-and-arithmetic-operations-mcqs accessed 11/04/2021.

Want to order fresh copy of the Sample Template Answers? online or do you need the old solutions for Sample Template, contact our customer support or talk to us to get the answers of it.

### + Submit Your Assignment Here

#### AssignmentHippo Features

##### On Time Delivery

Our motto is deliver assignment on Time. Our Expert writers deliver quality assignments to the students.

##### Plagiarism Free Work

Get reliable and unique assignments by using our 100% plagiarism-free.

##### 24 X 7 Live Help

Get connected 24*7 with our Live Chat support executives to receive instant solutions for your assignment.

##### Services For All Subjects

Get Help with all the subjects like: Programming, Accounting, Finance, Engineering, Law and Marketing.

##### Best Price Guarantee

Get premium service at a pocket-friendly rate at AssignmentHippo

#### Client Review

I was struggling so hard to complete my marketing assignment on brand development when I decided to finally reach to the experts of this portal. They certainly deliver perfect consistency and the desired format. The content prepared by the experts of this platform was simply amazing. I definitely owe my grades to them.