TCS NQT Questions on File Handling Quiz- 1

Question 1

Time: 00:00:00
A mode which is used to open an existing file for both reading and writing ______

”W”

”W”

”W+”

”W+”

”R+”

”R+”

”A+”

”A+”

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

Please login to submit your explanation

Question 2

Time: 00:00:00
Select text file in which data is stored in ________

ASCII code

ASCII code

Binary code

Binary code

Octal code

Octal code

text code

text code

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

Please login to submit your explanation

Question 3

Time: 00:00:00
A data of the file is stored in a

Ram

Ram

Hard disk

Hard disk

Rom

Rom

None

None

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

Please login to submit your explanation

Question 4

Time: 00:00:00
We should not read after a write to a file without an intervening call to fflush(), fseek() or rewind()

TRUE

TRUE

FALSE

FALSE

May Be

May Be

Can't Say

Can't Say

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

Please login to submit your explanation

Question 5

Time: 00:00:00
Offset used in fseek() function call can be a negative number.

TRUE

TRUE

FALSE

FALSE

May Be

May Be

Can't Say

Can't Say

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

Please login to submit your explanation

Question 6

Time: 00:00:00
In fopen(), the open mode "wx" is sometimes preferred "w" because.
1) Use of wx is more efficient.
2) If w is used, old contents of file are erased and a new empty file is created. When wx is used, fopen() returns NULL if file already exists.

Only 1

Only 1

Only 2

Only 2

Both 1 and 2

Both 1 and 2

Neither 1 nor 2

Neither 1 nor 2

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

Please login to submit your explanation

Question 7

Time: 00:00:00
Select text file in which number will take.

2 bytes

2 bytes

4 bytes

4 bytes

3 bytes

3 bytes

8 bytes

8 bytes

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

Please login to submit your explanation

Question 8

Time: 00:00:00
fp = fopen("letsfindcourse.txt", "a");

Attach

Attach

Append

Append

Apprehend

Apprehend

Add

Add

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

Please login to submit your explanation

Question 9

Time: 00:00:00
_____removes the named file, so that a subsequent attempt to open it will fail.

remove(const *filename)

remove(const *filename)

remove(filename)

remove(filename)

remove()

remove()

fclose(filename)

fclose(filename)

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

Please login to submit your explanation

Question 10

Time: 00:00:00
#include
int main(){
char c;
FILE *fp;
fp=fopen("demo.txt","a+"); // demo.txt : hello you are reading a file
fprintf(fp," demo");
fclose(fp);
fp=fopen("myfile.txt","r");

while((c=fgetc(fp))!=EOF)
printf("%c",c);
fclose(fp);
return 0;
}

hello you are reading a file

hello you are reading a file

hello you are reading a file demo

hello you are reading a file demo

demo

demo

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

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

Buy TCS NQT Paid Materials

Paid Materials TCS NQT

Join TCS NQT 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