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

1.

The __________ is used to concat to Strings.

   A.) Concatenation operator
   B.) Concat function
   C.) Cat function
   D.) + symbol

Answer: Option 'A'

Concatenation operator

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.

DigitalOcean Referral Badge

2.

Specifying the number of decimal places and special characters to display in a number is called as __________

   A.) Including
   B.) Formatting
   C.) Promoting
   D.) Emphasizing

Answer: Option 'B'

Formatting

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.

DigitalOcean Referral Badge

3.

_________ function is used to format numbers.

   A.) toString
   B.) toSpecify
   C.) toNumber
   D.) toFormat

Answer: Option 'A'

toString

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.

DigitalOcean Referral Badge

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

Answer: Option 'D'

String

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.

DigitalOcean Referral Badge

5.

__________ in the syntax gives the format you want to use.

   A.) formatString
   B.) numericVariableName
   C.) toString
   D.) format

Answer: Option 'A'

formatString

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.

DigitalOcean Referral Badge

6.

________ displays an input dialog box containing a message, Ok and Cancel button and an input area.

   A.) Inputbox function
   B.) Dialogbox function
   C.) In function
   D.) Inbox function

Answer: Option 'A'

 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.

DigitalOcean Referral Badge

7.

_________ is an underscore that is immediately preceded by a space and is located at the end of the physical line of code.

   A.) Hyphen
   B.) Line continuation character
   C.) Underscore
   D.) Line termination character

Answer: Option 'B'

Line continuation character

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.

DigitalOcean Referral Badge

8.

The InputBox functions prompt argument should be entered using __________

   A.) Book title capitalization
   B.) Post capitalization
   C.) Text capitalization
   D.) Sentence capitalization

Answer: Option 'D'

Sentence capitalization

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.

DigitalOcean Referral Badge

9.

The value returned by the Inputbox depends on the __________ the user chooses.

   A.) Return type
   B.) Property
   C.) Message
   D.) Button

Answer: Option 'D'

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.

DigitalOcean Referral Badge

10.

The __________ argument contains the message to display inside the dialog box.

   A.) defaultResponse
   B.) prompt
   C.) message
   D.) title

Answer: Option 'B'

prompt

DigitalOcean Referral Badge

Concatenating Strings, InputBox Function and toString Method - Visual Basic Questions and Answers Download Pdf

Recent Posts