Visual Basic Questions and Answers – Repetition Structure – Counters and Accumulators

«
»

This set of Visual Basic Multiple Choice Questions & Answers (MCQs) focuses on “Repetition Structure – Counters and Accumulators”.

1. ______________ is a numeric variable used for counting something.
a) Accumulator
b) Counter
c) Positive
d) Negative
View Answer

Answer: b
Explanation: Counter is a numeric value used for counting something and accumulator is a valued used for accumulating something, such as adding, such as total amount of a month earned by a person etc.
advertisement

2. ______________ is a numeric variable used for accumulating something.
a) Accumulator
b) Counter
c) Positive
d) Negative
View Answer

Answer: b
Explanation: Counter is a numeric value used for counting something and accumulator is a valued used for accumulating something, such as adding, such as total amount of a month earned by a person etc.

3. ______________means to assign a beginning value to the counter or accumulator.
a) Initializing
b) Updating
c) Incrementing
d) Checking
View Answer

Answer: a
Explanation: Initializing means to assign a beginning value to the counter or accumulator. Typically, counters and accumulators are initialized to the number 0. However, they can be initialized to any number, depending on the value required by the procedure.

4. _______________ means adding a number to the value stored in the accumulator or counter.
a) Initializing
b) Updating
c) Backtracking
d) Checking
View Answer

Answer: b
Explanation: Updating often referred to as incrementing, means adding a number to the value stored in the counter or accumulator. The number can be either positive or negative, integer or non-integer. A counter is always updated by a constant value—typically the number 1—whereas an accumulator is updated by a value that varies.

5. When a checkbox’s ____________ property is set to true, it can both accept and display multiple lines of text.
a) Multiline Property
b) ReadOnly Property
c) ReadWrite Property
d) ScrollBars Property
View Answer

Answer: a
Explanation: When a text box’s Multiline property is set to True, the text box can both accept and display multiple lines of text; otherwise, only one line of text can be entered in the text box, that is when the property is set to false, it can only accept and display one line of text.
advertisement

6. Text box’s ReadOnly Property is set to ______________ by default.
a) True
b) False
View Answer

Answer: b
Explanation: Text box’s ReadOnly property is set to false by default. Changing a text box’s ReadOnly property from its default value (False) to True prevents the user from changing the contents of the text box during run time.

7. A text box’s _____________ property specifies whether the text box has scroll bar.
a) Multiline Property
b) ReadOnly Property
c) ReadWrite Property
d) ScrollBars Property
View Answer

Answer: d
Explanation: A text box’s ScrollBars property specifies whether the text box has scroll bar. A text box’s ScrollBars property specifies whether the text box has no scroll bars (the default), a horizontal scroll bar, a vertical scroll bar, or both horizontal and vertical scroll bars.

8. The instruction above the loop is known as the ______________
a) Priming read
b) After read
c) Before read
d) Reading
View Answer

Answer: a
Explanation: The instruction above the loop is referred to as the priming read, because it is used to prime (prepare or set up) the loop. The priming read initializes the loop condition by providing its first value.

9. The instruction in the loop body is referred to as ______________
a) Priming read
b) After read
c) Before read
d) Update read
View Answer

Answer: d
Explanation: The instruction in the loop body is referred to as the update read, because it allows the user to update the value of the input item (in this case, the sales amount) that controls the loop’s condition. The update read is often an exact copy of the priming read. Keep in mind that if you don’t include the update read in the loop body, there will be no way to enter a value that will stop the loop after it has been processed the first time. This is because the priming read is processed only once.
advertisement

10. The _______________ allows you to abbreviate an assignment statement.
a) Arithmetic assignment operator
b) Shorthand operator
c) Long operator
d) Predefined operator
View Answer

Answer: a
Explanation: The arithmetic assignment operators allow you to abbreviate an assignment statement that contains an arithmetic operator, as long as the assignment statement has the following format, in which variableName is the name of the same variable: variableName = variableName arithmeticOperator value. For example, you can use the addition assignment operator (+=) to abbreviate the statement intAge = intAge + 1 as follows: intAge += 1. Both statements tell the computer to add the number 1 to the contents of the intAge variable and then store the result in the intAge variable.

Sanfoundry Global Education & Learning Series – Visual Basic.

To practice all areas of Visual Basic, here is complete set of 1000+ Multiple Choice Questions and Answers.

Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

advertisement
advertisement
advertisement
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer & SAN Architect and is passionate about competency developments in these areas. He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux Debugging, Linux Device Drivers, Linux Networking, Linux Storage, Advanced C Programming, SAN Storage Technologies, SCSI Internals & Storage Protocols such as iSCSI & Fiber Channel. Stay connected with him @ LinkedIn