2. Recap
• In the last class, you have learnt
– Various disk scheduling algorithms
– Selection of a particular disk scheduling
algorithm
http://raj-os.blogspot.in/ 2
3. • HOME PREVIOUS TOPIC NEXT
• PREVIOUS QUESTION PAPERS FOR
OS
• CPP TUTORIALS
http://raj-os.blogspot.in/ 3
4. Objectives
On completion of this period you would be able to
know:
- Understand file Concept
- Understand file operations
- Know Various file types
http://raj-os.blogspot.in/ 4
5. File Concept
File
- A named collection of related information
- Recorded on secondary storage
User’s perspective
- Smallest allotment of logical secondary storage
Files represent both
- Programs
- Data
http://raj-os.blogspot.in/ 5
6. File concept
Program Files
- Source form
- Object form
- Executable form
Data Files
- Numeric
- Alphabetic
- Alphanumeric
- Binary
http://raj-os.blogspot.in/ 6
7. File Concept
File Formats
- Free form
Ex. Text files
- Rigidly formatted
http://raj-os.blogspot.in/ 7
8. File Concept
Second definition of a file
A file is a sequence of bits, bytes, lines or
records whose meaning is defined by the file’s
creator and user
http://raj-os.blogspot.in/ 8
9. Types of Information in a file
- Source Programs
- Object Programs
- Executable Programs
- Numeric Data
- Text
- Student Records
- Graphic Images
- Sound recordings
- Video recordings
http://raj-os.blogspot.in/ 9
10. Structure of a File
A file has a defined structure according to its type
Text file
A sequence of characters organized into lines or
pages
Source file
- A sequence of subroutines and
functions
- Each of which is further organized as
declarations followed by executable
statements
http://raj-os.blogspot.in/ 10
11. Object File
A sequence of bytes organized into blocks
understandable by the system linker
Executable file
A series of code sections that can be brought into
memory executed by the loader
http://raj-os.blogspot.in/ 11
12. Frequently Asked Questions
• 1. Define file
• 2. Explain file management
• 3. List the basic file operations
• 4. Explain various file operations
• 5.List and explain the common file types
http://raj-os.blogspot.in/ 12
13. 1. A file is
a) A secondary storage device
b) One of CPU’s registers
c) A named collection of related information
d) None of the above
http://raj-os.blogspot.in/ 13
14. 2. A file can contain
a) Only numeric data
b) Only alphabetic data
c) Only graphical data
d) All of the above
http://raj-os.blogspot.in/ 14
15. 3. Information in a file is defined by
a) The operating system
b) Loader
c) Creator of file
d) None of the above
http://raj-os.blogspot.in/ 15
16. 4. File management refers to
a) Organization of files
b) Allocation of CPU to user programs
c) Allocation of main memory to user programs
d) None of the above
http://raj-os.blogspot.in/ 16
17. 5. Which of the following is not a file operation
a) Delete
b) Create
c) Read
d) None
http://raj-os.blogspot.in/ 17
18. 6 When a file is truncated
a) New contents are written into the file
b) The file is physically removed from the storage
device
c) All file attributes remain unchanged except file
length which is reset to zero
d) None of the above
http://raj-os.blogspot.in/ 18
19. 7. A file seek operation is also known as
a) Deleting a file
b) Reading a file
c) writing a file
d) Repositioning within a file
http://raj-os.blogspot.in/ 19
20. 8. Open file table is maintained by
a) The user
b) The compiler
c) The operating system
d) All of the above
http://raj-os.blogspot.in/ 20
21. 9. A file name usually contains
a) Three parts
b) Two parts
c) Five parts
d) Four parts
http://raj-os.blogspot.in/ 21
22. 10 . An object file is
a) A ready to run program file
b) A library of routines
c) A compiled but not linked machine language file
d) None of the above
http://raj-os.blogspot.in/ 22
23. 11. When you type a C program using an editor
a) An object file is generated
b) An executable file is created
c) A batch file is created
d) A source code file is created
http://raj-os.blogspot.in/ 23
24. 12. The length of file name extension is
a) 1 to 3 characters
b) 1 to 5 characters
c) 1 to 10
d) Unlimited
http://raj-os.blogspot.in/ 24
25. Other subject materials
• Web designing
• Micro processors
• C++ tutorials
• java
home
http://raj-os.blogspot.in/ 25