Knowee
Questions
Features
Study Tools

The following statement declares a StreamReader object called “reader”. Which statement opens a file named “data.txt” to the StreamReader object?streamReader reader;Question 1Select one:a.reader = OpenFile("data.txt");b.reader = open("data.txt");c.reader = File.OpenText("Data.txt");d.reader = File.OpenFile("Data.txt");Clear my choiceQuestion 2Not yet answeredMarked out of 1Flag questionTipsQuestion textAssuming openFile is the name of an OpenFileDialog control, which expression can call the ShowDialog method and determine whether the user clicks the Open button?Question 2Select one:a.if (openFile.ShowDialog() == true)b.if (openFile.ShowDialog() == DialogResult.Open)c.if (openFile.ShowDialog() == DialogResult.OK)d.if (openFile.ShowDialog() == OK)Clear my choiceQuestion 3Not yet answeredMarked out of 1Flag questionTipsQuestion textWhich statement will write a persons firstname and surname to a textfile on one line? (Assume that the StreamWriter variable writer has been declared and has access to the file and that the variables firstname and surname have been declared and have values in them).Question 3Select one:a.writer(firstname + " " + surname);b.writer = WriteLine (firstname + " " + surname);c.writer.WriteLine(firstname + " " + surname);d.writer.WriteLine(firstname , " " , surname);Clear my choiceQuestion 4Not yet answeredMarked out of 1Flag questionTipsQuestion textWhich statement will correctly read an integer value from a text file?  (Assume that the StreamReader object reader has been declared and has access to the file and the integer variable number has been declared.  Assume that there is one integer value per line in the file).Question 4Select one:a.number = reader.ReadLine();b.number = reader.ReadLine().Parse();c.number = int.Parse(reader.ReadLine());d.number = (int) reader.ReadLine();Clear my choiceQuestion 5Not yet answeredMarked out of 1Flag questionTipsQuestion textWhich statement will correctly read a line of text from a text file?  (Assume that the StreamReader object reader has been declared and has access to the file and the string variable line has been declared).Question 5Select one:a.line = reader.ReadLine();b.reader = ReadLine();c.reader.ReadLine();d.line = reader.Rea

Question

The following statement declares a StreamReader object called “reader”. Which statement opens a file named “data.txt” to the StreamReader object?streamReader reader;Question 1Select one:a.reader = OpenFile("data.txt");b.reader = open("data.txt");c.reader = File.OpenText("Data.txt");d.reader = File.OpenFile("Data.txt");Clear my choiceQuestion 2Not yet answeredMarked out of 1Flag questionTipsQuestion textAssuming openFile is the name of an OpenFileDialog control, which expression can call the ShowDialog method and determine whether the user clicks the Open button?Question 2Select one:a.if (openFile.ShowDialog() == true)b.if (openFile.ShowDialog() == DialogResult.Open)c.if (openFile.ShowDialog() == DialogResult.OK)d.if (openFile.ShowDialog() == OK)Clear my choiceQuestion 3Not yet answeredMarked out of 1Flag questionTipsQuestion textWhich statement will write a persons firstname and surname to a textfile on one line? (Assume that the StreamWriter variable writer has been declared and has access to the file and that the variables firstname and surname have been declared and have values in them).Question 3Select one:a.writer(firstname + " " + surname);b.writer = WriteLine (firstname + " " + surname);c.writer.WriteLine(firstname + " " + surname);d.writer.WriteLine(firstname , " " , surname);Clear my choiceQuestion 4Not yet answeredMarked out of 1Flag questionTipsQuestion textWhich statement will correctly read an integer value from a text file?  (Assume that the StreamReader object reader has been declared and has access to the file and the integer variable number has been declared.  Assume that there is one integer value per line in the file).Question 4Select one:a.number = reader.ReadLine();b.number = reader.ReadLine().Parse();c.number = int.Parse(reader.ReadLine());d.number = (int) reader.ReadLine();Clear my choiceQuestion 5Not yet answeredMarked out of 1Flag questionTipsQuestion textWhich statement will correctly read a line of text from a text file?  (Assume that the StreamReader object reader has been declared and has access to the file and the string variable line has been declared).Question 5Select one:a.line = reader.ReadLine();b.reader = ReadLine();c.reader.ReadLine();d.line = reader.Rea

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

Sure, here are the answers to your questions:

Question 1: The correct answer is c. reader = File.OpenText("Data.txt");

Question 2: The correct answer is c. if (openFile.ShowDialog() == DialogResult.OK)

Question 3: The correct answer is c. writer.WriteLine(firstname + " " + surname);

Question 4: The correct answer is c. number = int.Parse(reader.ReadLine());

Question 5: The correct answer is a. line = reader.ReadLine();

This problem has been solved

Similar Questions

Consider the codes below to read the content of a file. fr is a FileReader object.BufferedReader d=new BufferedReader(fr);String filecontent=d.readLine();Select one:TrueFalse

Which of the following opens the file associated with the stream?Select one:Fopen;None of thesefopen();open();

the correct answerWhich of these class is used to read characters in a file?OptionsFileReaderFileInputStreamFileWriterInputStreamReader

Which method is used to read a character from the FileReader class in Java?Question 3Answera.readChar()b.read()c.readLine()d.readString()

Which of these method of FileReader class is used to read characters from a file?Question 2Answera.read()b.scanf()c.get()d.getInteger()

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.