Deck 17: File Processing
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/11
العب
ملء الشاشة (f)
Deck 17: File Processing
1
For an ifstream object A, a class type B and a local variable of type B called C, the proper way to read in one B object from A into C is:
A) A.read &C, sizeof B ) );
B) A.read reinterpret_cast< char * > &C ), sizeof B ) );
C) A.read reinterpret_cast< char * > &C ), B );
D) A.read char * &C ), sizeof B ) );
A) A.read &C, sizeof B ) );
B) A.read reinterpret_cast< char * > &C ), sizeof B ) );
C) A.read reinterpret_cast< char * > &C ), B );
D) A.read char * &C ), sizeof B ) );
B
2
Select the false statement. The reinterpret_cast operator:
A) Changes the value of the object to which its operand points.
B) Performs its operation at compile time.
C) Is compiler-dependent and can cause programs to behave differently on different platforms.
D) Is easy to use to perform dangerous manipulations that could lead to serious execution-time errors.
A) Changes the value of the object to which its operand points.
B) Performs its operation at compile time.
C) Is compiler-dependent and can cause programs to behave differently on different platforms.
D) Is easy to use to perform dangerous manipulations that could lead to serious execution-time errors.
A
3
Select the false statement.
A) C++ includes object serialization by default.
B) After a serialized object has been written to a file, it can be read from the file and deserialized-that is, the type information and bytes that represent the object and its data can be used to recreate the object in memory.
C) When an object is output to disk, only the values of its attributes are output.
D) None of the above.
A) C++ includes object serialization by default.
B) After a serialized object has been written to a file, it can be read from the file and deserialized-that is, the type information and bytes that represent the object and its data can be used to recreate the object in memory.
C) When an object is output to disk, only the values of its attributes are output.
D) None of the above.
A
4
Select the proper object type.
__________ file "file.dat", ios::in | ios::out );
A) iostream
B) fstream
C) ofstream
D) ifstream
__________ file "file.dat", ios::in | ios::out );
A) iostream
B) fstream
C) ofstream
D) ifstream
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 11 في هذه المجموعة.
فتح الحزمة
k this deck
5
Random access files are more effective than sequential files for:
A) Instant access to data.
B) Updating data easily.
C) Inserting data into the file without destroying other data.
D) All of the above.
A) Instant access to data.
B) Updating data easily.
C) Inserting data into the file without destroying other data.
D) All of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 11 في هذه المجموعة.
فتح الحزمة
k this deck
6
A random access file is organized most like an):
A) Array.
B) Object.
C) Class.
D) Pointer.
A) Array.
B) Object.
C) Class.
D) Pointer.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 11 في هذه المجموعة.
فتح الحزمة
k this deck
7
To write fixed-length records, use file open mode:
A) ios::app
B) ios::ate
C) ios::trunc
D) ios::binary
A) ios::app
B) ios::ate
C) ios::trunc
D) ios::binary
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 11 في هذه المجموعة.
فتح الحزمة
k this deck
8
Which of the following functions would not be used to write data randomly to a random access file?
A) tellg
B) seekp
C) write
D) All of the above would be used.
A) tellg
B) seekp
C) write
D) All of the above would be used.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 11 في هذه المجموعة.
فتح الحزمة
k this deck
9
Multiple file open modes are specified to the fstream constructor by separating each open mode from the next with the bitwise inclusive or operator __________.
A) ||
B) ^
C) & .d |
A) ||
B) ^
C) & .d |
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 11 في هذه المجموعة.
فتح الحزمة
k this deck
10
In the text, we created a random access file. When we read the data back sequentially, we discovered that in the process of creating the random-access file, the data was__________.
A) merged.
B)duplicated.
C) sorted.
D) filtered.
A) merged.
B)duplicated.
C) sorted.
D) filtered.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 11 في هذه المجموعة.
فتح الحزمة
k this deck
11
Select the false statement. The write function:
A) Creates unformatted data.
B) Expects data type const char * as its first argument.
C) Writes to files in hexadecimal format.
D) Takes an argument of type size_t.
A) Creates unformatted data.
B) Expects data type const char * as its first argument.
C) Writes to files in hexadecimal format.
D) Takes an argument of type size_t.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 11 في هذه المجموعة.
فتح الحزمة
k this deck