Note 1

Take Note:

Take a note while surfing.





Note With Ink

Give your Note a Colorful Tag.




Easy to Access

Stay on same information and in Sync wherever you are.

Note 2

Take Note:

Organize your information,It may take Shape.





Think With Ink

Differ your Content by Color.




Easy to Access

Easy to pull up your content from anywhere anytime.

Note 3

Take Note:

Don't Let information to miss,Because it take shape





Note With Ink

Simple an Easy Way to take a note.




Easy to Access

Get the same in next visit.


Please wait...

C Programming :: File Input/Output

Home > C Programming > File Input/Output > General Questions

1. What is the output of the following 'C' program ?

#include
void main()
{
FILE *ptr;
char i;
ptr=fopen("abc","r");
while((i=fgets(ptr))!=EOF)
printf("%c",i);
}

Answer: Option A

Explanation:

The condition is checked against EOF, it should be checked against NULL.

Workspace


Tags:  No Tags on this question yet!

2. If the content of a file (input) is abc def. What will be the value of input and ch?.

#include
char input[100],ch;
void main(void)
{
FILE *fp;
fp = fopen("input","rb");
fscanf(fp, "%s" ,&input);
fscanf(fp, "%c" ,&ch);
printf("%s %c", input, ch);
}

Answer: Option C

Explanation:

It will not scan anything after a space is encountered. 

Workspace


Tags:  No Tags on this question yet!

3. If a file contains the line "I am an Indian\r\n" then on reading this line into the array str using fgets().
what would str contain?

Answer: Option B

Explanation:

Here is no explanation for this answer

Workspace


Tags:  No Tags on this question yet!

Answer: Option B

Explanation:

Here is no explanation for this answer

Workspace


Tags:  No Tags on this question yet!

Answer: Option A

Explanation:

Here is no explanation for this answer

Workspace


Tags:  No Tags on this question yet!

Answer: Option C

Explanation:

Here is no explanation for this answer

Workspace


Tags:  No Tags on this question yet!

Answer: Option B

Explanation:

This is because here 'w' means it truncate file to zero length or create text file for writing. The stream is positioned at the beginning of the file. But, it is null hence, the file "sample" could not be created for writing.

Workspace


Tags:  No Tags on this question yet!

Answer: Option B

Explanation:

Here is no explanation for this answer

Workspace


Tags:  No Tags on this question yet!

9. Which of the following is/are advantages of cellular partitioned structure:

Answer: Option A

Explanation:

Here is no explanation for this answer

Workspace


Tags:  No Tags on this question yet!

Answer: Option C

Explanation:

Here is no explanation for this answer

Workspace


Tags:  No Tags on this question yet!



Most Popular Qs.

Latest MCQ Qs.