Deck 3: Variables, Constants, and Calculations
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/58
العب
ملء الشاشة (f)
Deck 3: Variables, Constants, and Calculations
1
The Parse method and exception handling can be used to eliminate the problems encountered when the user does not enter a value into a field.
True
2
Variables that are declared in the Declarations section of a form module are available to all procedures in the form.
True
3
Numeric constants may contain only the digits ( 0 - 9 ),a decimal point,and a sign ( + or - )at the left side.
True
4
Assume that a variable is declared in the Declarations section of a form and named TOTAL_PAY_Decimal.This variable,TOTAL_PAY_Decimal,will be visible to all procedures in that form even though the programmer did not follow the naming conventions in the textbook and name the variable TotalPayDecimal.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
5
It is a good idea to set Option Strict On,in the Visual Basic environment in order to detect misspelled variable names when the project is run.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
6
GrandTotalDecimal is a valid variable name.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
7
Data whose value may not be changed during the execution of a project is referred to as a constant.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
8
A constant contains data whose value may be changed during the execution of a project.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
9
A variable named SalesTotalDecimal that is declared in the CalculateButton_Click event procedure can be used in any procedure of the form.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
10
When Option Explicit is turned on,you can use any variable name without first declaring it.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
11
A numeric variable that is declared with the Dim statement in a local procedure is initialized to zero each time the procedure is called.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
12
Constants can store string or numeric values.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
13
A variable that will store totals and that will be available to all procedures in the form must be declared as a constant.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
14
SCHOOL_NAME_String is in the correct format for a constant that holds the name of your school.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
15
If you are declaring a variable that will be used in calculations,you may use the string data type.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
16
When naming a constant,you should use uppercase characters in the name with an underscore between the words and the data type at the end of the name.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
17
Although it is best to always declare the data type on a Dim statement,the data type is optional.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
18
When using the format specifier codes,you can specify the number of digits to appear to the right of the decimal point.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
19
Variables that are declared inside a procedure can be used as counters and accumulators.(Ignore Static variables. )
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
20
Calculations may be performed with variables.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
21
Which of the following is NOT a rule for naming identifiers for constants?
A)Include the data type at the end of the identifier.
B)Everything in the identifier's name should be capitalized except the data type.
C)Identifiers for constants should begin with a prefix of Const.
D)Identifiers for constants should use an underscore between words.
A)Include the data type at the end of the identifier.
B)Everything in the identifier's name should be capitalized except the data type.
C)Identifiers for constants should begin with a prefix of Const.
D)Identifiers for constants should use an underscore between words.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
22
A _______ variable is declared inside a procedure.
A)namespace
B)module-level
C)local
D)block
A)namespace
B)module-level
C)local
D)block
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
23
Message boxes can be used to notify the user if input data is not a reasonable value.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
24
The data type that is used for decimal fractions is _______.
A)Decimal
B)Short
C)Integer
D)Fraction
A)Decimal
B)Short
C)Integer
D)Fraction
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
25
Which of the following is NOT a rule for naming identifiers?
A)Identifiers for constants should use an underscore between words.
B)Identifiers should use periods to separate words.
C)Identifiers should list the data type at the end of the name.
D)Identifiers cannot contain embedded blanks.
A)Identifiers for constants should use an underscore between words.
B)Identifiers should use periods to separate words.
C)Identifiers should list the data type at the end of the name.
D)Identifiers cannot contain embedded blanks.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
26
When you declare a variable or a named constant,Visual Basic reserves an area of memory and assigns it a name called a(n)_______.
A)identifier
B)identity
C)declaration
D)dimension
A)identifier
B)identity
C)declaration
D)dimension
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
27
Message boxes can contain buttons.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
28
The reserved Visual Basic word,Dim,is short for dimension,which means _______.
A)declaration
B)size
C)storage location
D)identifier
A)declaration
B)size
C)storage location
D)identifier
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
29
Where should the statement: Dim CounterInteger As Integer appear if you plan to use CounterInteger in only one event procedure?
A)The Declarations section of the form
B)The Form_Load procedure
C)The event procedure where CounterInteger will be used
D)The Namespace Constants file
A)The Declarations section of the form
B)The Form_Load procedure
C)The event procedure where CounterInteger will be used
D)The Namespace Constants file
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
30
Intrinsic constants are _______.
A)declared using the keyword Const
B)declared using the keyword Dim
C)placed in the Declarations section of a form
D)built into Visual Studio
A)declared using the keyword Const
B)declared using the keyword Dim
C)placed in the Declarations section of a form
D)built into Visual Studio
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
31
Which of the following is a valid statement that can be used to declare a local variable that will store whole numbers?
A)Dim IndexWhole as Whole
B)Dim IndexString as String
C)Dim IntegerIndex as Index
D)Dim IndexInteger as Integer
A)Dim IndexWhole as Whole
B)Dim IndexString as String
C)Dim IntegerIndex as Index
D)Dim IndexInteger as Integer
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
32
Variables declared within a button's click-event are _____ variables.
A)local
B)module-level
C)namespace
D)private
A)local
B)module-level
C)namespace
D)private
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
33
Which of the following does not follow the conventions for naming identifiers?
A)UnitsEnrolledDecimal
B)ZipCodeString
C)Amount.Due.Decimal
D)COUNTRY_OF_BIRTH_String
A)UnitsEnrolledDecimal
B)ZipCodeString
C)Amount.Due.Decimal
D)COUNTRY_OF_BIRTH_String
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
34
If Option Strict is turned off and a declaration statement does not specify a data type,it will default to _______.
A)boolean
B)string
C)object
D)variable
A)boolean
B)string
C)object
D)variable
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
35
Which of the following is NOT a valid rule for naming identifiers?
A)Names may contain underscores.
B)Names may contain letters.
C)Names may contain digits.
D)Names may contain spaces.
A)Names may contain underscores.
B)Names may contain letters.
C)Names may contain digits.
D)Names may contain spaces.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
36
Which of the following is NOT a valid Visual Basic data type?
A)Integer
B)Real
C)Decimal
D)String
A)Integer
B)Real
C)Decimal
D)String
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
37
Where should the statement: Const ACCOUNT_NUMBER_String As String = "A45" appear if you plan to use ACCOUNT_NUMBER_String in more than one procedure?
A)The Declarations section of the form
B)The Form_Load procedure
C)The event procedure where ACCOUNT_NUMBER_String will be used
D)The Namespace Constants file
A)The Declarations section of the form
B)The Form_Load procedure
C)The event procedure where ACCOUNT_NUMBER_String will be used
D)The Namespace Constants file
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
38
The length of identifiers is limited to _______.
A)1 to 8 characters
B)1 to 256 characters
C)1 to 4,000 characters
D)1 to 16,383 characters
A)1 to 8 characters
B)1 to 256 characters
C)1 to 4,000 characters
D)1 to 16,383 characters
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
39
Declaration statements _______.
A)can only be written inside a procedure
B)are only allowed in the Declarations section of a form
C)give variables and constants names,and specify the type of data they will hold
D)are not needed for constants
A)can only be written inside a procedure
B)are only allowed in the Declarations section of a form
C)give variables and constants names,and specify the type of data they will hold
D)are not needed for constants
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
40
Which of the following is a valid statement that can be used to declare a local variable that will store fractions?
A)Dim IndexFraction As Fraction
B)Dim IndexString As String
C)Dim IndexDecimal As Decimal
D)Dim IndexInteger As Integer
A)Dim IndexFraction As Fraction
B)Dim IndexString As String
C)Dim IndexDecimal As Decimal
D)Dim IndexInteger As Integer
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
41
To trap or catch exceptions,use a _______ block and enclose any statement(s)that might cause an error.
A)With \ End With
B)Try \ Catch
C)For \ Next
D)TheException
A)With \ End With
B)Try \ Catch
C)For \ Next
D)TheException
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
42
Using the order of precedence and the formula below,what is AnswerInteger if?: NumberOneInteger = 2,NumberTwoInteger = 12,NumberThreeInteger = 20,and NumberFourInteger = 6
AnswerInteger = NumberOneInteger * (NumberTwoInteger + NumberThreeInteger)- NumberFourInteger / NumberOneInteger
A)19
B)41
C)61
D)None of these
AnswerInteger = NumberOneInteger * (NumberTwoInteger + NumberThreeInteger)- NumberFourInteger / NumberOneInteger
A)19
B)41
C)61
D)None of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
43
If a procedure contains a Dim statement and NameString is assigned as the identifier,NameString can be used _______.
A)anywhere in the project
B)only in the procedure where the Dim statement is shown
C)anywhere in the project if the variable name is changed to NAME_String
D)only once in the procedure
A)anywhere in the project
B)only in the procedure where the Dim statement is shown
C)anywhere in the project if the variable name is changed to NAME_String
D)only once in the procedure
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
44
Which of the following is the correct code that will display the value in TotalSalesDecimal with a percent sign and 2 decimals?
A)TotalSalesDecimal(2)
B)TotalSalesPercent(2)
C)TotalSalesDecimal.ToString("P2")
D)TotalSalesDecimal.ToString(%2)
A)TotalSalesDecimal(2)
B)TotalSalesPercent(2)
C)TotalSalesDecimal.ToString("P2")
D)TotalSalesDecimal.ToString(%2)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
45
A variable that is declared in the Declarations section of a form is a(n)_______.
A)module-level variable
B)local variable
C)block variable
D)general variable
A)module-level variable
B)local variable
C)block variable
D)general variable
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
46
What will be the value of AnswerInteger after execution of the following line of code? Assume that NumberAInteger = 6,NumberBInteger = 4,NumberCInteger = 2
AnswerInteger = (NumberAInteger + NumberBInteger)* (NumberAInteger / NumberCInteger)
A)6
B)30
C)27
D)None of these
AnswerInteger = (NumberAInteger + NumberBInteger)* (NumberAInteger / NumberCInteger)
A)6
B)30
C)27
D)None of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
47
Which of the following is NOT a valid method for parsing?
A)Integer.Parse
B)Decimal.Parse
C)Parse.String
D)All of these are valid
A)Integer.Parse
B)Decimal.Parse
C)Parse.String
D)All of these are valid
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
48
MessageBox.Show("Hello","Goodbye")will display _______.
A)"Hello" in the message box titlebar and "Goodbye" in the body of the message box
B)"Goodbye" in the body of the message box;"Hello" in the project's title bar
C)"Goodbye" in the message box titlebar and "Hello" in the body of the message box
D)None of these
A)"Hello" in the message box titlebar and "Goodbye" in the body of the message box
B)"Goodbye" in the body of the message box;"Hello" in the project's title bar
C)"Goodbye" in the message box titlebar and "Hello" in the body of the message box
D)None of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
49
You can use the _______method to round decimal values to the desired number of decimal positions.
A)ToDecimal
B)ToSingle
C)ToRound
D)Round
A)ToDecimal
B)ToSingle
C)ToRound
D)Round
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
50
The Visual Basic statement that requires all variables to be declared is _______.
A)Dim
B)Option Strict On
C)Option Explicit On
D)Declarations
A)Dim
B)Option Strict On
C)Option Explicit On
D)Declarations
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
51
What will be the value of TotalInteger after execution of this statement? Assume that ValueInteger = 2.
TotalInteger = ((ValueInteger + 2)* (ValueInteger + 4))/ ValueInteger + 1
A)13
B)8
C)12
D)None of these
TotalInteger = ((ValueInteger + 2)* (ValueInteger + 4))/ ValueInteger + 1
A)13
B)8
C)12
D)None of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
52
What statement should be used to declare a variable that is accessible from all procedures of a form?
A)Dim
B)Const
C)Private
D)Public
A)Dim
B)Const
C)Private
D)Public
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
53
What will be the value of AnswerInteger after execution of these statements? Const NumberAInteger as Integer = 6
Const NumberBInteger as Integer = 4
Const NumberCInteger as Integer = 2
AnswerInteger = NumberAInteger + NumberBInteger * NumberCInteger
A)6
B)14
C)20
D)48
Const NumberBInteger as Integer = 4
Const NumberCInteger as Integer = 2
AnswerInteger = NumberAInteger + NumberBInteger * NumberCInteger
A)6
B)14
C)20
D)48
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
54
Explain how you would decide which data type to use when declaring variables and constants.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
55
In order to control the number of decimals that will appear when a number is displayed,you can use _______.
A)a conversion function
B)a string variable
C)a constant
D)the format specifier codes
A)a conversion function
B)a string variable
C)a constant
D)the format specifier codes
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
56
Which of the following has the highest order of precedence in arithmetic expressions?
A)Multiplication and division
B)Addition and subtraction
C)Exponentiation
D)Operators are not significant;all calculations are evaluated from left to right.
A)Multiplication and division
B)Addition and subtraction
C)Exponentiation
D)Operators are not significant;all calculations are evaluated from left to right.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
57
Integer.Parse is used to _______.
A)convert data in a textbox to a numeric value with no decimal places
B)properly align decimal positions in a numeric value
C)add a dollar sign ($)to improve the way the output looks
D)convert data in a textbox to a numeric value with 2 decimal places
A)convert data in a textbox to a numeric value with no decimal places
B)properly align decimal positions in a numeric value
C)add a dollar sign ($)to improve the way the output looks
D)convert data in a textbox to a numeric value with 2 decimal places
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
58
Write code using nested Try/Catch blocks where you will store data from text boxes named QuantityTextBox and PriceTextBox into variables named QuantityInteger and PriceDecimal.Handle any exceptions by displaying a message in a message box if the text boxes do not contain valid data.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck