Files concepts.53

Post on 29-Nov-2014

418 views 2 download

description

 

transcript

http://raj-os.blogspot.in/ 1

File Concept, File Management, File Attributes

http://raj-os.blogspot.in/ 2

Recap

• In the last class, you have learnt

– Various disk scheduling algorithms

– Selection of a particular disk scheduling

algorithm

• HOME PREVIOUS TOPIC NEXT• PREVIOUS QUESTION PAPERS FOR

OS• CPP TUTORIALS

3http://raj-os.blogspot.in/

http://raj-os.blogspot.in/ 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/ 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/ 6

Program Files - Source form - Object form

- Executable form

Data Files - Numeric

- Alphabetic - Alphanumeric

- Binary

File concept

http://raj-os.blogspot.in/ 7

File Formats

- Free form

Ex. Text files

- Rigidly formatted

File Concept

http://raj-os.blogspot.in/ 8

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

File Concept

http://raj-os.blogspot.in/ 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/ 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/ 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/ 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/ 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/ 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/ 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/ 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/ 17

5. Which of the following is not a file operation

a) Delete

b) Create

c) Read

d) None

http://raj-os.blogspot.in/ 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/ 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/ 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/ 21

9. A file name usually contains

a) Three parts

b) Two parts

c) Five parts

d) Four parts

http://raj-os.blogspot.in/ 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/ 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/ 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

Other subject materials

• Web designing

• Micro processors

• C++ tutorials

• java

home

25http://raj-os.blogspot.in/