10CS44 Unix And Shell Programming Question Bank VTU 4th Semester

Leave a Comment
Sponsored Ads:
Sponsored Ads:
Visvesvaraya Technological University - VTU
Question Bank
B.E./B.Tech. DEGREE EXAMINATION
(Regulation/Scheme 2010)
10CS44 Unix And Shell Programming 
Fourth Semester - 4th
Computer Science Engineering - CSE
(Common to Information Science Engineering)

University Papers | Syllabus | Entrance Exam | Govt & PSU Papers | Bank Papers

Programming Questions | Travel Tips | Mobile Review | Placement Papers | Books

VTU SYLLABUS: CLICK HERE

OTHER DEPARTMENT PAPERS: CLICK HERE

Download PDF File - Click Here




For More Question paper of CSE - CLICK HERE

For more question paper of ISE - CLICK HERE


UNIT 1
The Unix Operating System, The UNIX architecture and Command Usage,The File System


1 . Define an operating system.Discuss the salient features of UNIX Operating System. ( Dec.09/Jan.10, june/july2009 , Dec.08/Jan.09, December 2012 )
Soln: An operating system (OS) is a resource manager. It takes the form of a set of software routines that allow users and application programs to access system resources (e.g. the CPU, memory, disks, modems, printers, network cards etc.) in a safe, efficient and abstract way.
Salient features of UNIX OS
Several features of UNIX have made it popular. Some of them are: Portable
UNIX can be installed on many hardware platforms. Its widespread use can be traced to the decision to develop it using the C language.
Multiuser
The UNIX design allows multiple users to concurrently share hardware and software Multitasking
UNIX allows a user to run more than one program at a time. In fact more than one program can be running in the background while a user is working foreground.
Networking
While UNIX was developed to be an interactive, multiuser, multitasking system, networking is
also incorporated into the heart of the operating system. Access to another system uses a standard communications protocol known as Transmission Control Protocol/Internet Protocol (TCP/IP).
Organized File System
UNIX has a very organized file and directory system that allows users to organize and maintain files.
Device Independence
UNIX treats input/output devices like ordinary files. The source or destination for file input and output is easily controlled through a UNIX design feature called redirection.
Utilities
UNIX provides a rich library of utilities that can be use to increase user productivity.

2.Explain the architecture of the UNIX operating system.(Dec.09/Jan.10,Dec.08/Jan.09)
Soln: The UNIX Architecture
UNIX architecture comprises of two major components viz., the shell and the kernel. The kernel interacts with the machine‟s hardware and the shell with the user.
The kernel is the core of the operating system. It is a collection of routines written in C. It is  loaded into memory when the system is booted and communicates directly with the hardware. User programs that need to access the hardware use the services of the kernel via use of system calls and the kernel performs the job on behalf of the user. Kernel is also responsible for managing system‟s memory, schedules processes, decides their priorities.
The shell performs the role of command interpreter. Even though there‟s only one kernel running on the system, there could be several shells in action, one for each user who‟s logged in. The shell is responsible for interpreting the meaning of metacharacters if any, found on the command line before dispatching the command to the kernel for execution.

3.    Explain the following commands with examples:
i)    cat ; ii) rmdir;    iii) pwd ( Dec.09/Jan.10, Dec.08/Jan.09 ) Soln: i) Cat – to display the file contents & to create files
$ Cat > list hello  [Ctrl –d ]
 $ cat list Hello
ii)    rmdir - remove directory
A directory needs to be empty before you can remove it. If it‟s not, you need to remove the files first. Also, you can‟t remove a directory if it is your present working directory; you must first change out of that directory. You cannot remove a subdirectory unless you are placed in a directory which is hierarchically above the one you have chosen to remove.
E.g.    rmdir patch    Directory must be empty
rmdir pis pis/progs pis/data
Shows error as pis is not empty. However rmdir silently deletes the lower level subdirectories progs and data.
iii)    pwd - print working directory
At any time you can determine where you are in the file system hierarchy with the pwd, print working directory, command,
E.g.,:    $ pwd
/home/frank/src

