What is the next step in using a file, after the file has been declared with the
ID: 3843018 • Letter: W
Question
What is the next step in using a file, after the file has been declared with the following? ofstream AnsFile; A. You use the file to input a variable. B. You use the file by outputting a value to it. C. You search for a file named AnsFile. D. You open the file, and associate it with a specific file name. Which of the following statements correctly opens the output file object AnsFile to store answers into file myanswers.txt? A. AnsFile.open("myanswers.txt"); B. open.AnsFile("myanswers.txt"); C. open.AnsFile(myanswers.txt): D. AnsFile.open(myanswers.txt): Which statement will properly store the number from variable value into the output file object AnsFile? A. AnsFile > value; D. value = read.Myinput(); Which of the following statements will close the output file object AnsFile from the previous question? A. close.AnsFile; B. "myanswers.txt".close; C. AnsFile.close(); D. AnsFile.close("myanswers.txt"); Which repetition constructs will properly repeat the loop body while not at the end-of-fild for input file object DataFile A. while (! DataFile) B. while (! eo![]) C. while (!DataFile_eof[]) D. while (! eof.DataFile[]) The argument and parameters A. must agree in number and identifier name B. must agree in data type and identifier name. C. must agree in number and order In the following function prototype; int fun1(double& Num1, double& Num 2); A. Function fun1 can modify the arguments passed to both Num1 and Num2 B. Function fun1 can not modify the arguments passed to Num1 and Num2 C. Function fun1 can only modify the arguments passed to Num1 D. Function fun1 can only modify the arguments passed to Num2 Which library contains the function used to seed the random number generator? A. Cstdlib B. ctime C. crandom D. cmath Which of the following statements properly involves the random number generator storing the resulting random number into myNumber A. myNumber = stand(); B. myNumber = $rand(time(0)); C. myNumber = rand(); D. None of the THESEExplanation / Answer
Solution:
19) B option is correct ofstream is used to outputing a value to a file.
20) A is correct myAns.open("myanswers.txt")
21) A Ansfile<< value; will assign the value of the variable to the file
22) A myfile>> value is correct.
23) C is correct AnsFile.close()
24) C while (!DataFile.eof())
25) Must agree in data type and identifier name
26) A
27) cstdlib, contains the random number generator function
28) C
I hope this helps. Don't forget to give a thumbs up if you like this.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.