Test

Question 1

Time: 00:00:00
The value of EOF is _____

-1

-1

2

2

1

1

10

10

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 2

Time: 00:00:00
Which of the following true about FILE *fp

FILE is a keyword in C for representing files and fp is a variable of FILE type.

FILE is a keyword in C for representing files and fp is a variable of FILE type.

FILE is a structure and fp is a pointer to the structure of FILE type

FILE is a structure and fp is a pointer to the structure of FILE type

FILE is a stream

FILE is a stream

FILE is a buffered stream

FILE is a buffered stream

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

typedef struct { int level; /* fill/empty level of buffer */ unsigned flags; /* File status flags */ char fd; /* File descriptor */ unsigned char hold; /* Ungetc char if no buffer */ int bsize; /* Buffer size */ unsigned char *buffer; /* Data transfer buffer */ unsigned char *curp; /* Current active pointer */ unsigned istemp; /* Temporary file indicator */ short token; /* Used for validity checking */ }FILE;

Start

Question 3

Time: 00:00:00
The first and second arguments of fopen are ______

A character string containing the name of the file & the second argument is the mode

A character string containing the name of the file & the second argument is the mode

A character string containing the name of the user & the second argument is the mode

A character string containing the name of the user & the second argument is the mode

A character string containing file poniter & the second argument is the mode

A character string containing file poniter & the second argument is the mode

None of the mentioned

None of the mentioned

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

a) A character string containing the name of the file & the second argument is the mode

Start

Question 4

Time: 00:00:00
If there is any error while opening a file, fopen will return

Nothing

Nothing

EOF

EOF

NULL

NULL

Depends on compiler

Depends on compiler

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

depends on the compiler

depends on the compiler

c) NULL

null

Start

Question 5

Time: 00:00:00
fseek() should be preferred over rewind() mainly because

rewind() doesn’t work for empty files

rewind() doesn’t work for empty files

rewind() may fail for large files

rewind() may fail for large files

In rewind, there is no way to check if the operations completed successfully

In rewind, there is no way to check if the operations completed successfully

All of the above

All of the above

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Explanation: The rewind function sets the file position indicator for the stream pointed to by stream to the beginning of the file.

Start

Question 6

Time: 00:00:00
FILE is of type ______

int type

int type

char * type

char * type

struct type

struct type

None of the mentioned

None of the mentioned

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Explanation: It is what is typically termed an opaque data type, meaning it\'s typically declared as a simple structure, and then internally in the OS libraries the FILE pointer is cast to the actual date-type of the data-structure that the OS will use access data from a file. A lot of these details are system-specific though, so depending on the OS, the definition may differ.

structure obviously :)

Start

Question 7

Time: 00:00:00
FILE reserved word is

A structure tag declared in stdio.h

A structure tag declared in stdio.h

One of the basic datatypes in c

One of the basic datatypes in c

Pointer to the structure defined in stdio.h

Pointer to the structure defined in stdio.h

It is a type name defined in stdio.h

It is a type name defined in stdio.h

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

D

Explanation: It is a type name defined in stdio.h

Start

Question 8

Time: 00:00:00
getc() returns EOF when

End of files is reached

End of files is reached

When getc() fails to read a character

When getc() fails to read a character

Both of the above —

Both of the above —

None of the above

None of the above

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 9

Time: 00:00:00
Which of the following functions from “stdio.h” can be used in place of printf()?

fputs() with FILE stream as stdout.

fputs() with FILE stream as stdout.

fprintf() with FILE stream as stdout.

fprintf() with FILE stream as stdout.

fwrite() with FILE stream as stdout.

fwrite() with FILE stream as stdout.

All of the above three – a, b and c.

All of the above three – a, b and c.

In “stdio.h”, there’s no other equivalent function of printf()

In “stdio.h”, there’s no other equivalent function of printf()

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 10

Time: 00:00:00
fputs adds newline character

True

True

False

False

Depends on the standard

Depends on the standard

Undefined behaviour

Undefined behaviour

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

true

a) True

Start

["0","40","60","80","100"]
["Need more practice!","Keep trying!","Not bad!","Good work!","Perfect!"]