Assignment unix & shell programming


Published on

Published in: Technology
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Assignment unix & shell programming

  1. 1. AMITY SCHOOL OF DISTANCE LEARNINGPost Box No. 503, Sector-44Noida – 201303Unix & Shell programming(MCA)Assignment AMarks 10Answer 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 textfile in upper case3. Describe what the grep command does? Illustrate its use with an originalexample.4. Write a shell program to generate the first “n” terms of the following sequence without usingmultiplication.1 2 4 8 16 32………5. What are filters? Give some examples of commands that can be used as filtersUnix & Shell programming(MCA)Assignment BMarks 10Answer 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 resultantstring.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 descendingorder 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 workingdirectory.iv) To show the number of all files and directories (including hidden ones, but not. or.) inthe directory /bin.v) Use the ps command, and the grep command, in a pipeline to find all the processesowned by you.4. Read the case description given below and answer the question containedCASE STUDY
  2. 2. What is an i-node and what information is contained in it? Describe how named files are mappedto i-nodes. How is the information associating disc blocks with i-nodes represented? Whatrestrictions are placed on name to i-node links to simplify file system recovery?Unix & Shell programming(MCA)Assignment CMarks 10Answer 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 above2. 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) above3. 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 fromplatform-specific hardware differences4. Which of the following files in the current directory are identified by the regularexpression a?b*.a) afileb) aabc) abbd) abce) axbbf) f. abxy5. 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 executed) None of above6. 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
  3. 3. e) The folder where it is located7. 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 file8. 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/dev10. 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 Above11. 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 Documents12. Which unix command will display all files starting with an a?a) mv a*b) cdc) lsd) ls a*e) ls *af) ls a13. Unix Operating System is--a) Time Sharing Operating Systemb) Multi-User Operating Systemc) Multi-tasking Operating Systemd) All the Above14. The program is known as _________ that interacts with the inner part of called kernel.
  4. 4. a) Compilerb) Device Driverc) Protocold) Shell15. Identify the odd thing in the services of operating system--a) Accountingb) Protectionc) Error detection and correctiond) None of above16. Dead lock handling in ______ OS, the response time is very critical.a) Multitaskingb) Batchc) Onlined) Real-time17. Software is a program that directs the overall operation of the computer facilitates its use andinteracts with the user. What are the different types of such software?a) Operating systemb) Language Compilerc) Utilitiesd) All of the above18. PCB stands for--a) Program Control Blockb) Process Control Blockc) Process Communication Blockd) None of the above19. The primary job of the operating system of a computer is to--a) Command Resourcesb) Manage Resourcesc) Provide Utilitiesd) Be user friendly20. Super computers typically employ--a) Real time Operating systemb) Multiprocessors OSc) Desktop OSd) None of the above21. Which one of the following statements correctly describes the relationship between theprocesses 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
  5. 5. b) Execute each job fasterc) Execute more jobs in the same timed) Are used only on large main frame computers23. 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 processors24. Which is not the state of the process?a) Blockedb) Runningc) Readyd) Privileged25. The operating system of a computer serves as a software interface between the user and the-a) Hardwareb) Peripheralc) Memoryd) Screen26. A process is--a) Program in executionb) A concurrent programc) Any sequential programd) Something Which Prevents Deadlock27. 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 level28. 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-user29. The term “Operating System " means--a) A set of programs which controls computer workingb) The way a computer operator worksc) Conversion of high-level language in to machine level languaged) The way a floppy disk drive operates30. What is a shell?a) It is a hardware componentb) It is a command interpreterc) It is a part in compilerd) It is a tool in CPU scheduling31. The operating system manages--a) Memoryb) Processor
  6. 6. c) Disk and I/O devicesd) All of the above32. 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 process33. The process which terminates before the parent process exits, is called as--a) Zombieb) Orphanc) Childd) None of above34. 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 anevent happensb) Signal delivery is analogous to hardware interrupts in that a signal can beblocked 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 theprocess in response to the signal35. ---------Works as a command interpretor.a) Hardwareb) Kernalc) Shelld) CPU36. An important task that the operating system performs is____, which keeps track of the filesstored on a PC so that they can be retrieved when needed.a) File managementb) File listingc) File recoveryd) Disk management37. The means by which an operating system or any other program interacts with the user iscalled--a) user loginb) program front-endc) user interfaced) programming interface38. ---------- was originally developed at AT&T Bell Labs as an operating systema) Linuxb) Solarisc) Mac OS X
  7. 7. d) UNIX39. For multiprogramming systems, most UNIX operating systems use--a) Swappingb) Demand pagingc) 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