CIS170C WEEK 7 QUIZ

30 July, 2024 | 2 Min Read

Question 1

2 / 2 pts

(TCO 8) Files that are accessed in consecutive order are known as

random access files.

consecutive files.

binary files.

sequential files.

Lesson; Chapter 5

Question 2 2 / 2 pts

(TCO 8) If you want to add data to the end of an existing file, what is the correct operation to perform?

Update file

Create file

Read and write file

Append file

Lesson; Chapter 5

Question 3 2 / 2 pts

(TCO 8) To create an output file object, you would use what kind of type?

instream

fstream

ofstream

ifstream

Lesson; Chapter 5

Question 4 2 / 2 pts

( TCO 8) What do the following statements accomplish?

ifstream theFile;

theFile.open( myFile.txt , ios::in);

Creates an empty file named myFile

Opens myFile in append mode

Opens a file in input mode to write to

Opens myFile in read mode

Lesson; Chapter 5

Question 5

2 / 2 pts

(TCO 8) When a file is opened in output mode, the file pointer is positioned

after the file header.

at the beginning of the file.

at the end of the file.

in the middle of the file.

Lesson; Chapter 5

Question 6 2 / 2 pts

(TCO 8) The is_closed function returns what kind of data type?

char

int

double

bool

Lesson; Chapter 5

Question 7

2 / 2 pts

( TCO 8) Given the following declaration, ifstream theFile;.

When using a loop to read lines from a sequential file, what would be the proper loop condition?

while (theFile.eof == true)

while (theFile.eof != false)

Lesson; Chapter 5

Question 8

2 / 2 pts

( TCO 8) Given the following statements,

         ifstream theFile;              theFile.open( employeeFile.txt , ios::in);.

What function would close this file?

ifstream.close();

ifstream.close( employeeFile.txt );

theFile.close();

ifstream.thefile.close;

Lesson; Chapter 5

Question 9 2 / 2 pts

(TCO 8) Assuming outFile is a file stream object and counter is a variable, which statement writes the contents of counter to the file associated with outFile?

write(outFile, counter);

Chapter 5

Question 10

2 / 2 pts

(TCO 8) To allow file access in a program, you must include this header file.

fstream

fileaccess

File

cfile

Chapter 5

Powered by TCPDF (www.tcpdf.org)

Related posts