1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
4vir4ik [10]
3 years ago
9

Which method can be used to write data to a text file opened with the BufferedWriter object outfile?

Computers and Technology
1 answer:
maksim [4K]3 years ago
7 0

Answer:

Option (d) outfile.write();

Explanation:

As the object created for the class BufferedWriter is outfile, outfile.write is the correct syntax for writing in a text file. Here, write is the method used for writing into a text file. The data present is written in the textfile. Here, the text file is opened before writing the text into the file. Option (d) is correct.

Option (a) outfile.newLine(); is used to separate the lines. This is used to break the existing lines into smaller lines. This can also be used to start a new line. Here, newLine() is the method.So, option (a) is not suitable.

Option (b) outfile.existLine(); This is not a valid syntax as there is no method called existLine() in the class BufferedWriter. So, this is a wrong option.

Option (c) Write(outfile); This is not a valid syntax for writing in a text file. This is a wrong option.

You might be interested in
Why is it better for a CPU to have more than one cache?
Kitty [74]

Explanation:

i think cpu needs to have backup chache units in case of electrical failure

5 0
2 years ago
Read 2 more answers
What is one way to maintain Internet safety? a) avoid interacting with people on the Internet. B) avoid giving out information a
Anarel [89]
To be safe on the Internet, we must avoid giving out personal information.
4 0
3 years ago
Define a function typeHistogram that takes an iterator ""it"" (representing a sequence of values of different types) and builds
Alexeev081 [22]

Answer:

def typeHistogram(it,n):

   d = dict()

   for i in it:

       n -=1

       if n>=0:

           if str(type(i).__name__) not in d.keys():

               d.setdefault(type(i).__name__,1)

           else:

               d[str(type(i).__name__)] += 1

       else:

           break

   return list(d.items())

it = iter([1,2,'a','b','c',4,5])

print(typeHistogram(it,7))

Explanation:

  • Create a typeHistogram function that has 2 parameters namely "it" and "n" where "it" is an iterator used to represent a sequence of values of different types while "n" is the total number of elements in the sequence.
  • Initialize an empty dictionary and loop through the iterator "it".
  • Check if n is greater than 0 and current string is not present in the dictionary, then set default type as 1 otherwise increment by 1.
  • At the end return the list of items.
  • Finally initialize the iterator and display the histogram by calling the typeHistogram.
3 0
2 years ago
What does this loop that uses a range function do? for i in range(7, 15): print("goodbye") It prints "goodbye" 8 times, numbered
goldfiish [28.3K]

Answer:

It prints "goodbye" 8 times.

Explanation:

The loop being described in this scenario would print "goodbye" 8 times. It would not include numbers detailing the range since the loop instructions only state for the system to print("goodbye") and nothing else. Also, it would only print it 8 times because in a range the endpoint is not included, this is mainly because in programming data structures tend to run on 0-based indexing.

6 0
2 years ago
Read 2 more answers
Which of these improved the ability to send information over the network in the 1970s?
frez [133]

Answer:

b. ethernet

Explanation:

It was an ethernet that was developed in the 1970s that improved the ability to send the information over the network. It is the most widely used method to connect the computers in a LAN or the local area network, ever since 1980 when it was first introduced for commercial use. And it is being used in bulk even today.

4 0
2 years ago
Other questions:
  • Create a class called Clock to represent a Clock. It should have three private instance variables: An int for the hours, an int
    15·1 answer
  • You want to discard your old computer and want to securely erase the data from your hard drive. What can you use to do this and
    6·1 answer
  • The local emergency manager has the responsibility for coordinating emergency management programs and activities. A local emerge
    7·1 answer
  • Illia is a network administrator at a company.which tasks is she responsible for
    9·1 answer
  • What adds the element carbon to the environment
    10·2 answers
  • Design an if-then statement ( or a flowchart with a single alternative decision structure that assigns 20 to the variable y and
    5·1 answer
  • Lab 6B: printing a binary number
    13·1 answer
  • Which is a benefit of peer-to-peer networking?
    12·1 answer
  • Which phrase is the best definition of sparklines in Excel 2016?
    8·2 answers
  • Anyone who do bug bounty hunt ?​
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!