click below
click below
Normal Size Small Size show me how
F7-FORMATIVE CCS0007
[F7-FORMATIVE] Formative Assessment 7 - File Handling
| Question | Answer |
|---|---|
| EOF means ______________________________ Group of answer choices End of float End of function End of format End of file | End of file |
| Creates a new file or open an existing file Group of answer choices getc() fopen() puc() fclose() | fopen() |
| File mode that opens or create a text file in writing mode Group of answer choices w r a x | w |
| What is correct syntax for fopen()? Group of answer choices fp = fopen(“one.txt”, w); fp = fopen(one.txt, w); fp = fopen("one.txt", "w"); fp = fopen(one.txt, "w"); | fp = fopen("one.txt", "w"); |
| Closes a file Group of answer choices fopen() puc() fclose() getc() | fclose() |
| It points to a structure that contains about the file: Group of answer choices File type File pointer Extension name File name | File pointer |
| Reads a character from a file: Group of answer choices puc() fclose() fopen() getc() | getc() |
| What is the correct syntax for declaring a file pointer? Group of answer choices FILE *fp; *FILE *fp; file *fp; File *fp; | FILE *fp; |
| It represents a sequence of bytes on the disk where a group of related data is stored. Group of answer choices Parameter Variable File Array | File |
| An operation where in data is added to the existing data of a file Group of answer choices Close Create Append Delete | Append |
| Which stream class is to only read from files? Group of answer choices fstream ifstream ofstream iostream | ifstream |
| Which operator is used to insert the data into the file? Group of answer choices >> << < > | << |
| Which of the following is used to create a stream that performs both input and output operations? Group of answer choices fstream ofstream ifstream iostream | fstream |
| What is the output of the given program? #include < iostream > using namespace std; int main () { char str[] = "Steve jobs int val = 65; char ch = 'A'; cout << val << endl; return 0; } Group of answer choices: 65 A 65 a Error | Error |
| Which stream class is to only write on files? Group of answer choices opstream ofstream fstream ifstream | ofstream |
| Which member function is used to determine whether the stream object is currently associated with a file? Group of answer choices string is_out is_open buf | is_open |
| By default, all the files in C++ are opened in _________ mode. Group of answer choices Binary ASCII Text Octal | Text |
| What can be used to input a string with blank space? Group of answer choices inline putline getline sideline | getline |
| When will the cin can start processing of input? Group of answer choices After pressing return key By pressing backspace Both read and write file Delete file | After pressing return key |
| Writes a character to a file: Group of answer choices fclose() fopen() puc() getc() | fopen() |
| A function directly writes into the file: Group of answer choices fscanf() fprintf() fopen() fclose() | fprintf() |
| Closes a file Group of answer choices puc() fopen() getc() fclose() | fclose() |
| Refers to the name of the file Group of answer choices File pointer Filename file attribute file extension | Filename |
| What is the correct syntax for fclose()? Group of answer choices fclose(fp); fclose(“fp”); Fclose(fp); FCLOSE(fp); | fclose(fp); |
| It is created for the permanent storage of data. Group of answer choices List Constant Variable File | File |
| What is the return type open() method? Group of answer choices double bool char int | bool |
| Which of the following is used to create an output stream? Group of answer choices ofstream iostream fstream ifstream | ofstream |
| The ifstream would be used when: Group of answer choices reading a file creating a file removing a file appending a file | reading a file |
| Which header file is required to use file I/O operations? Group of answer choices <iostream> <ifstream> <ostream> <fstream> | <fstream> |
| Which of the following header file is required for creating and reading files? Group of answer choices stream ifstream fstream ofstream | fstream |
| What is the output of the given program? #include < iostream > using namespace std; int main () { char str[] = "Steve jobs"; int val = 65; char ch = 'A'; cout << val << endl; return 0; } Group of answer choices 65 A | 65 |
| What does the following code do? while( (ch = getchar()) != '\n') { putc(ch, fp); } Group of answer choices Puts character into a variable Gets a character Gets a character, put it into a file pointer until an enter is pre | Gets a character, put it into a file pointer until an enter is pressed |
| File mode that opens a text in reading mode Group of answer choices r a w q | r |
| An operation wherein data is added to the existing data of a file Group of answer choices Create Append Delete Close | Append |
| File mode that opens a text file in append mode Group of answer choices rb a b r | a |
| A C++ library that allows working with files Group of answer choices cmath ctype cstdlib fstream | fstream |
| What is meant by ofstream in c++? Group of answer choices Writes to a file Reads from a file Both read and write file Delete file | Writes to a file |
| Which stream class is used to both read and write on files? Group of answer choices ofstream opstream fstream ofstream | fstream |
| Which header file is used for reading and writing to a file? Group of answer choices #include<cmath> #include<iostream> #include<fstream> #include<conio> | #include<fstream> |
| Writes a set of data to a file Group of answer choices *fp fopen() fclose() fprintf() | fprintf() |