Question: File I/O: binary 1. Create a FILE pointer myfunds 2. Open a file for binary write 3. Binary write block of memory containing money array

File I/O: binary

1. Create a FILE pointer myfunds

2. Open a file for binary write

3. Binary write block of memory containing money array

4. Close the file

5. Open file for binary read

6. Binary read into block of memory containing savings

Illustration 3:

32)In Illustration 3-1When declaring a file pointer, FILE is used. What type of object is FILE?

A) a predefined system operator

B) a predefined system pointer

C) a predefined system function

D) a predefined system structure

33)In Illustration 3-1 How would a file pointer named myfunds be declared?

A) FILE myfunds;

B) FILE * myfunds;

C) FILE [myfunds];

D) myfunds FILE *;

34)In Illustration 3-2What statement would correctly open the file funds.val and initialize the file pointer to write

binary information?

A) fopen("myfunds", "wb");

B) myfunds = fopen("funds.val");

C) myfunds = fopen("funds.val", "w");

D) myfunds = fopen("funds.val", "wb");

35)In Illustration 3-2What happens if fopen returns NULL?

A) void, so no return argument used

B) file is successfully opened

C) file could not be opened

D) continue to use NULL pointer

36)In Illustration 3-3 What statement would write int money[30]; to funds.val file?

A) fwrite(money, sizeof(int), myfunds);

B) fwrite(money, 30, myfunds);

C) fwrite(money, sizeof(int), 30, myfunds);

D) fwrite(myfunds, sizeof(int), 30, money)

37)In Illustration 3-4 What statement would close funds.val?

A) fclose (myfunds);*

B) fclose(money);

C) FileClose(money, myfunds);

D) FILE(close, myfunds ,money);

38)In Illustration 3-5 What statement would open funds.val file to read binary?

A) myfunds = fopen("funds.val", "rb");

B) FILE fopen("funds.val", "r", myfunds);

C) myfunds = fopen("funds.val", "b");

D) fopen(myfunds, "b", "funds.val");

39)In Illustration 3-6 What statement would read int savings[30]; from funds.val file?

A) nread = fread(fp, savings);

B) nread = fread(fp, sizeof(int), 30, savings);

C) nread = fread(savings, fp);

D) nread = fread(savings, sizeof(int), 30, fp);

40)In Illustration 3-6 What value does nread get after reading int savings[30];from funds.val file? nread = fread(savings, sizeof(int), 30, fp);

A) 120 if successful

B) 0 if successful

C) 30 if successful

D) 1 if successful

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!