assignment unix & shell programming

8
AMITY SCHOOL OF DISTANCE LEARNING Post Box No. 503, Sector-44 Noida – 201303 Unix & Shell programming (MCA) Assignment A Marks 10 Answer all questions. 1. Discuss the features of UNIX operating system that have made them such phenomenally successful Operating systems. 2. What is shell programming? Write a shell program to print all the contents of an existing text file in upper case 3. Describe what the grep command does? Illustrate its use with an original example. 4. Write a shell program to generate the first “n” terms of the following sequence without using multiplication. 1 2 4 8 16 32……… 5. What are filters? Give some examples of commands that can be used as filters Unix & Shell programming (MCA) Assignment B Marks 10 Answer all questions. 1. What are the different kinds of file systems available to UNIX operating system. 2. Write shell programs for the following: i. To find second largest number among the 5 numbers given. ii. To find sum of all the alternate digits in a given 7 digit number. iii. To count number of vowels in a given string. iv. To take 2 strings as input, concatenate them and display the length of the resultant string. v. To display the reverse of a given number. 3. Write the UNIX commands for the following

Upload: mohit-aggarwal

Post on 20-Jun-2015

1.905 views

Category:

Technology


7 download

TRANSCRIPT

Page 1: Assignment  unix  & shell programming

AMITY SCHOOL OF DISTANCE LEARNINGPost Box No. 503, Sector-44

Noida – 201303 Unix & Shell programming

(MCA)

Assignment A Marks 10

Answer all questions.

1. Discuss the features of UNIX operating system that have made them suchphenomenally successful Operating systems.

2. What is shell programming? Write a shell program to print all the contents of an existing text file in upper case

3. Describe what the grep command does? Illustrate its use with an original example.

4. Write a shell program to generate the first “n” terms of the following sequence without using multiplication.

1 2 4 8 16 32………5. What are filters? Give some examples of commands that can be used as filters

Unix & Shell programming (MCA)

Assignment B Marks 10

Answer all questions.

1. What are the different kinds of file systems available to UNIX operating system.

2. Write shell programs for the following:i. To find second largest number among the 5 numbers given.

ii. To find sum of all the alternate digits in a given 7 digit number.iii. To count number of vowels in a given string.iv. To take 2 strings as input, concatenate them and display the length of the resultant string.v. To display the reverse of a given number.

3. Write the UNIX commands for the followingi) To display the sizes and names of the six largest files in /bin, listed in descending

order of their size.ii) To display the number of words in the last 250 lines of any file.iii) To display the name of the oldest file (and only the oldest file) in the current working

directory.iv) To show the number of all files and directories (including hidden ones, but not. or.) in

the directory /bin.v) Use the ps command, and the grep command, in a pipeline to find all the processes

owned by you.4. Read the case description given below and answer the question contained

CASE STUDY

Page 2: Assignment  unix  & shell programming

What is an i-node and what information is contained in it? Describe how named files are mapped to i-nodes. How is the information associating disc blocks with i-nodes represented? What restrictions are placed on name to i-node links to simplify file system recovery?

Unix & Shell programming (MCA)

Assignment C Marks 10

Answer all questions.

1. UNIX uses ls to list files in a directory. The corresponding command in MSenvironment is--

a) lfb) listc) c dird) None of above

2. A file with extension .txt--

a) Is a text file created using vi editorb) Is a text file created using a notepadc) Is a text file created using wordd) a) & b) above

3. What is POSIX?

a) A standard operating system interface and environment.b) A version of the UNIX operating system.c) A portable platform for Java programming.d) A subsystem of Windows NT, 2000 and XP that isolates the Executive from

platform-specific hardware differences

4. Which of the following files in the current directory are identified by the regularexpression a?b*.

a) afileb) aabc) abbd) abce) axbbf) f. abxy

5. For some file the access permissions are modified to 764. Which of the followinginterpretation are valid?

a) Every one can read, group can execute only and the owner can read and write.b) Every one can read and write, but owner alone can execute.c) Every one can read, group including owner can write, owner alone can execute d) None of above

6. The file’s properties in Windows environment include which amongst the following?

a) File owners’ nameb) File sizec) The date of last modificationd) Date of file creation

Page 3: Assignment  unix  & shell programming

e) The folder where it is located

7. Which of the following information is contained in inode structure?

a) The file sizeb) The name of the owner of the filec) The access permissions for the filed) All the dates of modification since the file’s creatione) The number of symbolic links for this file

8. What are utilities?

a) Peripherals that are connected to a computer.b) Operating system routines that execute in supervisor mode.c) Data structures that are part of the kernel of an operating system.d) Shells, compilers and other useful system programs.

9. Which directory under the root contains the information on devices?

a) /usr/binb) /usr/sbinc) /usr/peripherals/devd) /etc/dev

