Deck 3: Variables and Calculations

ملء الشاشة (f)
exit full mode
سؤال
Only controls capable of receiving some sort of input, such as __, may have the focus.

A) labels
B) text boxes
C) buttons
D) text boxes and buttons
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
It's possible to view the order in which all controls on a form will receive the focus by .

A) clicking TabOrder in the Properties window
B) pressing the Esc key
C) clicking VIEW on the menu bar and then Tab Order
D) all of the above
سؤال
In order to execute code before a form is displayed, place the code in the form's _event handler.

A) SetUp
B) Load
C) Focus
D) Initialize
سؤال
All numeric and date data types have a _method that returns a string representation of the contents of the variable.

A) Convert
B) String
C) ToString
D) ToText
سؤال
You can break up a long statement into multiple lines as long as you don't break up a .

A) keyword
B) quoted string
C) variable name
D) all of the above
سؤال
The value returned by passing #12/31/10# to the CSng function is__

A) 12/31/2010
B) 123,110
C) 0
D) No value is returned. A runtime error is generated.
سؤال
Which of the following statements will assign the contents of the Text property of a TextBox control named txtInput into the Text property of a Label control named lblDisplay?

A) txtInput = lblDisplay
B) txtInput.Text = lblDisplay.Text
C) lblDisplay = txtInput
D) lblDisplay.Text = txtInput.Text
سؤال
The control is used to gather input the user has typed at the keyboard.

A) Label
B) Button
C) TextBox
D) ListBox
سؤال
A Date literal can contain ___.

A) a date
B) a time
C) a floating-point value
D) both a date and a time
سؤال
All of the following are advantages of using named constants except

A) they can be used in the place of keywords.
B) it is easier to make a consistent change throughout a program.
C) they help make the program more self documenting.
D) they're useful for common values such as pi.
سؤال
The statement to declare strName as a variable that can hold character data is .

A) Dim strName As Text
B) Dim strName As Single
C) Dim strName As Word
D) Dim strName As String
سؤال
What is the result after evaluating the following expression: 24 MOD 9

A) 6
B) 3
C) 2
D) 5
سؤال
The contents of a text box may be cleared in Visual Basic code by .

A) by assigning the predefined constant String.Empty to the text property
B) by setting the focus on the control and using the delete key
C) by setting the focus on the control and using the back space key
D) by clicking the clear button
سؤال
The operator performs string concatenation.

A) ampersand &)
B) dollar sign $)
C) percent symbol %)
D) pound symbol #)
سؤال
A keyboard access key is assigned to a button using the button control's _property.

A) ShortCut
B) Text
C) AccessKey
D) Alt
سؤال
What will be assigned to the label when the following statements execute? Dim dblVal As Double = 11.75
LblResult.Text = dblVal.ToString"n3")

A) $11.75
B) 11.75
C) 11.750
D) 12
سؤال
When you assign a value of one data type to a variable of another data type, Visual Basic attempts to perform type conversion.

A) string
B) explicit
C) implicit
D) numeric
سؤال
If you want to display multiple lines of information in a message box, use the constant .

A) ControlChars.CrLf
B) strNEW_LINE
C) CARRAGE_RETURN_LINE_FEED
D) vbReturn
سؤال
The order in which controls receive the focus is called the .

A) control order
B) tab order
C) sequence order
D) focus order
سؤال
You can perform all of the following actions with variables except:

A) Copy and store values entered by the user, so they may be manipulated
B) Assign a variable's value to a constant
C) Perform arithmetic on values
D) Remember information for later use in the program
سؤال
Which statement is true regarding the CInt function?

A) It converts letters to numbers.
B) It cannot convert a string such as "24.7" to an integer.
C) A floating-point number such as 24.7 is converted to 24, dropping its decimal positions.
D) A floating-point number such as 24.7 is converted to 25, rounding its decimal positions.
سؤال
Which of the following declares a variable named intIndex that will be used to store whole numbers?

