TCS File Handling Questions Quiz-1

Question 1

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

-1

-1

2

2

1

1

10

10

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

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

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

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

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

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

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

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()

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

null
null

Buy TCS Prog. Logic (C MCQ) Paid Materials

Join TCS Online Classes

Personalized Analytics only Availble for Logged in users

Analytics below shows your performance in various Mocks on PrepInsta

Your average Analytics for this Quiz

Rank

-

Percentile

0%

Get over 200+ Courses under One Subscription

mute

Don’t settle Learn from the Best with PrepInsta Prime Subscription

Learn from Top 1%

One Subscription, For Everything

The new cool way of learning and upskilling -

Limitless Learning

One Subscription access everything

Job Assistance

Get Access to PrepInsta Prime

Top Faculty

from FAANG/IITs/TOP MNC's

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others.

Comments