Department of Electronics & Communication Engineering
This document is a tutorial for the Department of Electronics & Communication Engineering at Dharmsinh Desai University for the academic year 2024-2025. It includes multiple-choice questions, true/false statements, and programming tasks related to file handling in C. The tutorial covers functions for file operations, file modes, and practical programming exercises.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
10 views2 pages
Department of Electronics & Communication Engineering
This document is a tutorial for the Department of Electronics & Communication Engineering at Dharmsinh Desai University for the academic year 2024-2025. It includes multiple-choice questions, true/false statements, and programming tasks related to file handling in C. The tutorial covers functions for file operations, file modes, and practical programming exercises.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2
Department of Electronics & Communication Engineering
(Faculty of Technology, Dharmsinh Desai University, Nadiad)
Academic Year : 2024 - 2025
Tutorial – 12
Subject : PPS Class : B. Tech. Sem.I (EC)
Q.1 Select the most appropriate option.
(1) Which of the following functions are used to write an integer to a file? (a) fprintf() (b) putw() (c) putc() (d) puts() (2) Which of the following symbols are used to indicate EOF? (a) ^z (b) ~z (c) EOF (d) None of these (3) Which one of the following is correct syntax for opening a file. (a) FILE *fopen(const *filename, const char *mode) (b) FILE *fopen(const *filename) (c) FILE *open(const *filename, const char *mode) (d) d) FILE open(const*filename) (4) If the mode includes b after the initial letter, what does it indicates? (a) text file (b) big text file (c) binary file (d) d) blueprint text (5) To open a file in C, which mode should be used if you want to read from an existing file and the file must exist? (a) "r" (b) "w" (c) "a" (d) "x" (6) In C, what is the purpose of the feof() function? (a) To check if the file is empty (b) To check if the end-of-file indicator has been set (c) To check if the file has been opened successfully (d) To check if the file is a binary file Q.2 State True or False (1) A file must be opened before it can be used. (2) Files are always referred to by name in C programs. (3) Using fseek to position a file beyond the end of the file is an error. (4) If an existing file is opened in write-mode, then the current contents of the file are deleted. (5) If a file is not closed through an explicit fclose() statement, then the file remains open even after the termination of the program. Q.3 Do as directed. (1) Write a program to copy the contents of one file into another. (2) Two files DATA1 and DATA2 contain sorted lists of integers. Write a program to produce a third file DATA which holds a single sorted, merged list of these two lists. Use command line arguments to specify the file names (3) Write a program that appends one file at the end of another. (4) Write a program that reads a file containing integers and appends at its end the sum of all the integers. (5) Write a C program that concatenates the contents of two files and writes then in the third file. (6) Write a C program that uses fscanf function to read integer values from a file, computes the square of each integer value and places the resultant values in a different file.