Which function returns the numbers represented in the string "$56.7"?

  1. Abs

  2. CDbl

  3. Int

  4. Val


Correct Option: B
Explanation:

To solve this question, you need to know about the different functions in programming that are used to convert strings into numbers.

A. Abs - This function returns the absolute value of a number. It doesn't convert a string to a number.

B. CDbl - This function in Visual Basic (and some other programming languages) converts a string to a Double data type, which is a type of floating point number. This would be able to convert the string "$56.7" to the number 56.7.

C. Int - This function converts number a to an integer. It doesn't convert a string to a number.

D. Val - This function in Visual Basic (and some other programming languages) returns the numbers found in a string. It would also be able to convert the string "$56.7" to the number 56.7, but it would stop at the first non-numeric character, so it wouldn't handle the dollar sign correctly.

So, the correct answer is:

B. CDbl

Find more quizzes: