
Introduction to Java Programming and Data Structures Comprehensive Version (11th Edition)
11th Edition
ISBN: 9780134700144
Author: Liang
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 17.3, Problem 17.3.4CP
If you write the string “100” to an ASCII text file, what values are stored in the file? If you write a numeric byte-type value 100 using binary I/O, what values are stored in the file?
Expert Solution & Answer

Want to see the full answer?
Check out a sample textbook solution
Students have asked these similar questions
Consider the following statement, which is intended to assign the value of the expression,
the variable result Assume that the double variables. x-ya and b have been properly
declared and initialized.
(xy)
to
double result = missing code /:
17
Mark for Review
Which of the following can replace / missing code / so that the statement works as intended?
Math.sqrt((x + y)
2/ Math.abs(a, b))
Math.sqrt((x + y) 2/ Math.abs(a - b))
Math.sqrt(Math.pow(x + y, 2) / Math. abs(a, b))
Math.sqrt(Math.pow(x + y, 2) / Math.abs (a - b))
Consider the following code segment, which is intended to print the digits of the two-digit int number
num in reverse order. For example, if num has the value 75, the code segment should print 57.
Assume that num has been properly declared and initialized.
/missing code */
System.out.print (onesDigit);
System.out.print (tensDigit);
14
Mark for Review
Which of the following can be used to replace / missing code so that the code
segment works as intended?
int onesDigit num 10;
int tensDigit num / 10;
int onesDigit- num / 10;
int tensDigit num 10;
int onesDigit -10/num;
int tensDigit 10 num;
-Undo
int onesDigit
num
100;
Undo
int tensDigit-num / 100;
The following code segment is intended to round yal to the nearest integer and print the result
double val--0.7
int roundedVal (int) (val +0.51
System.out.println(roundedValu
25
Mark for Review
Which of the following best describes the behavior of the code segment?
The code segment does not work as intended because the expression
(val +0.5) should be cast to a double instead of an int
The code segment does not work as intended because val should be cast
to an int before 0.5 is added to it.
Highlights & Notes
Reference
Undo
Undo
The code segment does not work as intended because the expression
-Unda
positive
ר .
Chapter 17 Solutions
Introduction to Java Programming and Data Structures Comprehensive Version (11th Edition)
Ch. 17.2 - What is a text file and what is a binary file? Can...Ch. 17.2 - How do you read or write text data in Java? What...Ch. 17.3 - Prob. 17.3.1CPCh. 17.3 - How is a Java character represented in the memory,...Ch. 17.3 - If you write the string ABC to an ASCII text file,...Ch. 17.3 - If you write the string 100 to an ASCII text file,...Ch. 17.3 - What is the encoding scheme for representing a...Ch. 17.4 - Prob. 17.4.1CPCh. 17.4 - Why should you always close streams? How do you...Ch. 17.4 - Prob. 17.4.3CP
Ch. 17.4 - Does FileInputStream/Fi1eOutputStream introduce...Ch. 17.4 - What will happen if you attempt to create an input...Ch. 17.4 - How do you append data to an existing text file...Ch. 17.4 - Prob. 17.4.7CPCh. 17.4 - What is written to a file using writeByte(91) on a...Ch. 17.4 - How do you check the end of a file in an input...Ch. 17.4 - What is wrong in the following code? Import...Ch. 17.4 - Suppose you run the following program on Windows...Ch. 17.4 - After the following program is finished, how many...Ch. 17.4 - For each of the following statements on a...Ch. 17.4 - What are the advantages of using buffered streams?...Ch. 17.5 - How does the program check if a file already...Ch. 17.5 - How does the program detect the end of the file...Ch. 17.5 - How does the program count the number of bytes...Ch. 17.6 - Prob. 17.6.1CPCh. 17.6 - Prob. 17.6.2CPCh. 17.6 - Is it true that any instance of...Ch. 17.6 - Prob. 17.6.4CPCh. 17.6 - Prob. 17.6.5CPCh. 17.6 - What will happen when you attempt to run the...Ch. 17.7 - Can RandomAccessFi1e streams read and write a data...Ch. 17.7 - Create a RandomAccessFi1e stream for the file...Ch. 17.7 - What happens if the file test.dat does not exist...Ch. 17 - (Create a text file) Write a program to create a...Ch. 17 - (Create a binary data file) Write a program to...Ch. 17 - (Sum all the integers in a binary data file)...Ch. 17 - (Convert a text file into UTF) Write a program...Ch. 17 - Prob. 17.5PECh. 17 - Prob. 17.6PECh. 17 - Prob. 17.7PECh. 17 - (Update count) Suppose that you wish to track how...Ch. 17 - (Address book) Write a program that stores,...Ch. 17 - (Split files) Suppose you want to back up a huge...Ch. 17 - (Split files GUI) Rewrite Exercise 17.10 with a...Ch. 17 - Prob. 17.12PECh. 17 - (Combine files GUI) Rewrite Exercise 17.12 with a...Ch. 17 - (Encrypt files) Encode the file by adding 5 to...Ch. 17 - (Decrypt files) Suppose a file is encrypted using...Ch. 17 - (Frequency of characters) Write a program that...Ch. 17 - (BitOutputStream) Implement a class named...Ch. 17 - (View bits) Write the following method that...Ch. 17 - (View hex) Write a program that prompts the user...Ch. 17 - (Hex editor) Write a GUI application that lets the...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
In most languages, if a file does not exist and a program attempts to open it in append mode, what happens?
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Suppose a small company has five employees and is planning to increase the number to six. Moreover, suppose one...
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
In the following exercises, write a program to carry out the task. The program should use variables for each of...
Introduction To Programming Using Visual Basic (11th Edition)
F46. Determine the moment of the force about point O.
INTERNATIONAL EDITION---Engineering Mechanics: Statics, 14th edition (SI unit)
Show a snippet of PHP code for disconnecting from the database. Explain the meaning of the code.
Database Concepts (8th Edition)
59. A 100-watt [W] motor (60% efficient) is used to raise a 100-kilogram [kg] toad 5 meters [m] into the air. H...
Thinking Like an Engineer: An Active Learning Approach (4th Edition)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- In the following code segment, mon and tue are properly declared String variables. String strl-mon.substring(9. mon.indexOf(" "). String str2-tue.substring(tue.indexOf(" ") + 1). System.out.println(strl+and+str2): க 21 Mark for Review For which of the following values of mon and tue will the code segment print "cloudy and foggy"? mon tue "cloudy today" "foggy tomorrow" mon tue "cloudy today" "tomorrow foggy" mon tue "today cloudy" "foggy tomorrow" mon tue "today cloudy" "tomorrow foggy"arrow_forwardG Consider the following code segment, which is intended to assign to num a random integer value between min and max, inclusive, each with an equal chance of being assigned to num. Assume that min and max are integer variables and that the value of max is greater than the value of min. 24 Mark for Review Which of the following can replace /* missing code */ so that the code segment works as intended? double rn = Math.random();_ int num = /* missing code */ ;_ D (int) (rn * max) + min ABC (A) (int) (rn * (max- min)) + min (B (int) (rn * (max min)) + 1 (int) (rn * (max min + 1)) + minarrow_forwardWrite the truth table for each of the following logic functions: (a) FX Y+X'. Y'. Z (b) FW' X + Y' · Z' + X' · Z (c) F=W+X' · (Y' + Z) . . (d) F A B+ B' C+C' D + D' A .arrow_forward
- Use the theorems of switching algebra to simplify each of the following logic functions: (a) F W X Y Z (W X Y . Z'+W X Y Z (b) FA B+ A . B C D+A B.D. E' + A B C W X Y Z+W X Y' - Z) E + C D E .arrow_forwardWrite the canonical sum and product for each of the following logic functions: (a) F = Σx,y(1,2) (c) F=ΣA,B,C(2,4,6,7) = (b) FПAB(0,1,2) (d) F=Пw.x,y(0,1,3,4,5)arrow_forwardFor the following truth table: a) Write the canonical SOP. Row × Y Z F 0 0 0 0 0 b) Write the canonical POS. | 0 0 1 2 0 1 0 1 3 0 1 1 0 4 1 0 0 0 5 1 0 1 1 6 1 1 0 0 7 1 1 1 1arrow_forward
- (团) (四) The Dog class has a constructor that takes two parameters. The first parameter is a String representing a dog's name and the second parameter is an int representing the dog's age, in months. 9 Mark for Review ARC The following code segment appears in a class other than Dog. Which of the following best describes the contents of dog1 and dog2 as a result of executing this code segment? Dog dogl new Dog ("Rex", 4); Dog dog2 dogl dog1; new Dog("Fido", 60); dog1 and dog2 are Dog variables that each contain the same Dog object, which represents a dog named "Fido' that is 60 months old. dogl is a Dog variable that contains a Dog object representing a dog named "Fido" that is 60 months old, and dog2 is a Dog variable that contains a Dog object representing a dog named "Rex" that is 4 months old. dogl and dog2 are Dog reference variables that each contain a reference to the same memory address that contains the Dog object representing a dog named "Fido' that is 60 months old. dogl is a…arrow_forwardThe following code segment is intended to assign to newword the result created by removing the first occurrence of "a" from word. Assume that the String variable word has been properly declared and initialized. This code segment works for some, but not all, values of word. int aLoc word.indexOf("a"); String newword word.substring(0, aLoc) + word.substring(aLoc + 1); 18 Mark for Review Which of the following conditions best describes the condition in which this code segment will not work a intended and will result in a runtime error? is the first character in word. is the last character in word. word does not contain the character "a". word contains only a sequence of multiple "a" characters.arrow_forwardConsider the following code segment, which is intended to create a String that consists of the last character in word and assign it to the variable lastChar String word / initialization not shown */; // line 1 int len word.length(); // line 2 String lastChar word.substring(len); // line 3 17 Mark for Review Which of the following best describes why this code segment will not work as intended? substring needs to be called with two parameters, so the method call in line 3 should be changed to word.substring(len, len + 1). len is not the correct index of the last character in word, so the method call in line 3 should be changed to word.substring(len - 1). len is not the correct index of the last character in word, so the method call in line 3 should be changed to word.substring(len + 1). substring cannot be called with a variable as the parameter, so the method call in line 3 should be changed to word.substring (word.length()). ABCarrow_forward
- Consider the following code segment. String one String two "computer"; "science"; String concat / missing code */; System.out.println(concat); 2 16 Mark for Review ARC Which of the following expressions can be used to replace/missing code / so that the code segment prints the string "pun"? one.substring(3, 4) + two.substring(4, 4) one.substring(3, 5) + two.substring(4, 5) one.substring(4, 5) + two.substring(5, 5) one.substring(4, 6) + two.substring(5, 6)arrow_forwardPlease R show code and output for the following questions.arrow_forwardGo through Chapters 2-4 of the 9th edition of Foundations of Information Systems: What do you like or not like about the student registration process? Do you believe that a university should be allowed to monitor emails sent and received on the university computers? Why or why not? Support your answer. Is security a technical issue? A business issue? Both? Support your answer.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrSystems ArchitectureComputer ScienceISBN:9781305080195Author:Stephen D. BurdPublisher:Cengage Learning
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage

EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT

C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr

Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning

C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Files & File Systems: Crash Course Computer Science #20; Author: CrashCourse;https://www.youtube.com/watch?v=KN8YgJnShPM;License: Standard YouTube License, CC-BY
UNIX Programming (Part - 10) The File System (Directories and Files Names); Author: ITUTEES;https://www.youtube.com/watch?v=K35faWBhzrw;License: Standard Youtube License