A) Dim intIndex As WholeNumber
B) Dim intIndex As String
C) Dim Integer As intIndex
D) Dim intIndex As Integer
سؤال
Variables declared within a button's click-event are ___variables.

A) local
B) String
C) global
D) private
سؤال
When you declare a constant, you must assign it an initial value.
سؤال
A Boolean type variable can hold only one of two possible values: ___.

A) True or False
B) 0 or 1
C) A or B
D) -1 or 1
سؤال
Which will be displayed in the label lblResult following execution of the code below? Dim dblGrossPay as Double
DblGrossPay = 3500
LblResult.Text = dblGrossPay.ToString"c")

A) 3500.00
B) 3500
C) $3500.00
D) $3,500.00
سؤال
A form's Load event takes place when the user first clicks on the form at run time.
سؤال
Which of the following is not a valid Visual Basic data type?

A) Integer
B) Number
C) Decimal
D) Short
سؤال
Which of the following declares an Integer variable named intLength and assigns it the integer literal 12?

A) Dim intLength As Integer initialize to 12
B) Dim intLength = 12 As Integer
C) Dim intLength As Integer = 12
D) Dim intLength As Integer 12
سؤال
Identify the error in the following code: Private Sub btnCalculate_ClickByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnCalculate.Click
' Declare some variables
Dim sngNumber1 As Single
Dim sngNumber2 As Single
Dim sngSum As Single
' Get the two numbers
SngNumber1 = txtNumber1.Text
SngNumber2 = txtNumber2.Text
' Calculate their sngSum... is the next line working?
SngSum = sngNumber1 + sngNumber2
' Display the result
LblSum.Text = sngSum.ToString
End Sub

A) A local variable is misplaced.
B) A conversion function such as CSng was not used.
C) The variable name sngNumberl was misspelled.
D) The variable sngSum was declared as the wrong data type.
سؤال
Which of the following declares a variable that can store the first name of a student?

A) Dim strFirstName as Char
B) Dim strFirstName as Short
C) Dim strFirstName as Long
D) Dim strFirstName as String
سؤال
What is the value of intE after the following statements execute? Dim intC As Integer
Dim intD As Integer
Dim intE As Integer
IntC = 20
IntD = 3
IntE = intC \ intD

A) 7
B) 6
C) 6.666667
D) 0
سؤال
Declaration statements ____.

A) are only used for variables and are not needed for constants
B) are only allowed in the Declarations section of a form
C) give a name to variables or constants and specify the type of data they will hold
D) both answers B and C are correct
سؤال
A variable is a storage location on a computer's hard drive that holds information while the computer is off.
سؤال
Which of the following has the highest order of precedence in arithmetic expressions?

A) Multiplication and division
B) Addition and subtraction
C) Exponentiation the ^ operator)
D) None of the above; calculations are always evaluated from left to right.
سؤال
Which of the following is False in regard to naming variables?

A) Names may contain underscores.
B) Names may contain letters.
C) Names may contain digits.
D) Names may contain spaces.
سؤال
What is the purpose of using the following type of structure? Try
Some statements
Catch
Other Statements
End Try

A) To try different types of commands to see which will give you the correct answer.
B) In order to catch run-time errors such as divide-by-zero and not have the program shut down.
C) This is not a valid structure.
D) To use for temporary debugging and remove later when the program functions properly.
سؤال
When included in the Text property of a button, the && symbols placed side by side will display as a single & character.
سؤال
What is the value of dblOutcome after the following section of code executes? Dim dblA as Double
Dim dblB as Double
Dim dblC as Double
Dim dblOutcome as Double
DblA = 45
DblB = 30
DblC = 3 * dblA / dblB
DblOutcome = 2 * dblC + 15)

A) 39
B) 24
C) 0
D) 80
سؤال
What will be the value of intAnswer after execution of these statements? Const intNumA As Integer = 6
Const intNumB As Integer = 2
IntAnswer = intNumA / intNumB + intNumA * intNumB

A) 12
B) 15
C) 16
D) 18
سؤال
A class-level variable ____.

