Question

2. Some XmlReader methods throw an XmlException if they encounter an unexpected situation. True False 3.A...

2. Some XmlReader methods throw an XmlException if they encounter an unexpected situation.

True

False

3.A stream is the flow of data from one location to another.

True

False

5.To catch any I/O exception, you can use the exception classes that inherit the IOException class such as FileNotFoundException.

True

False

0 0
Add a comment Improve this question Transcribed image text
Answer #1

2.Some XmlReader methods throw an XmlException if they encounter an unexpected situation,

TRUE

Yes TRUE Because XmlReader throws associate degree XmlException on XML break down errors.After associate degree exception is thrown ,the state of the reader isn't predictable .XmlException is thrown within the initial validation error.Xmlexception is thrown if the XMl file contains extrajudicial characters or invalid XML names.The XML 1.0 recommendation needs document-level agreement once a DTD is gift. Therefore, if the reader is organized to support ConformanceLevel.Fragment, however the XML information contains a document sort definition (DTD), associate degree XmlException is thrown.

3.A stream is the flow of data from one location to another

TRUE

Because,Streams do not store data,they provide data from a source as a collecton.Streams do no modify the data source,they transform data into a new stream ,for instance,when doing a filtering operation.Stream is a sequence of elements from source that supports sequential and parallel aggregate operations.A Java collection is an in memory data structure with all elements contained within memory while a stream is a data structure with all elements computed on demand.An operaton of a stream produces a result without modifying its source.

5.To catch any I/O exception, you can use the exception classes that inherit the IOException class such as FileNotFoundException.

TRUE

To catch any I/O exception(While using file input/output stream related exception) you can use a checked exception. A checked exception is associate degree exception that the Java ASCII text file should handle, either by catching it or declaring it to be thrown. Checked exceptions area unit usually caused by faults outside of the code itself - missing resources, networking errors, and issues with threads return to mind. These might embrace subclasses of FileNotFoundException, etc.,the compile time error due to checked exception (FileNotFoundException and IO Exception) related to file operation.IDE suggests either we need to enclose our code inside try-catch block or we can use throws keyword in the method declaration.If the exceptions have parent-child relationship, the catch blocks must be sorted by the most specific exceptions first, then by the most general ones.If the protected code can throw different exceptions which are not in the same inheritance tree, i.e. they don’t have parent-child relationship, the catch blocks can be sorted any order.If we catch the most general exception first, then we also catch other exceptions which are subtypes of the general exception.

Add a comment
Know the answer?
Add Answer to:
2. Some XmlReader methods throw an XmlException if they encounter an unexpected situation. True False 3.A...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Question 20 Statements that might generate an exception are placed in a catch block. True False...

    Question 20 Statements that might generate an exception are placed in a catch block. True False 1 points Question 21 The class Exception and its subclasses are designed to catch exceptions that should be caught and processed during program execution. True False 1 points Question 22 Which of the following statements is NOT true about creating your own exceptions? Typically, constructors are the only methods that you include when you define your own exception class. The exception class that you...

  • What am I doing wrong on this? Chapter 17, Problem 3E // Michael Cole // 6/28/2017...

    What am I doing wrong on this? Chapter 17, Problem 3E // Michael Cole // 6/28/2017 // Name spaces for application using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; namespace Week8 {     public partial class Form1: Form     {         // Get the location where the data file would be created         string fileLoc = Application.StartupPath +             "\\Datafile.txt";         /* Constructor of the class to create the GUI of the form */         public Form1()        ...

  • In a function template, a generic data type starts with the key word _____ followed by...

    In a function template, a generic data type starts with the key word _____ followed by a parameter name that stands for the data type. template class T function Which of the following blocks is designed to catch any type of exception? catch(){ } catch(...){ } catch(*){ } catch(exception){ } A friend function can only be a regular stand-alone function and can not be a member of another class. True False A function template is an actual function that the...

  • Part 2: Programming with Exceptions In this part of the lab , you will write a...

    Part 2: Programming with Exceptions In this part of the lab , you will write a program that fetches the information stored at a give URL on the web and saves that data to a file. This will also include networking and file operations and partly an exercise in using exceptions. For doing I/O, Java has a pair of nice abstractions: InputStream and OutputStream. These are abstract classes in the package java.io. An InputStream is a place from which you...

  • An array of 100 elements is to be sorted using the bubble sort in the modules (the one that tests...

    An array of 100 elements is to be sorted using the bubble sort in the modules (the one that tests the return value of floatLargestToTop0 to see if it can return "early".) Check all the true statements about the sort algorithm, i.e., the sort method and its support methods. (Check all that apply.) It will sometimes return (completely sorted) after only 99 data comparisons. It will always require at least one swap. It will always require at least 99 comparisons...

  • Please provide the full code...the skeleton is down below: Note: Each file must contain an int...

    Please provide the full code...the skeleton is down below: Note: Each file must contain an int at the beginning, stating the number of records in the file. Afterwards, the number of records in the file will follow. Each record that follows will consist of a last name (String), and a gpa (double). However, to test the error handling of your program, the number of records will not always match the int value. All possible combinations should be tested. 1.) Prompt...

  • 2. Identify whether the following statements are TRUE or FALSE: (a) Subtyping supports code reuse from...

    2. Identify whether the following statements are TRUE or FALSE: (a) Subtyping supports code reuse from one class, inside of another class. (b) Subclasses depend only on the public interfaces of objects, not their implementations. (c) Interfaces contain fully defined methods and can extend other classes. (d) If B is a subclass of A, then a variable of type A can refer to either an object of type A or an object of type B.

  • Question 16 You must put your data in classes if you use C++. True False 2...

    Question 16 You must put your data in classes if you use C++. True False 2 points Question 17 Constructors are automatically invoked during class instantiation. True False 2 points Question 18 To make your data accessible to entities outside of your class, declare the members of that class as private. True False 2 points Question 19 You can make arrays of built-in types like int and double, but not of user-defined types. True False 2 points Question 20 One...

  • create a new Java application called "CheckString" (without the quotation marks) according to the following guidelines....

    create a new Java application called "CheckString" (without the quotation marks) according to the following guidelines. ** Each method below, including main, should handle (catch) any Exceptions that are thrown. ** ** If an Exception is thrown and caught, print the Exception's message to the command line. ** Write a complete Java method called checkWord that takes a String parameter called word, returns nothing, and is declared to throw an Exception of type Exception. In the method, check if the...

  • Help check why the exception exist do some change but be sure to use the printwriter...

    Help check why the exception exist do some change but be sure to use the printwriter and scanner and make the code more readability Input.txt format like this: Joe sam, thd, 9, 4, 20 import java.io.File; import java.io.PrintWriter; import java.io.IOException; import java.io.FileNotFoundException; import java.io.FileWriter; import java.util.Scanner; public class Main1 { private static final Scanner scan = new Scanner(System.in); private static String[] player = new String[622]; private static String DATA = " "; private static int COUNTS = 0; public static...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT