Services
Discover
Homeschooling
Ask a Question
Log in
Sign up
Filters
Done
Question type:
Essay
Multiple Choice
Short Answer
True False
Matching
Topic
Computing
Study Set
Big Java Binder Early Objects
Quiz 11: Inputoutput and Exception Handling
Path 4
Access For Free
Share
All types
Filters
Study Flashcards
Practice Exam
Learn
Question 41
Multiple Choice
The Scanner class's ____ method is used to specify a pattern for word boundaries when reading text.
Question 42
Multiple Choice
Consider the following code snippet: Scanner in = new Scanner(. . .) ; In) useDelimiter("[^A-Za-z]+") ; What characters will be ignored and not read in when using this code?
Question 43
Multiple Choice
Consider the following code snippet. Scanner in = new Scanner(. . .) ; While (in.hasNextLine() ) { String input = in.nextLine() ; } Which of the following statements about this code is correct?
Question 44
Multiple Choice
Consider the following code snippet: Scanner in = new Scanner(. . .) ; In) useDelimiter("[^0-9]+") ; What characters will be ignored and not read in using this code?
Question 45
Multiple Choice
Assume that inputFile is a Scanner object used to read data from a text file which contains a number of lines. Each line contains an arbitrary number of words, with at least one word per line. Select an expression to complete the following code segment, which prints the last word in each line. while (inputFile.hasNextLine() ) { String word = ""; String line = inputFile.nextLine() ; Scanner words = new Scanner(line) ; While (_________________) { Word = words.next() ; } System.out.println(word) ; }
Question 46
Multiple Choice
Which String class method will remove spaces from the beginning and the end of a string?
Question 47
Multiple Choice
Which of the following statements about white space in Java is correct?
Question 48
Multiple Choice
Select an expression to complete the following statement, which is designed to construct a PrintWriter object to write the program output to a file named dataout.txt PrintWriter theFile = _______________________;
Question 49
Multiple Choice
Consider the following code snippet: Scanner in = new Scanner(. . .) ; In) useDelimiter("[^0-9A-Za-z]+") ; What characters will be ignored and not read in using this code?
Question 50
Multiple Choice
The ____ method of the Character class will indicate if a character contains white space.
Question 51
Multiple Choice
Insert the missing code in the following code fragment. This fragment is intended to read all words from a text file. File inputFile = new File("dataIn.txt") ; Scanner in = new Scanner(dataIn.txt) ; While (____________) { String input = in.next() ; System.out.println(input) ; }
Question 52
Multiple Choice
Assuming that inputFile is a Scanner object used to read words from a text file, select an expression to complete the following code segment, which counts the number of words in the input file. Int count = 0; While (inputFile.hasNext() ) { String word = _______________; Count++; } System.out.println(count) ;
Question 53
Multiple Choice
When reading words using a Scanner object's next method, ____.
Question 54
Multiple Choice
Assume that inputFile is a Scanner object used to read data from a text file which contains a series of double values. Select an expression to complete the following code segment, which reads the values and prints them in standard output, one per line, in a field 15 characters wide, with two digits after the decimal point. while (inputFile.hasNextDouble() ) { Double value = inputFile.nextDouble() ; ___________________________________ // statement do display double value }
Question 55
Multiple Choice
Consider the following code snippet: Scanner in = new Scanner(. . .) ; While (in.hasNextLine() ) { String input = in.nextLine() ; System.out.println(input) ; } Which of the following statements about this code is correct?