A) is declared inside a class but outside any procedure
B) is accessible to all procedures in a class
C) is visible to all statements inside the class
D) all of the above
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/41
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 3: Variables and Calculations
1
Only controls capable of receiving some sort of input, such as __, may have the focus.

A) labels
B) text boxes
C) buttons
D) text boxes and buttons
D
2
It's possible to view the order in which all controls on a form will receive the focus by .

A) clicking TabOrder in the Properties window
B) pressing the Esc key
C) clicking VIEW on the menu bar and then Tab Order
D) all of the above
C
3
In order to execute code before a form is displayed, place the code in the form's _event handler.

A) SetUp
B) Load
C) Focus
D) Initialize
B
4
All numeric and date data types have a _method that returns a string representation of the contents of the variable.

A) Convert
B) String
C) ToString
D) ToText
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
5
You can break up a long statement into multiple lines as long as you don't break up a .

A) keyword
B) quoted string
C) variable name
D) all of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
6
The value returned by passing #12/31/10# to the CSng function is__

A) 12/31/2010
B) 123,110
C) 0
D) No value is returned. A runtime error is generated.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
7
Which of the following statements will assign the contents of the Text property of a TextBox control named txtInput into the Text property of a Label control named lblDisplay?

A) txtInput = lblDisplay
B) txtInput.Text = lblDisplay.Text
C) lblDisplay = txtInput
D) lblDisplay.Text = txtInput.Text
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
8
The control is used to gather input the user has typed at the keyboard.

A) Label
B) Button
C) TextBox
D) ListBox
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
9
A Date literal can contain ___.

A) a date
B) a time
C) a floating-point value
D) both a date and a time
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
10
All of the following are advantages of using named constants except

A) they can be used in the place of keywords.
B) it is easier to make a consistent change throughout a program.
C) they help make the program more self documenting.
D) they're useful for common values such as pi.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
11
The statement to declare strName as a variable that can hold character data is .

A) Dim strName As Text
B) Dim strName As Single
C) Dim strName As Word
D) Dim strName As String
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
12
What is the result after evaluating the following expression: 24 MOD 9

A) 6
B) 3
C) 2
D) 5
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
13
The contents of a text box may be cleared in Visual Basic code by .

A) by assigning the predefined constant String.Empty to the text property
B) by setting the focus on the control and using the delete key
C) by setting the focus on the control and using the back space key
D) by clicking the clear button
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
14
The operator performs string concatenation.

A) ampersand &)
B) dollar sign $)
C) percent symbol %)
D) pound symbol #)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
15
A keyboard access key is assigned to a button using the button control's _property.

A) ShortCut
B) Text
C) AccessKey
D) Alt
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
16
What will be assigned to the label when the following statements execute? Dim dblVal As Double = 11.75
LblResult.Text = dblVal.ToString"n3")

A) $11.75
B) 11.75
C) 11.750
D) 12
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
17
When you assign a value of one data type to a variable of another data type, Visual Basic attempts to perform type conversion.

A) string
B) explicit
C) implicit
D) numeric
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
18
If you want to display multiple lines of information in a message box, use the constant .

A) ControlChars.CrLf
B) strNEW_LINE
C) CARRAGE_RETURN_LINE_FEED
D) vbReturn
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
19
The order in which controls receive the focus is called the .

A) control order
B) tab order
C) sequence order
D) focus order
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
20
You can perform all of the following actions with variables except:

A) Copy and store values entered by the user, so they may be manipulated
B) Assign a variable's value to a constant
C) Perform arithmetic on values
D) Remember information for later use in the program
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
21
Which statement is true regarding the CInt function?

A) It converts letters to numbers.
B) It cannot convert a string such as "24.7" to an integer.
C) A floating-point number such as 24.7 is converted to 24, dropping its decimal positions.
D) A floating-point number such as 24.7 is converted to 25, rounding its decimal positions.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
22
Which of the following declares a variable named intIndex that will be used to store whole numbers?

A) Dim intIndex As WholeNumber
B) Dim intIndex As String
C) Dim Integer As intIndex
D) Dim intIndex As Integer
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
23
Variables declared within a button's click-event are ___variables.

