Quiz on String Conversion and Parsing

Quiz on String Conversion and Parsing

9th Grade

20 Qs

quiz-placeholder

Similar activities

Microbit (python)

Microbit (python)

8th - 10th Grade

15 Qs

Java conditional/loop/method/user input

Java conditional/loop/method/user input

9th - 12th Grade

23 Qs

Intro to Java Loops

Intro to Java Loops

9th - 12th Grade

15 Qs

AP CSA Review Basics

AP CSA Review Basics

9th - 12th Grade

16 Qs

Python Basics Review (TSK)

Python Basics Review (TSK)

9th - 12th Grade

20 Qs

Quiz 143 - Python Data Types and Numbers

Quiz 143 - Python Data Types and Numbers

9th Grade

15 Qs

Java Chapter 7 Exam

Java Chapter 7 Exam

9th - 12th Grade

20 Qs

Parcial Computación IIB - 9no.

Parcial Computación IIB - 9no.

9th Grade

20 Qs

Quiz on String Conversion and Parsing

Quiz on String Conversion and Parsing

Assessment

Quiz

Computers

9th Grade

Hard

Created by

Audrey Fipps

Used 3+ times

FREE Resource

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

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?