10. What is the command ‘mv’ used for in Unix?a) To display the files in current directoryb) To rename a filec) To move to a different directoryd) To open a file in the Main Viewere) e. None of the Above

11. What is the result of typing the command pwd?

a) It allows you to change the passwordb) It allows you to enter your password to log inc) It will display the name of your computerd) It will show your current location in the file systeme) It will display a list of Protected Web Documents

12. Which unix command will display all files starting with an a?a) mv a*b) cdc) lsd) ls a*e) ls *af) ls a

13. Unix Operating System is--

a) Time Sharing Operating System b) Multi-User Operating System c) Multi-tasking Operating System d) All the Above

14. The program is known as _________ that interacts with the inner part of called kernel.

Page 4: Assignment  unix  & shell programming

a) Compiler b) Device Driver c) Protocol d) Shell

15. Identify the odd thing in the services of operating system--a) Accountingb) Protection c) Error detection and correction d) None of above

16. Dead lock handling in ______ OS, the response time is very critical. a) Multitasking b) Batchc) Online d) Real-time

17. Software is a program that directs the overall operation of the computer facilitates its use and interacts with the user. What are the different types of such software?

a) Operating system b) Language Compilerc) Utilitiesd) All of the above

18. PCB stands for--a) Program Control Blockb) Process Control Block c) Process Communication Blockd) None of the above

19. The primary job of the operating system of a computer is to-- a) Command Resourcesb) Manage Resourcesc) Provide Utilitiesd) Be user friendly

20. Super computers typically employ--a) Real time Operating system b) Multiprocessors OSc) Desktop OS d) None of the above

21. Which one of the following statements correctly describes the relationship between the processes and programs in a computer system at any given moment?

a) Every program stored in secondary memory must be associated with a process.b) A different program must be associated with every process.c) Several programs may be associated with the same process.d) Several processes may be associated with the same program.

22. Multiprogramming systems -- a) Are easier to develop than single programming systems

Page 5: Assignment  unix  & shell programming

b) Execute each job fasterc) Execute more jobs in the same timed) Are used only on large main frame computers

23. Multiprocessing--a) Make the operating system simplerb) Allows multiple processes to run simultaneouslyc) Is completely understood by all major computer vendorsd) Allows the same computer to have the multiple processors

24. Which is not the state of the process?

a) Blockedb) Runningc) Readyd) Privileged

25. The operating system of a computer serves as a software interface between the user and the-a) Hardwareb) Peripheralc) Memoryd) Screen

26. A process is-- a) Program in executionb) A concurrent program c) Any sequential programd) Something Which Prevents Deadlock

27. The kernel of the operating system remains in the primary memory because-- a) It is mostly called (used)b) It manages all interrupt callsc) It controls all operations in processd) It is low level

28. Which of the following statement is not true? a) Multiprogramming implies multitaskingb) Multi-user does not imply multiprocessingc) Multitasking does not imply multiprocessingd) Multithreading implies multi-user

29. The term “Operating System " means--a) A set of programs which controls computer workingb) The way a computer operator works c) Conversion of high-level language in to machine level languaged) The way a floppy disk drive operates

30. What is a shell? a) It is a hardware component b) It is a command interpreterc) It is a part in compilerd) It is a tool in CPU scheduling

31. The operating system manages-- a) Memory

Page 6: Assignment  unix  & shell programming

b) Processorc) Disk and I/O devicesd) All of the above

32. chown means--

a) Changes the mode of operation to kernel modeb) Creates a threadc) Changes the users and/or group ownership of each given filed) Creates a child process

33. The process which terminates before the parent process exits, is called as--a) Zombieb) Orphanc) Childd) None of above

34. Identify the point(s) that is not true w.r.t. signals--a) Signals are software generated interrupts that are sent to a process when an

event happensb) Signal delivery is analogous to hardware interrupts in that a signal can be

blocked from being delivered in the future.c) Most signals are synchronous by nature.d) Most signal cause termination of the receiving process if no action is taken by the

process in response to the signal

35. ---------Works as a command interpretor.

a) Hardware b) Kernal c) Shell d) CPU

36. An important task that the operating system performs is____, which keeps track of the files stored on a PC so that they can be retrieved when needed.

a) File managementb) File listingc) File recoveryd) Disk management

37. The means by which an operating system or any other program interacts with the user is called--

a) user login b) program front-endc) user interfaced) programming interface

38. ---------- was originally developed at AT&T Bell Labs as an operating system a) Linux b) Solarisc) Mac OS X d) UNIX

39. For multiprogramming systems, most UNIX operating systems use--

Page 7: Assignment  unix  & shell programming

a) Swapping b) Demand paging c) Either (a) or (b) d) Neither (a) nor (b)

40. What are the tasks of an Operating System?

a) To manage all hardware and software resourcesb) To Allow creation of documents, images and musicc) To provide a user interfaced) All of the abovee) A and c onlyf) B and c only