A) local
B) String
C) global
D) private
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
24
When you declare a constant, you must assign it an initial value.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
25
A Boolean type variable can hold only one of two possible values: ___.

A) True or False
B) 0 or 1
C) A or B
D) -1 or 1
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
26
Which will be displayed in the label lblResult following execution of the code below? Dim dblGrossPay as Double
DblGrossPay = 3500
LblResult.Text = dblGrossPay.ToString"c")

A) 3500.00
B) 3500
C) $3500.00
D) $3,500.00
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
27
A form's Load event takes place when the user first clicks on the form at run time.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
28
Which of the following is not a valid Visual Basic data type?

A) Integer
B) Number
C) Decimal
D) Short
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
29
Which of the following declares an Integer variable named intLength and assigns it the integer literal 12?

A) Dim intLength As Integer initialize to 12
B) Dim intLength = 12 As Integer
C) Dim intLength As Integer = 12
D) Dim intLength As Integer 12
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
30
Identify the error in the following code: Private Sub btnCalculate_ClickByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnCalculate.Click
' Declare some variables
Dim sngNumber1 As Single
Dim sngNumber2 As Single
Dim sngSum As Single
' Get the two numbers
SngNumber1 = txtNumber1.Text
SngNumber2 = txtNumber2.Text
' Calculate their sngSum... is the next line working?
SngSum = sngNumber1 + sngNumber2
' Display the result
LblSum.Text = sngSum.ToString
End Sub

A) A local variable is misplaced.
B) A conversion function such as CSng was not used.
C) The variable name sngNumberl was misspelled.
D) The variable sngSum was declared as the wrong data type.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
31
Which of the following declares a variable that can store the first name of a student?

A) Dim strFirstName as Char
B) Dim strFirstName as Short
C) Dim strFirstName as Long
D) Dim strFirstName as String
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
32
What is the value of intE after the following statements execute? Dim intC As Integer
Dim intD As Integer
Dim intE As Integer
IntC = 20
IntD = 3
IntE = intC \ intD

A) 7
B) 6
C) 6.666667
D) 0
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
33
Declaration statements ____.

A) are only used for variables and are not needed for constants
B) are only allowed in the Declarations section of a form
C) give a name to variables or constants and specify the type of data they will hold
D) both answers B and C are correct
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
34
A variable is a storage location on a computer's hard drive that holds information while the computer is off.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
35
Which of the following has the highest order of precedence in arithmetic expressions?

A) Multiplication and division
B) Addition and subtraction
C) Exponentiation the ^ operator)
D) None of the above; calculations are always evaluated from left to right.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
36
Which of the following is False in regard to naming variables?

A) Names may contain underscores.
B) Names may contain letters.
C) Names may contain digits.
D) Names may contain spaces.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
37
What is the purpose of using the following type of structure? Try
Some statements
Catch
Other Statements
End Try

A) To try different types of commands to see which will give you the correct answer.
B) In order to catch run-time errors such as divide-by-zero and not have the program shut down.
C) This is not a valid structure.
D) To use for temporary debugging and remove later when the program functions properly.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
38
When included in the Text property of a button, the && symbols placed side by side will display as a single & character.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
39
What is the value of dblOutcome after the following section of code executes? Dim dblA as Double
Dim dblB as Double
Dim dblC as Double
Dim dblOutcome as Double
DblA = 45
DblB = 30
DblC = 3 * dblA / dblB
DblOutcome = 2 * dblC + 15)

A) 39
B) 24
C) 0
D) 80
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
40
What will be the value of intAnswer after execution of these statements? Const intNumA As Integer = 6
Const intNumB As Integer = 2
IntAnswer = intNumA / intNumB + intNumA * intNumB

A) 12
B) 15
C) 16
D) 18
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
41
A class-level variable ____.

A) is declared inside a class but outside any procedure
B) is accessible to all procedures in a class
C) is visible to all statements inside the class
D) all of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.