Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

and nie (9 points) characters a file (including it a vo in text has Part 2: git

ID: 3571642 • Letter: A

Question

and nie (9 points) characters a file (including it a vo in text has Part 2: git and all the char below attempts read of type to vector c store them a of and in any special terminates. thechars; other never the while loop char sign std: :ifstream std: ("file File char cRead: EoF) unsigned File.get (J) d the while cRead the Chars push back answer of the following best explains why the while never select the sINGLE best file. which terminates? read in the A You must call seekg after you call get in order to the been of have an variable binary flag and should it B. The file was not opened with the be to an int type while loop. get ios assigned c value retumed to Eo in the unsigned char o instead of to compare D. You should use equals named bark Assume that Dog is a class. It a public member function user-defined has appears in a that takes no arguments. Consider the following line ofc code, which function: Dog fido: of code? Select all that apply. 24u Which of the following statements are true about this line on the heap A. The object that is created by line is definitely created B. This line calls the o argument constructor in the class Dog object is located. C. The value of fido is the memory address where the Dog 224u, write a statement that will call the function bark on the object created in the above line of code.

Explanation / Answer

Please follow the data and description :

1)

In c++, ios::in allows input (read operations) from a stream and the ios::out allows output (write operations) to a stream. As he file is not opened in any of the formats the while loop don not check for the EOF anf that do no terminates.

So the answer is OPTION B ("The File was not opened with the ios::binary flag and it should have been.").

2)

For the line of code Dog fido,

the value of the fido is the memory address where the dog object is located.

All objects in Java are stored on the heap. The "variables" that hold references to them can be on the stack or they can be contained in other objects (then they are not really variables, but fields), which puts them on the heap also.

So the variables object is definitely of heap memory.

So the answer is OPTION A and OPTION C.

3)

statement to call the function is fido.bark();

4)

For the option created after the walk object is called with d then the two object obviusly refers to the object of the dog.

So the answer is OPTION D.

5)

Yes the the new function would work even after the line of code is executed but the clash is that the respective object would not be allowed to to modify.

So the answer is OPTION B.

6)

CODE :

#include <iostream>
#include <fstream>
using namespace std;

int main()
{
ofstream stm1, stm2;
int num = 9595487;
stm1.open("file1");
stm1<<num;
stm1.close();

stm2.open("file2");
stm2.write((char*) &num, sizeof(num));
stm2.close();

return 0;
}


The respective sizes are 7 and 5 bytes of data.

only the file1 shows the human readable data.

So the answer is OPTION A.

7)

For the given code only the object or the variables r and el are used for the random number generator.

So the answer is OPTION C (Both r and el).

8)

Yes the destructor is called only if the object is deleted using the delete.

So the answer is TRUE.

9)

To send the changes to your remote repository, execute git push origin master.

So teh answer is FALSE.


Hope this is helpful.