1 the output of the code bellow will be char str1 10 quot engineer quot char str2 10 5346742

1. the output of the code bellow will be:

   char str1 [10] =”engineer”;

   char str2 [10] =” “;

   strncpy (str2, &str1[2],3);

   str2[3]='0';

   cout

A. “gin”

B. b. “engin”

C. c. “gineer”

D. D. “ngi”

2. If you attempt to open a non -existing file for output.

A. It is automatically created if it's a text file

B. It is automatically crated if it's a binary file.

C. The open failts

D .a) and b) statemeenets are correct.

E. A) and B) statements are incorrect

3. If you open an existing file for input,

A. The file size is changed to zero if it's a binary file

B. The file size is changed to zero if it's a text file.

C. The file size remains unchanged

D. The file is truncated.

E. The file is renamed.

4. If you open a non-existing file for input,

A. It is automatically created if it's a text file.

B. It is automatically created if it's binary file.

C. The open failts

D. EIther the file is automatically created or the open fails depending upon the compiler configuration.

5. If you write 10 integers (int) to an empty binary file.

A. The file will contain a total of 10 * sizeof (int) bytes if it's a text file

B. The file will contain a total of 10 * sizeof (int) bytes if it's a binary file.

C. A and B statements are correct

6. Which one of the following statements is correct

A. function read is used to read from a text file.

B. operator >> is used to read from a text file.

C. function getline is used to read from a ttext file.

D. A and B statements are correct.

E. A and B sgtatements are incorrect.

7. Which of the following statements is correct.

A. function write is use to write to a binary file.

B. function seekp is ued to move to a new write position in a binary file.

C. function tellp is sued to enquire the current write position in a binary file.

D. B and C statement are correct.

8. If fobj is a object of type fstream, then the follwing statement

fobj.seek(32L, ios:;beg);

A. sets the write position to the 33rd byte ( byte 32) from the beginning

B. sets the write position to the 32rd byte ( byte 31) from the beginning of the file

C. it works differently with different operating systems

D. you cannot tell from the information given

9) if fobj is a object of type fstream, then the following statement

fObj.seekp(120L, ios::curr)

A. sets the write pos to the 119st byte ( byte 118) from the current postion.

B. sets the write pos to the 121st byte ( byte 120) from the current position.

C. it works differently with different operating systems.

D. you cannot tell from the information given.

10) Consider the following code:

int main()

{

fstream fout(“data.dat”, ios::out|ios::binary);

char c = 'A';

while (c
{
     fout.write(&c, size of (c));

     c++;

}
fout.close();

return 0;

}

A. ABCDEFGHIJ

B. Abcdefghij

C. Ccccccccc

D. AAAAAAAAA

11) Consider the follow. The file “letters.dat” contains ABCDEFGHIJ

int main()

{

fstream fin(“letters.dat”, ios::in|ios::binary);

char a;

fin.get(a);

cout

fin.get(a);

cout

fin.seekg(-4, ios::end);

fin.get(a)

cout

cout

seekg(2, ios::cur);

fin.get(a)

cout

return 0;

}

What willbe the output?

A. ABCD
B. ACEJ

C. ADGJ

D. DEFG
E. Aaaa

12) Consider the following two pieces of code:

First pieceof code:

            of stream outClientFile(“clients.dat”, ios:out);

Second piece of code:

            of stream outClientFile;

            outClientFile.open(“clients.dat”, ios:out);

A. The first piece will successfuly open the “clients.dat” for output but the second will not.

B. The second piece will successfuly open the “clients.dat” for output but the first will not

C. Both pieces of tcode will not be able to successfuly open the file because it is not specified if the file is binary or not.

D. Both pieces of code are perfectly correct and will open the file for output

13) Member function tell g and tell p are provided to return the current locations of the get and put pointers, respectively.

A. True

B. False

14) Assume clientData is a structure type previously defined and client is a variable of that type. The function

inCredit.read ( reinterpret_cast(&client), size of (clientData));

inputs a specified (by size of ( clientData)) number of bytes from the current position of the speciifed stream into client.

A. True

B. False

15) The member function write outputs a fixed nubmer of bytes beginning at a specfic location in memory to the specific stream. When the stream is associated with a file, the adata is written beginning at the location in the file specified by the “put” file pointer.

A.) True

B. False

16) and classes provide member functions for repositioning the file pointer ( the byte nubmer of the next byte in the file to be read or to be written.)

These member functions are:

A. seekp (seek put) for istream class seekg (seek get) for ostream class

B. Seekg (seek get) for istream class seekp ( seek put) for ostream class

C. Functions like these do not work with and classes but work only with class

17). Which of the following is linked list node?

A. struct ListNode

     

     {

      double data;

       

      LnkedList * next;

};

B. struct ListNode

{

    double data;

    List* next;

}

C. struct ListNode

{

    double data;

    

    Node* next;

     };

D. struct List Node

   {

    double data;

     ListNode* next;

    };

18) Recursion can be sued to display the linkeed list backward but won't work for displaying it forward.

A. True

B. False

19) Inserting a new value in the middle of a singly lnked list requires changing the pinter of the list node that follows the new node.

A.) True

B) False

20) Deleting a node in the middle of a singly lnked list requires changing the pointer of the list node that precedes the node being deleted.

A. True.

B. False

21) (*x).y and *x.y are equivalent.

A. True

B. False

22) (*x).y and *x->y are equivalent.

A. True

B. False

23) (*x).(*y).z and *x->y->z are equivalent.

A. True

B. False

24) If the following fjunction is caleld wit ha value of 2 for n, what is the resulting output?

Void Quiz (int n)

{

     if (n > 0)

     {

      cout

      Quiz (n-1);

      cout

       Quiz (n-1)

    }

}

A.00011011

B.11100100

C.10011100

D.01100011

E. 001101

"Get 15% discount on your first 3 orders with us"
Use the following coupon
FIRST15

Order Now