Become a GOLD member of Deccansoft and get access to 40+ courses!!
NewBatches/Webinars
Packages
Gold Membership
Bestseller
Microsoft Azure Suite & Suite Plus
Power Platform Acadamy
New
Azure DevOps Expert & Expert Plus
MS.NET Foundation For Beginners
MS.NET Full Stack Developer
UI / Web Development
SQL Server & MSBI Tools
Software Testing
Courses
MS.NET Courses (Includes Live Project)
Complete C#, OOPs and Windows Programing
ASP.NET MVC Online Training
ASP.NET WebForms
ASP.NET Core
WCF incl. Web Services and Remoting
WPF incl. MVVM and Prism
LINQ and Entity Framework
Live Project Training for Developing Enterprise Application
Live Project using Ntier Arch (.NET5 + EF Core + Angular)
Microservices using .NET Core
Gold Membership
CareerStep IT Program
Client-side UI Technologies
Building Static Web Pages using HTML and CSS
JavaScript and HTML DOM
jQuery, AJAX and JSON
Building Interactive Web Pages using HTML5 and CSS3
BootStrap + Live Examples
AngularJS + Live Project
Angular + Typescript
ReactJS
KnockoutJS
Xamarin
SQL Server + MSBI
SQL Server 2017
Querying Data with Transact-SQL(70-761)
SQL Server Integration Service (SSIS)
SQL Server Reporting Service (SSRS)
SQL Service Analysis Service (SSAS)
Cloud Computing / Azure / AWS
AZ-900: Microsoft Azure Fundamentals
Azure Suite (AZ-104+AZ-204+AZ-305+ AZ-500)
AZ-104: Microsoft Azure Administrator
AZ-204: Developing Solutions for Microsoft Azure
AZ-305: Microsoft Azure Architect Technologies and Design
DP-203: Data Engineering on Microsoft Azure
Amazon Web Services (AWS)
DevOps Expert
AZ-400: Microsoft Azure DevOps
Docker by Sandeep Soni
Kubernetes by Sandeep Soni
Docker & Kubernetes by Rahul Rampurkar
IaC Using Terraform
Powershell
Microsoft Power Platform
Microsoft Power Platform
Data Analytics using PowerBI (DA-100)
Testing Tools
Manual Testing
Selenium Testing with Java(Live Training)
Others
Python Programming
C and Data Structure
Core Java
OOPs and C++
Advance Java
Complete Azure Training
Pricing
Videos
Testimonials
Azure Certification
Contact Us
Login
Login or Register
×
Sign In
Register
Forgot Password?
How did you find us
WhatsApp
YouTube
LinkedIn
Facebook
Telegram
Twitter
Google
Referred by Friend
Refresh
Input symbols
By clicking Register, you accept to the
terms and conditions
and that you have read our
privacy policy.
Recover Password
×
Submit
Enquiry Now
Where did you come to know about us
WhatsApp
YouTube
LinkedIn
Facebook
LinkedIn Ad
Email
Twitter
Google
Referred
Other
Refresh
Input symbols
File Handling
Interview Questions and Answer
1. What will happen when existing file is open using 'w' mode
Options:
a. Data added at end
b. Content of file deleted.
c. data of file is appended
d. data added in continuity
Reveal Answer
2. What is the default return-type of getchar()?
Options:
a. char
b. int
c. char *
d. Reading character doesn’t require a return-type
Reveal Answer
3. Which is the invalid I/O function in binary format?
Options:
a. Fseek
b. fwrite
c. fread
d. fgets
Reveal Answer
4. Which of the following do not give compilation error?
Options:
a. using file function with file pointer
b. access file with its pointer
c. open file in existence of it
d. read file that is in write mode
Reveal Answer
5. Which of the following is invalid i/o function?
Options:
a. fscanf
b. fseek
c. ftell
d. forward
Reveal Answer
6. Which function is used to read an integer value from a file?
Options:
a. getw
b. fscanf()
c. gets
d. geti
Reveal Answer
7. Which of following is used for representing End of the file?
Options:
a. '/0'
b. eof
c. EOF
d. garbage value
Reveal Answer
8. What is the data type and value of EOF?
Options:
a. int,1
b. int,-1
c. char,1
d. float 1
Reveal Answer
9. The mode r is used for reading the file, what will be the output if the file does not exist
Options:
a. returns NULL
b. new file created
c. compilation error
d. runtime error
Reveal Answer
10. What is function of mode 'a+' during opening the file?
Options:
a. Reading will start from beginning but writing data is added at end
b. Directly add the data at the end
c. data is overwritten
d. create file during in existence of file
Reveal Answer
11. A file must be opened before it can be used
Options:
a. True
b. False
Reveal Answer
12. All files must be explicitly closed
Options:
a. True
b. False
Reveal Answer
13. Files are always referred by file name in C
Options:
a. True
b. False
Reveal Answer
14. What will happen when existing file is open using 'w' mode?
Options:
a. Data is added at the end
b. Deletes the previous content and starts from beginning
c. Data of file is appended
d. Data added in continuity
Reveal Answer
15. Function fseek may be used to seek from the beginning of the file only
Options:
a. True
b. False
Reveal Answer
16. Which of the following is not a file Access mode
Options:
a. r+
b. w+
c. a-
d. a+
Reveal Answer
17. Which of the following file handling function is analogous to the standard I/O function printf?
Options:
a. fprint
b. fprintf
c. fprints
d. fprintline
Reveal Answer
18. Which of the following function is used to write an integer value to the file
Options:
a. fscanf()
b. fprintf()
c. putw()
d. puti()
Reveal Answer
19. What will be the output of following program? int main() { FILE *fp; fp=fopen("TRIAL.C","r"); fclose(fp); }
Options:
a. Error
b. Runtime error
c. File Open successfully
d. TRIAL.C
Reveal Answer
20. What will be the output of following program? int main() { FILE *fp; char str[20]; fp=fopen(strcpy(str, "ENGINE.C"),"w"); while(fgets(str,80,fp)!=EOF) puts(str); }
Options:
a. No output
b. 80
c. output
d. 80 w
Reveal Answer
21. What will be the output of following program? int main() { FILE *fp; char c; fp=fopen("TRY.C","r"); if(fp=NULL) { puts("Cannot Open File"); exit(1); } while((c = getc(fp))!=EOF) putch(c); fclose(fp); }
Options:
a. Compilation Error
b. Runtime Error
c. No Output
d. Abnormal Termination
Reveal Answer
22. What will be the output of following program? int main() { char name[20]; int age; printf("Enter name and age\n"); fscanf(stdin, "%s %d",name, &age); fprintf(stdout, "%s %d",name, age); }
Options:
a. Enter name and age John 22 John 22
b. John 22 John 22
c. Enter name and age Enter name and age
d. John 22
Reveal Answer
23. What will be the output of following program? int main() { static char name[20]="Triplet"; char *s; s=name; while(*s) { putc(*s, stdout); fputchar(*s); printf("%c\n",*s); s++; } }
Options:
a. TTT rrr iii ppp lll eee ttt
b. ppp lll eee ttt
c. TTT rrr iii ppp
d. lll eee
Reveal Answer
24. What will be the output of following program? int main() { struct a { char city[10]; int pin; }; static struct a b={"Hyderabad",20}; static char c[]="banglore"; FILE *fp; fp = fopen("Trial", "wb"); fwrite(&b, sizeof(b), 1, fp); fwrite(c, 9, 1, fp); }
Options:
a. Hyderabad
b. Hyderabad 20
c. banglore Trial
d. No output
Reveal Answer
25. Which of the following functions is most appropriate for storing numbers in a file?
Options:
a. putc()
b. fprintf()
c. fprintf()
Reveal Answer
26. Which of the following file opening modes would destroy the file being opened, if the file already exist on the disk?
Options:
a. "w"
b. "wb"
c. "rb+"
d. "ab+"
Reveal Answer
Packages
Gold Membership
Microsoft Azure Suite &Suite Plus
Azure DevOps Expert &Expert Plus
MS.NET Foundation For Beginners
MS.NET Full Stack Developer
UI / Web Development
SQL Server & MSBI Tools
Software Testing
Resources
Blog
Deccansoft
AzureA2Z
Wall of Fame
On-Job Tech Support
About
About BestDotNetTraining
About Trainer
Testimonials
FAQ
Other links
About Us
Contact Us
Leave us a feedback
Sitemap
Privacy Policy
Terms & Conditions
Proudly Powered by