4.    Write a note on man documentation. And also give the usage of appros & whatis (june/july2009)
SOLN: The man Documentation
The man documentation is organized in eight (08) sections. Later enhancements have added subsections like 1C, 1M, 3N etc.) References to other sections are reflected as SEE ALSO section of a man page.
When you use man command, it starts searching the manuals starting from section 1. If it locates a keyword in one section, it won‟t continue the search, even if the keyword occurs in another section. However, we can provide the section number additionally as argument for man command.
For example, passwd appears in section 1 and section 4. If we want to get documentation of passwd in section 4, we use,
$ man 4 passwd    OR    $ man –s4 passwd (on Solaris)
apropos: lists the commands and files associated with a keyword. Example:
$ apropos FTP
ftp ftpd
ftp(1) in.ftpd(1m)
-file transfer program
-file transfer protocol server
ftpusers    ftpusers(4) -file listing users to be disallowed
ftp login privileges whatis: lists one-liners for a command.
Example:
$ whatis cp
cp    cp(1)    -copy files

5.    what are the different types of files in UNIX (june/july2009, December 2012)

SOLN: Types of files
A simple description of the UNIX system is this:
“On a UNIX system, everything is a file; if something is not a file, it is a process.”
A UNIX system makes no difference between a file and a directory, since a directory is just a file containing names of other files. Programs, services, texts, images, and so forth, are all files. Input and output devices, and generally all devices, are considered to be files, according to the system.
Most files are just files, called regular files; they contain normal data, for example text files, executable files or programs, input for or output from a program and so on.
While it is reasonably safe to suppose that everything you encounter on a UNIX system is a file, there are some exceptions.
Directories: files that are lists of other files.
Special files or Device Files: All devices and peripherals are represented by files. To read or write a device, you have to perform these operations on its associated file. Most special files are in /dev.
Links: a system to make a file or directory visible in multiple parts of the system's file tree. (Domain) sockets: a special file type, similar to TCP/IP sockets, providing inter−process
networking protected by the file system's access control.
Named pipes: act more or less like sockets and form a way for processes to communicate with each other, without using network socket semantics.
Ordinary (Regular) File
This is the most common file type. An ordinary file can be either a text file or a binary file.
A text file contains only printable characters and you can view and edit them. All C and Java program sources, shell scripts are text files. Every line of a text file is terminated with the newline character.
Directory File
A directory contains no data, but keeps details of the files and subdirectories that it contains. A directory file contains one entry for every file and subdirectory that it houses. Each entry has two components namely, the filename and a unique identification number of the file or directory (called the inode number).
When you create or remove a file, the kernel automatically updates its corresponding directory by adding or removing the entry (filename and inode number) associated with the file.
Device File
All the operations on the devices are performed by reading or writing the file representing the device. It is advantageous to treat devices as files as some of the commands used to access an ordinary file can be used with device files as well.
Device filenames are found in a single directory structure, /dev. A device file is not really a  stream of characters. It is the attributes of the file that entirely govern the operation of the device. The kernel identifies a device from its attributes and uses them to operate the device.

6.    Compare internal and external commands in UNIX with suitable example. Explain why cd command cannot be an external command.( December 2012)
SOLN: Some commands are implemented as part of the shell itself rather than separate executable files. Such commands that are built-in are called internal commands. If a command exists both as an internal command of the shell as well as an external one (in /bin or /usr/bin), the shell will accord top priority to its own internal command with the same name. Some built-in commands are echo, pwd, etc.
You can change to a new directory with the cd, change directory, command. cd will accept both absolute and relative path names.
Syntax
cd [directory] Examples
cd
cd / cd ..
changes to user's home directory
changes directory to the system's root goes up one directory level
cd ../.. goes up two directory levels
cd /full/path/name/from/root changes directory to absolute path named
(note the leading slash)
cd path/from/current/location changes directory to path relative to current
location (no leading slash)

UNIT 2

Basic File Attributes, the vi Editor

1.    A file’s current permission are rw_r_xr_ _ specify the chmod expression required to change them for the following :
i) rwx rwx rwx ; ii) r_ _ r_ _ _ _ _ ; iii) _ _ _ _ _ _ _ _ _ ; iv) _ _ _ r _ _ r_ _ using both the relative and absolute methods of assigning permission.
(Dec.09/Jan.10 )

0 comments:

Post a Comment