Deck 6: Io Streams As an Introduction to Objects and Classes
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/51
العب
ملء الشاشة (f)
Deck 6: Io Streams As an Introduction to Objects and Classes
1
Streams may be passed to a function.
True
2
'\n' is two characters.
False
3
A type whose variables are objects is known as a ___________.
class
4
Two different objects of the same class have a different set of member functions.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
5
Using directives can be placed either directly after the include directives,or at the beginning of each function definition.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
6
You must use a width statement before each variable that you want output in a certain width
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
7
Which command reads one character even if that character is a blank space? ___________
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
8
A _____________ is a flow of characters or other data.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
9
When passing a stream to a function,it must always be pass-by-__________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
10
open is a __________ function of the ofstream and ifstream class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
11
The flag to display floating point numbers in non-scientific notation is ios:: _________
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
12
You may not have more than one input and one output stream open at any one time.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
13
A value that can be turned on or off is called a ________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
14
The manipulator used to change the number of decimal places displayed is _________
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
15
The flag to always show the decimal point in floating numbers is ios:: _________
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
16
If you use the width command,it stays in effect for all values that are send to the stream.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
17
All data is input and output as ____________ data.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
18
The formatting options that were discussed for cout do not work for output file streams.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
19
You may use a read extraction)as a boolean expression in an if or while statement.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
20
Data that is sent to an output stream representing a file will be immediately saved to disk.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
21
Which of the following is the correct way to determine if a file stream named inFile opened correctly?
A)if inFile.open))
B)if inFile.fail))
C)if inFile.opened))
D)if inFile.failed))
A)if inFile.open))
B)if inFile.fail))
C)if inFile.opened))
D)if inFile.failed))
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
22
Which statement correctly opens an input stream named in_file and attaches it to a file name project.txt?
A)in_file=project.txt
B)in_file="project.txt"
C)in_file.open"project.txt");
D)in_file.openproject.txt);
A)in_file=project.txt
B)in_file="project.txt"
C)in_file.open"project.txt");
D)in_file.openproject.txt);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
23
To open a file with a user supplied name,you would need to store the name in a variable.If the file name was to have no more than 20 characters in it,which would be an appropriate declaration of the file name variable?
A)char filename;
B)char filename20);
C)char filename[20];
D)char filename[21];
A)char filename;
B)char filename20);
C)char filename[20];
D)char filename[21];
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
24
The command outFile.precision2);
A)truncates all floating point variables to 2 decimal places
B)sets all output streams in your program to display 2 secimal places
C)displays integers as floating point numbers.
D)displays all floating point values sent to outFile with 2 decimal places.
A)truncates all floating point variables to 2 decimal places
B)sets all output streams in your program to display 2 secimal places
C)displays integers as floating point numbers.
D)displays all floating point values sent to outFile with 2 decimal places.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
25
To open an output file and add to the end of the data already in the file you would write
A)outFile.open"project.txt");
B)outFile.append"project.txt");
C)outFile.open"project.txt",append);
D)outFile.open"project.txt",ios::app);
A)outFile.open"project.txt");
B)outFile.append"project.txt");
C)outFile.open"project.txt",append);
D)outFile.open"project.txt",ios::app);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
26
Which of the following is not used when using files for input and output
A)Opening the file stream
B)Ensuring that the stream opened
C)Closing the stream
D)Prompting for file data
A)Opening the file stream
B)Ensuring that the stream opened
C)Closing the stream
D)Prompting for file data
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
27
If the name of the input file was in a variable named filename,which of the following is the correct way to open the input stream named inFile and associate it with this file?
A)inFile.openfilename);
B)inFile=filename;
C)inFile="filename";
D)inFile.open"filename");
A)inFile.openfilename);
B)inFile=filename;
C)inFile="filename";
D)inFile.open"filename");
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
28
The member function eof)is true/false)when we are ready to read the end of file character.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
29
The _______ function puts one character back into the input stream.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
30
Which of the following is the correct way to close a file stream named outFile?
A)outFile.close);
B)outFile.close;
C)outFile.close"project.txt");
D)closeoutFile);
A)outFile.close);
B)outFile.close;
C)outFile.close"project.txt");
D)closeoutFile);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
31
Which include directive is necessary for file IO
A)#include
B)#include
C)#include
D)#include
A)#include
B)#include
C)#include
D)#include
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
32
If a file did not open correctly,you should
A)continue on anyway
B)display an error message and continue on
C)display an error message and take some suitable action such as exit
D)exit the program immediately
A)continue on anyway
B)display an error message and continue on
C)display an error message and take some suitable action such as exit
D)exit the program immediately
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
33
After a stream is opened,before it is used for input and output,it should be
A)declared
B)closed
C)checked to see if it opened correctly
D)none of the above
A)declared
B)closed
C)checked to see if it opened correctly
D)none of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
34
When is the external name of the file used in the program?
A)Any time you read or write to the file
B)Never
C)Only when reading from the file
D)When opening the file stream
A)Any time you read or write to the file
B)Never
C)Only when reading from the file
D)When opening the file stream
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
35
In the following function declaration,the istream object cin is called a ___________________.
void outputistream& in=cin);
void outputistream& in=cin);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
36
"\n" is a ________ and '\n' is a _______________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
37
In order to read data from a file you
A)must know the kind of data in the file
B)do not need to know the kind of data in the file
C)should prompt the user for the data you are looking for
D)a and c
A)must know the kind of data in the file
B)do not need to know the kind of data in the file
C)should prompt the user for the data you are looking for
D)a and c
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
38
A __________ is a variable that has functions as well as data associated with it.
A)member
B)int
C)object
D)float
A)member
B)int
C)object
D)float
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
39
A function that is associated with an object is called a _________ function.
A)input
B)output
C)member
D)instantiated
A)input
B)output
C)member
D)instantiated
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
40
The member function setf stands for
A)set the file name
B)set the flags
C)set the format
D)nothing
A)set the file name
B)set the flags
C)set the format
D)nothing
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
41
We have a file that has a name in it,but the name is written one character per line.We need to write this name to the screen.What is wrong with the following code?
Ifstream fileIn;
FileIn.open"file.txt");
Char ch;
FileIn.getch)
While!fileIn.eof))
{
Cout.putch);
FileIn.getch);
}
A)can not use put with cout.
B)our output has new lines in it.
C)nothing is wrong
D)eof is not a member of an ifstream object
Ifstream fileIn;
FileIn.open"file.txt");
Char ch;
FileIn.getch)
While!fileIn.eof))
{
Cout.putch);
FileIn.getch);
}
A)can not use put with cout.
B)our output has new lines in it.
C)nothing is wrong
D)eof is not a member of an ifstream object
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
42
Which of the following loop condition statements will read all the data in the file assuming that each record in the file is two integer values,and you will read the first one into a variable named intOne,and the other into intTwo?
A)whileinFile >> intOne >> intTwo)
B)whileinFileintOne,intTwo))
C)whileinFile)
D)whileinFile << intOne << intTwo)
E)A and B
A)whileinFile >> intOne >> intTwo)
B)whileinFileintOne,intTwo))
C)whileinFile)
D)whileinFile << intOne << intTwo)
E)A and B
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
43
What is the output of the following code?
Char ch='G';
Cout << tolowerch)<< endl;
A)G
B)g
C)the integer value of 'g'
D)the integer value of 'G'
Char ch='G';
Cout << tolowerch)<< endl;
A)G
B)g
C)the integer value of 'g'
D)the integer value of 'G'
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
44
In order to use the stream manipulators,you must include the ______ library
A)manip
B)iomanip
C)cstdlib
D)fstream
A)manip
B)iomanip
C)cstdlib
D)fstream
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
45
If the user types in the characters 10,and your program reads them into an integer variable,what is the value stored into that integer?
A)1
B)0
C)10
D)none of the above.
A)1
B)0
C)10
D)none of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
46
What is wrong with the following code?
While ! fileIn.eof))
{
FileIn >> value;
FileOut << value;
}
A)We have read past the end of the input file and attempt to output a nonexistent value
B)We have written past the end of the output file
C)Nothing
D)A and B
While ! fileIn.eof))
{
FileIn >> value;
FileOut << value;
}
A)We have read past the end of the input file and attempt to output a nonexistent value
B)We have written past the end of the output file
C)Nothing
D)A and B
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
47
Which function returns true if the character argument is a letter?
A)isdigit
B)islower
C)isalpha
D)isspace
A)isdigit
B)islower
C)isalpha
D)isspace
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
48
The put function outputs
A)one character value
B)one float value
C)one integer value
D)one double value
A)one character value
B)one float value
C)one integer value
D)one double value
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
49
ios::showpos is a flag that
A)always displays a + in front of positive integers
B)can be used to find the absolute value of an integer
C)always displays a + in front of all integers
D)all of the above
A)always displays a + in front of positive integers
B)can be used to find the absolute value of an integer
C)always displays a + in front of all integers
D)all of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
50
The command outFile.width10)is used to
A)change the number of characters in the output
B)sets the filename of outFile to 10 characters
C)always uses 10 characters to display the output
D)displays the next value in at least 10 characters
A)change the number of characters in the output
B)sets the filename of outFile to 10 characters
C)always uses 10 characters to display the output
D)displays the next value in at least 10 characters
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
51
The get function reads
A)one integer value
B)one float value
C)one double value
D)one character value
A)one integer value
B)one float value
C)one double value
D)one character value
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck