JNTUK B.Tech 3-2(R10) UNIX Programming Unit Wise Important Questions For External Examinations
Unit 1 Important Questions
1. What is a process. List and Explain various process utilities with suitable examples.
2. Explain basic file attributes. Discuss the appropriate commands associated with these attributes.
3. "Operating systems like UNIX provide services both for programs and users". Jus- tify this statement with suitableexamples.
4. Explain the significance of the following commands. i. ls - ld ii. ls - l.
5. Give a note on vi editor.
6. What is an operating system? Explain How UNIX fulfills more than that role. Discuss suitable examples.
7. Explain various commands available in UNIX for networking. Discuss suitable examples.
8. Write short notes on:
(a) Unix system services
(b) Shell responsibilities? Inode block.
9. Define Shell and kernel. Differentiate them.
10. Illustrate the cycle of command execution by Unix. 1. (a) What is the difference between the text editing provided by ‘ed’ & ‘vi’ text editors.
11. What are the two operational modes of vi editor? What is the use of each?
Unit 2 Important Questions
1. Explain the different approach taken by diff command to display file differences.
2. Describe ‘comm’ command. Explain the output with -1,-2, or -3 options in ‘comm’ command.
3. Which is the command used for ordering a file? Discuss all the options available for this command. For every option Explain with an example.
4. What is a filter in UNIX? Explain any four filters in detail with examples.
5. How to remove duplicate lines from a file using sort?
6. How to count the number of ordinary files in home directory tree?
7. Select lines 5 to 10 of a file in two ways.
8. Discuss the various backup utilities available in UNIX. Ilustrate with suitable ex- amples.
9. Which is the command used for ordering a file? Discuss all the options available for this command. For every option Explain with an example.
10. . Explain awk, tar, cpio with necessary examples.
11. What is the usage of filters?
12. Explain the following filters. more, cmp, tr, uniq.
13. Explain the following Unix shell commands with examples. cut, paste, egrep, fgrep.
14. What is the purpose of cat?
15. When using cat>abc, What happens if abc already contains something?
16. What happens when you use cat abc>abc?
17. Is the output of the following command be directed to the standard output. Cat abc xyz >/dev/tty.
Unit 3 Important Questions
1. Explain about the usage of multiple commands on the shell command line with example.
2. Write a menu driven shell script Which has following options.
i. Contents of /etc/passwd.
ii. List of users who have currently logged in.
iii. Present working directory.
iv. Exit. .
Make use of case statement. The menu should be placed appropriately in the centre of the screen and should be displayed in bold using the tput command. .
3. While executing a shell script either the LOGNAME or the UID is supplied at the command prompt. Write a shell script to find out at How many terminals has this user logged in?
4. Write a shell script to display first n numbers of Fibonacci series.
5. If x has the value 5, and you reassign it with x="expr $x+10", What is the new value of x? What would have been the value if single quotes were used? What’s wrong with all this anyway?
6. Devise a script that accept 2 directory names bar1 and bar2, and deletes those files in bar2 whose contents are identical to their namespaces in bar1.
7. Write a shell script Which reports names and sizes of all files in a directory (directory would be supplied as an argument to the shell script) whose size is exceeding 1000 bytes. The filename should be printed in descending order of their sizes. The total number of such files should also be reported.
8. Write a C program to search for the word ‘exam’ in a Given file, using Com- mand line arguments.
9. Write a shell script to accept a string from the terminal and use ‘case’ to echo a suitable message if the string does not have at least 10 characters using: i. case ii. expr
10. Write a shell script to display the processes in the system five times every 30 seconds using: i. while loop ii. for loop.
11. Write a shell script for the following task. The word ‘unix’ is present in only some of the files supplied as arguments to the shell script. Your shell script should searched each of these files in turn and stop at the first file that it encounters containing the word ‘unix’. This filename should be displayed on the screen.
12. Write a C program Which receives file names as command line arguments and display those filenames in ascending order according to their sizes.
13. Write a shell script Which will receive any number of filenames as arguments. The shell script should check whether every argument supplied is a file or a directory. If it is a directory it should be appropriately reported. If it is a Filename then name of the file as well as the number of lines present in it should be reported.
14. Write a C program to simulate ‘tail’ command.
15. Write short notes on:
(a) program development & debugging commands
(b) necessary commands to carry on day to day activities.
16. Write a shell script to simulate cp command.
17. Write short notes on shell script arguments.
18. Write a shell script to check whether a Given file is a directory. If so, empty the contents of the directory and remove the directory.
19. How do you clean the screen and place the cursor at row 15 and column 20?
20. Write a shell script to find the decimal equivalent of 1101001.
Unit 4 Important Questions
1. Explain about different conditional exp?ressions available in Bourne shell.
2. Write a shell script Which receives two filenames as arguments. It should check whether the two file’s contents are same or not. If they are same then second file should be deleted. Use ‘cmp’ command to compare files.
3. What is metacharacter? List and Explain about any 7 metacharacters available in unix.
4. Write a shell script Which will receive either the filename or the filename with it’s full path during execution.this script should obtain information about this file as Given by ls - l and display in proper format.
5. What is a shell? What are the responsibilities of a shell?
6. What are the different types of shells available in unix.
7. Write a shell script Which gets executed the moment the user logs in. It should display the message "good morning/good afternoon/good evening" depending upon the time at Which the user logs in.
8. Explain about here documents with an example.
9. Explain following
(a) Shell meta characters
(b) Shell types in Unix
10. What is a loop? Compare and contrast while and until loops.
11. How for loop is used with command line arguments? Explain with a suitable example
12. Write short notes on following commands Trap, export, exit, expr, break, continue
13. Define Unix shell. Explain shell environment.
14. Briefly Explain Different shells available in Unix.
Unit 5 Important Questions
1. Write a C program to print the type of specified file (Regular, device, directory)
2. Write and Explain about hard and symbolic links.. give an example for each.
3. Explain about file descriptors & i-node?
4. Write the difference between fgetc and getc system calls.
5. Write the syntax of fflush system call give an example.
6. Write about ulink system call and give an example.
7. Write about Write system call and illustrate with an example.
8. Explain the differences between fgets, gets system call.
9. Explain link, unlink, remove and rename functions with syntaxes.
10. What are fflush and fseek functions? Explain.
11. Explain in detail about lseek function.
12. What is fcntl function? What is the purpose of using it?
13. Write the syntax of creat function. Explain, how this function is equivalent to open function.
14. Explain in detail, how an opened file can be positioned.
15. What are stat, fstat and lstat functions? Explain.
16. Give the syntaxes for chmod and fchmod functions and state their importance.
17. Write the syntax of following system calls.
Unit 6 Important Questions
1. Write a program to illustrate the vfork function call.
2. Write a program for signal implementation.
3. Write a program which used both kill and raise functions.
4. Write a program which uses abort function.
5. Write a program which used both kill and raise functions.
6. Write the differences between wait and waitpid system calls.
7. Explain threads.
8. Write the system calls for process termination in detail.
9. Explain process creation and process termination in detail.
10. What is a process? Explain waiting for a process in detail.
11. What are the uses of fork function?
12. Write a short note on zombie process.
13. What are the different properties that are inherited by the child from its parent. Explain.
14. What are the differences between parent and child processes.
15. What are the differences between sleep and abort functions? Explain.
16. What is a zombie process? Explain.
17. What are the various properties that are inherited by the child from their parent?
18. Differentiate between parent and child processes.
19. Write the syntax of following functions. Explain each argument.
Unit 7 Important Questions
1. Write a comparative study of adversary and mandatory locking.
2. Write in detail about locking regions.
3. Explain the concept of requesting and releasing a lock.
4. Write in detail about locking regions.
5. Write about different Unix locking techniques.
6. Write a C program to use a function lock test to test for a lock.
7. Write about lockf function.
8. Write the differences between fcntl function and flock function.
9. Write and Explain locking routines using a create( ) system call.
• Explain with examples, competing locks and locking regions in detail.
• Write a short note on competing locks.
• Explain the usage of read and Write functions with locking.
• State the importance of file locking and Explain locking regions in detail.
• What is a null pointer? Explain with example, What happens when we try to access a null pointer.
Unit 8 Important Questions
1. Write about system call pipe . Give an example which uses pipe system call.
2. Explain the logic for opening or creating an IPC channel
3. Explain the following concepts about pipes
- Pipes between two process
- Pipes among three process in a shell
4. Explain the concept of IPC between two processes on a single system. Give Example.
5. What is the data stored by the kernel when a semaphore is created.
6. What is the system call that is used to create a shared memory segment and Explain each field in detail. [8+8]
7. The syntax of msgget system call is int msgget(key t key, int flag)
- Explain type of key
- Explain What value it returns
- What is the use of flag
8. Explain the following concepts
- Pipes in single process
- Pipes in single process, immediately after fork
9. Explain the concept of IPC between two processes on a single system. Give Example
10. What are the advantages and disadvantages of system v IPC?
11. What is a FIFO? Why FIFOs are called as named pipes? Explain
12. Write a program to create a pipe and to execute it on the client.
13. Mention the rules for writing information into the pipe.
14. Compare the IPC functionality provided by pipes and message queues. What are the advantages and drawbacks of each? When is one more suitable than the other.
15. Define Inter Process Communication? Explain IPC between two processes on different systems.
16. What is a pipe? Using pipe, how IPC can be implemented.