
Quiz on String Conversion and Parsing
Authored by Audrey Fipps
Computers
9th Grade
Used 3+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What method can be used to convert a string to a numeric data type?
You can directly cast from a string to a number
Parse()
Convert()
ToNumber()
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the result of the following code? string myString = "one"; int myInt = int.Parse(myString);
This code will cause an error in the program
The value in myInt will be 1
The value in myString will be 1
The value in myInt will be 0
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which answer correctly describes a difference between Parse() and ToString()?
Parse() convert strings to numbers and ToString() converts numbers to strings.
Parse() only works on integers and ToString() only works on floating point data types
ToString() may throw an exception while Parse() will always work.
Parse() is best at converting small numbers and ToString() is best at converting large numbers.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the result of the following code? String data = "A"; char value = char.Parse(data);
The value variable will hold the A character
The value variable will hold an empty string
This code will cause a compile-time error
This code will cause a run-time StringFormat exception
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What value is stored in myString when the following code is run? bool mystery = true; String text = mystery.ToString();
True
False
1
0
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What value is stored in myString when the following code is run? double value = 0.10; string myString = value.ToString("P");
10.00 %
0.10
100
.001 %
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What value is stored in the result when the following code is run? String input = "3.14159"; int result = int.Parse(input);
An exception will be thrown at runtime
3.14159
3.14
PI
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?