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+”

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

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

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

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

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

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

Question 8

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

Attach

Attach

Append

Append

Apprehend

Apprehend

Add

Add

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)

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

null
null

Buy TCS NQT Paid Materials

Paid Materials TCS NQT

Join TCS NQT Online Classes