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

Start

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

Start

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

Start

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

Start

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

Start

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

Start

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

Start

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

Start

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

Start

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

Start

["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%

Completed

0/10

Accuracy

0%

Get Prepinsta Prime

Get all 200+ courses offered by Prepinsta

Never Miss an OffCampus Update

Get OffCampus Updates on Social Media from PrepInsta

Follow us on our Media Handles, we post out OffCampus drives on our Instagram, Telegram, Discord, Whatsdapp etc.

Get Hiring Updates
Amazon,Google,Delottie & 30+companies are hiring ! Get hiring Updates right in your inbox from PrepInsta

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.

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.

Get PrepInsta Prime Subscription

Get access to all the courses that PrepInsta offers, check the out below -

Companies

TCS, Cognizant, Delloite, Infosys, Wipro, CoCubes, KPMG, Amazone, ZS Associates, Accenture, Congnizant & other 50+ companies

Programming

Data Structures, Top 500 Codes, C, C++, Java Python & other 10+ subjects

Skills

Full Stack Web Development, Data Science, Machine Learning, AWS Cloud, & other 10+ skills and 20+ projects

Comments