Visual Basic Questions and Answers – Concatenating Strings, InputBox Function and toString Method

This set of Visual Basic Interview Questions and Answers for freshers focuses on “Concatenating Strings, InputBox Function and toString Method”.

1. The __________ is used to concat to Strings.
a) Concatenation operator
b) + symbol
c) Concat function
d) Cat function
View Answer

Answer: a
Explanation: The concatenation operator is used to concat or join two strings which is the &. While concatenating two strings, you must make sure that there is a space before and after the ampersand, otherwise, the code editor will not recognize the & as the concatenation operator.

2. Specifying the number of decimal places and special characters to display in a number is called as __________
a) Including
b) Formatting
c) Emphasizing
d) Promoting
View Answer

Answer: b
Explanation: Numbers representing monetary amounts are displayed with either zero or two decimal places and may include a $ sign. Similarly, numbers representing percentage amounts are displayed with zero or more decimal places and a % sign. Specifying the number of decimal places and special characters to display in a number is called formatting.

3. __________ function is used to format numbers.
a) toString
b) toNumber
c) toFormat
d) toSpecify
View Answer

Answer: a
Explanation: The toString function can be used to format numbers in any of the languages built into Visual Studio. The toString method’s syntax is numericVariableName.toString(formatString). The numericVariableName is the name of the numeric variable.
advertisement
advertisement

4. The toString method formats the number stored in the numeric value and then returns the result as a __________
a) Integer
b) Double
c) Character
d) String
View Answer

Answer: d
Explanation: The toString method formats the number stored in the numeric value and then returns the result as a string. Specifying the number of decimal places and special characters to display in a number is called formatting.

5. __________ in the syntax gives the format you want to use.
a) formatString
b) format
c) numericVariableName
d) toString
View Answer

Answer: a
Explanation: The formatString argument in the syntax gives the format you want to use. The formatString argument must take the form “Axx” where A is the alphabetic character called the format specifier and “xx” is the sequence of digits called the precision specifier. The format specifier must be one of the built-in format characters.
Note: Join free Sanfoundry classes at Telegram or Youtube

6. __________ displays an input dialog box containing a message, Ok and Cancel button and an input area.
a) Inputbox function
b) Inbox function
c) Dialogbox function
d) In function
View Answer

Answer: a
Explanation: Inputbox function displays an input dialog box containing a message, Ok and Cancel button and an input area where the user can input information. The message in the inputbox should prompt the user to enter the appropriate information in the user area.

7. __________ is an underscore that is immediately preceded by a space and is located at the end of the physical line of code.
a) Underscore
b) Hyphen
c) Line continuation character
d) Line termination character
View Answer

Answer: c
Explanation: Line continuation character is an underscore that is immediately preceded by a space and is located at the end of the physical line of code. It is used to split a long instruction into two or more physical lines in the Code Editor Window.
advertisement

8. The InputBox functions prompt argument should be entered using __________
a) Book title capitalization
b) Sentence capitalization
c) Text capitalization
d) Post capitalization
View Answer

Answer: b
Explanation: Sentence Capitalization is used for prompt, whereas book capitalization is used for the title. The capitalization (if any) you use for the defaultResponse depends on the text itself. In most case, you enter the value return by an Inputbox function to a string variable.

9. The value returned by the Inputbox depends on the __________ the user chooses.
a) Button
b) Message
c) Property
d) Return type
View Answer

Answer: a
Explanation: The value returned by the Inputbox depends on the button the user chooses. If the user chooses the Ok button, the inputBox function returns the value contained in the input area of the dialog box; the return value is always treated as a string. If the user clicks the Cancel button or the Close button in the title bar, the InputBox function returns an empty String.
advertisement

10. The __________ argument contains the message to display inside the dialog box.
a) defaultResponse
b) prompt
c) title
d) message
View Answer

Answer: b
Explanation: The prompt argument contains the message to display inside the dialog box. The option title and defaultResponse argument control the text that appears in the dialog box’s title bar and input area, respectively. If you omit the title argument, the project name appears in the title bar.

Sanfoundry Global Education & Learning Series – Visual Basic.

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

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). 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!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.