Вы находитесь на странице: 1из 15

MKICS, BHARUCH UNIX

QUESTION BANK
ON
UNIX & SHELL PROGRAMMING-502 (CORE PAPER-2)

TOPIC 1: VI-EDITOR

S.NO: QUESTION MARKS YEAR


1. Explain set command of vi editor 2 2011oct
2013mar/
2. Explain the modes of vi editor. 7
2013 oct
3. Explain vi editor 5 2011oct
4. List the text modification command of vi editor. 2 2012oct
5. List disadvantages of vi editor 1 2011oct
Which command of vi editor is used to display line 2012oct/
6. 2/5
number before each line? 2011oct

TOPIC 2: QUESTIONS ON SHELL

S.NO: QUESTION MARKS YEAR


1. Explain features of Shell 7 2012,2014
2. What is shell 2 2011
Define a shell. Explain meta character that shell use to
3.
match files names.
4. List process execution meta-characters of shell 2 2010
Write a note on different role played by shell during the
5. 4/7 2010/2014
program execution
How can you create sub-shell? What is the difference
6. 1 2010
between login shell and current shell?
7. Explain command line interpretation of the shell. 6/5 2014/2013
8. Give the significance of special parameters used by shell. 3 2014
List at least two popular shells including their default
9. 2 2013
prompt.

Prepared By: Ms. Nidhi Solanki (Assist. Prof.) Page 1


MKICS, BHARUCH UNIX

TOPIC 3: DIRECTORY & FILE QUESTIONS:

S.NO: QUESTION MARKS YEAR


Discuss relative and absolute file access permissions with
1. 6 2013oct
example.
What do you mean by link? Give the difference between
2013mar/
2. soft link & hard link. Also write disadvantages when using 5/6
2013 oct
soft link.
2014oct/
3. What does /etc/passwd contains? 2
2012oct
4. What are the importance of /tmp directory? 2 2013oct
Explain commands for changing file permissions and
5. 5 2014oct
ownership.
6. What is the purpose of /bin directory of Unix file system? 2 2013oct
2013oct/20
Discuss relative and absolute file access permissions with
7. 6/7/4 11oct/2010
example.(explain chmod)
oct
8. Explain directory structure of UNIX. 7 2013oct
Which file attribute changes when you copy a file from
9. 2 2012oct
other user account
How can you make out whether two files are copies or
10. 2 2012oct
links
11. List the characteristics of Unix file system 2 2013oct
12. Explain the characteristics of Unix file system 7 2012oct
13. Explain types of file in Unix 6 2012oct
Explain commands for changing file permission and
14. 5 2012oct
ownership
15. write detail note on structure file system of Unix 7 2012oct
16. Command to update time of a file 2 2011
17. What does /etc directory contain 2 2011/2010
18. Difference between cat test and cat>test 2 2011
19. What ispPurpose of . and .. 2 2011
20. Purpose of /bin directory 2 2011
21. Difference between absolute and relative path 2 2010
22. Who can change the attribute of file and directory? How 2 2010
How will you forcibly remove a file to which you don’t
23. 2 2010
have write permission?
24. How can you identify the invisible characters in a file 1 2010
25. Purpose of /dev/null? give proper illustration 1 2010
26. Compression and archiving of file 4 2010
27. Which file is parent of all file 2 2010

Prepared By: Ms. Nidhi Solanki (Assist. Prof.) Page 2


MKICS, BHARUCH UNIX

TOPIC 4: QUESTIONS ON KERNEL

S.NO: QUESTION MARKS YEAR


2012,2014,
2013,2011,
1. Explain functions of kernel(list functions of kernel) 7/2 list
2010,2010
oct
2. Explain UNIX kernel structure architecture? 4/7 2010/2014

TOPIC 5: QUESTIONS ON PROCESS

S.NO: QUESTION MARKS YEAR


Define process. Which command is useful to know the
1. status of process? Explain it giving example. What are the 4 2012
three phases in creation of a process?
What is difference between scheduling process using
2. 2 2013/2014
batch command and using at command?
2010/2012/
3. What do you mean by Zombie state of a process? 2
2013
Which process is created by Getty process? What is
4. 2 2011/2014
responsibility of getty process
What do you mean by daemon? List out them. How will
5. 2 2014/2010
you kill a daemon?
6. Explain booting sequence with init process. 7 2014
7. Mechanism of process creation 4 2012
8. Explain fork() system call 2 2011
9. What are the process states in Unix 2 2011
10. How can we suspend background and foreground job 2 2010
11. What is PPID? Which process has PPID 1 2 2010
If following command run from a shell script, who will be
12. the parent and grandparent of all these processes? 2 2010
Cat f1 | cut –f1 | sort –r
13. State the purpose of –n option with sed 2 2010
14. List process execution metacharacter of shell 2 2010
15. What does init do when a user logs out 1 2010
16. Define process? Which process has id PID1 2 2010
17. Write command to kill last background job 2 2010
What is job? How can you move a job from the
18. background to the background to the foreground and vice 2 2010
versa?
19. Define fork 2 2011/2012
What is job? How can we suspend a foreground and
20. 2 2014
background job?

Prepared By: Ms. Nidhi Solanki (Assist. Prof.) Page 3


MKICS, BHARUCH UNIX

TOPIC 6 : PROGRAMMING CONSTRUCTS:

S.NO: QUESTION MARKS YEAR


1. Differentiate between while and until loop? 2 2014
2. Explain for loop with an example 3/4 2014/2010
3. Explain case condition with example in shell 5 2012
4. Explain while loop in shell 2 2011
oct/2011
mar

TOPIC 7 : QUESTIONS ON COMPONENTS OF FILE SYSTEM:

S.NO: QUESTION MARKS YEAR


1. What is the purpose of boot block? What it consists of? 7 2014
2. Where the number of free i-nodes and data block stored? 2 2014
3. Explain the purpose of super block. 5 2010
4. What is super block consist of ? 2 2011/2010
2014/2011/
5. Explain content of I-node block 7/5
2010/4
6. Explain booting sequence with init process. 7 2013
7. The booting process of Unix. 2 2013
8. Write a detail note on I-node table. 7 2012
9. Define I-node number 2 2011

TOPIC 8 : GREP/sed UTILITY THEORY:

S.NO: QUESTION MARKS YEAR


1. Write note on grep utility. 6 (2014)
2. Explain pattern matching features of grep utility. 3 2014/2010/
2010
3. Explain insert append and change command of sed 2013/2010
4. Explain basic regular expression used with grep. 2 2012
5. Explain remembered pattern of sed 2 2011
6. Explain delete and write operator in sed 2 2011
7. State the purpose of –n option with sed 2 2010

Prepared By: Ms. Nidhi Solanki (Assist. Prof.) Page 4


MKICS, BHARUCH UNIX

TOPIC 9 : WRITE COMMANDS


(1 mark each)

TOPIC 9.1 : 2014 oct./nov.


Command using sed or grep

S.NO: QUESTION
1. Display two lines starting from 7th line of file X1.
2. Display all blank lines between line 20 and 30 of file X1.
3. Display lines beginning either with alphabet or digit fro file X1.
4. Display the line that do not contain “unix”
5. Display the lines which are not starting with 2 at the beginning.
6. Write a command to replace ‘UIX OS’ ON LINE NO 5TH TO 10TH.
7. Write a command to display all file name containing only digits in a filename.
8. To list file names consist of only 4 digits.
9. To display lines beginning with alphabets of a file X1.
10. To count number of words in line 40 through 60 of file f1.txt

TOPIC 9.2 : 2013 march/april


commands using grep or egrep. (1 mark each)

S.NO: QUESTION
1. Display the lines which are not starting with 2 at the beginning.
2. Display lines having exactly 50 characters of file X1.
3. Count number of blank lines in file X1.
4. Display lines having at least one * character in file X1.
5. Display lines from file X1 that containing string “UNIX” or “unix” or “Unix”
6. Display the directory listing.

TOPIC 9.3 : 2013 oct/nov


commands using grep or egrep.(1 mark each)

S.NO: QUESTION
1. Write a command to print lines which contain ‘Accounts’.
2. Write a command to print lines which do not contain ‘Accounts’
3. Write a command to print line 10 to 15
4. Write a command to substitute ‘doshi’ with ‘desai’
5. Write a command to print lines with line numbers which contains ‘Marketing’
6. Write a command to display line which starts with “the”

Prepared By: Ms. Nidhi Solanki (Assist. Prof.) Page 5


MKICS, BHARUCH UNIX

TOPIC 9.4 : 2013 march/april


commands using sed. (1 mark each)

S.NO: QUESTION
1. Substitute ‘endif’ with ‘fi’ on line 10 of file X1.
2. Display two lines starting from 7th line of file X1.
3. Display all lines before string Unix from file X!
4. Display all blank lines between line 20 and 30 of file X1.
5. Display lines beginning either with alphabet or digit from file X1.
6. Display the lines that do not contain “Unix”.

TOPIC 9.5 : 2011 mar/apr

S.NO: QUESTION
1. To display all lines that contains pattern ‘bc*’ in a line
2. To locate lines where second and second last character of file f1 are same
3. To replace ‘tybca’ with ‘TYBCA’ in input file ‘in.sh’ and write those lines to output
file ‘out.sh’
4. To replace all occurrence of ‘she’ with ‘he’ and ‘hi’ with ‘hello’
5. To locate lines that begin and end with .(dot)
6. To display line 5 to 15, 25 to 35 and last line of file f1.

TOPIC 9.6 : 2014 march/april

S.NO: QUESTION
1. Write a command to print first seven line of file.
2. Write a command to sort a line of file and also remove a repeated line.
3. Replace all occurrences of ‘SYBCA’ with ‘TYBCA’ in 5th line of file f1.
4. Count all occurrence of ‘tybca’ in studlst.
5. Replace ‘kernel’ with ‘kernel architecture’ using remember pattern of sed utility.
6. To run a utility x1 at 9:00 AM.
7. Write a command to locate the ‘Unix’ ignoring case.
8. Write a command to display occurrence of string ‘tybca’.
9. Write a command to display line, which start with “the”.
10. Write a command to display line, which ends with ‘India’.
11. Write a command to print first six line of file.

Prepared By: Ms. Nidhi Solanki (Assist. Prof.) Page 6


MKICS, BHARUCH UNIX

TOPIC 9.7 : 2013 march/april

S.NO: QUESTION
1. Display lines 10 to 15 from file x1.
2. Display last word of each line from a file x1.
3. To count number of characters in last line of file x1.
4. To count number of words in line 40 through 60 of file f1.txt.
5. To delete all special characters from file x1.
6. Display all line that start with ‘let’, from a file x1.

TOPIC 9.8 : 2013 oct/nov

S.NO: QUESTION
1. To remove duplicate line from a file
2. To count number of characters in last line of file X1.
3. Display the processes of user ‘bca0 I’
4. List the user from /etc/passwd in the alphabetically sorted order
5. Count the frequency of users who are logged in from more than one terminal
6. Display string in upper case of the file f1.txt.

TOPIC 9.9 : 2012 oct/nov(1 mark each)

S.NO: QUESTION
1. Count number of characters in first five lines of file X1.
2. To replace the word computer with computing of file x1.
3. Display lines whose last word is Unix of file x1
4. Display lines starting from 10th line to the end of file X1
5. To delete all special characters from the file X1.
6. To display lines beginning with alphabets of a file X1.
7. To remove a file name as X1?(X1 followed by ? character)
8. To run script X1 in background so that its execution continues even user logout from
the system.
9. To display last line of a file X1.
10. To deny execute permission to a group of a file X1.
11. To create link between file X1 and X1.link

Prepared By: Ms. Nidhi Solanki (Assist. Prof.) Page 7


MKICS, BHARUCH UNIX

TOPIC 9.10 : 2012 mar/apr(1 mark each)

S.NO: QUESTION
1. To print first three lines of file tybca.
2. To sort file by last access time
3. To print field 1 and 6 from file tybca
4. To print unique line of file tybca
5. To print frequency of each line from file tybca
6. To find file having size greater than five
7. To find a file having .c extension
1. Write a command to print line which contain tybca on file dept.lst
2. Write a command to print lines which not contain tybca
3. To print line 6 to 12
4. To replace first occurrence of surat with vyara in each line
5. To print content of file after deleting every ;
6. To sort on 3 column to 5 column
7. To convert small alphabets to capital
8. To print lines with line number which contain ‘Marketing’

TOPIC 9.11 : 2011 oct/nov

S.NO: QUESTION
1. Forcefully delete each file from directory tybca/my work
2. Show all hidden files from mydir/tybca
3. Sort filename by last access time from directory tybca/mywork
4. Rename file chap 1 to unit 1
5. Find out number of lines of file chap01
6. Find out inode number of file chap01
1. write a command to sort a line of file and also remove repeated line
2. Command to locate the tybca ignoring case
3. Command to display occurrence of string ‘Sale’
4. Command to display line which start with ‘the’
5. Command to display line which end with ‘ia’
6. Command to print first three lines of file
7. Command to substitute ‘doshi’ with ‘desai’

Prepared By: Ms. Nidhi Solanki (Assist. Prof.) Page 8


MKICS, BHARUCH UNIX

TOPIC 9.12 : 2011 mar/apr

S.NO: QUESTION
1. Write a command to display all words in file 1 that begin with digit
2. To display total number of words and lines of files for which file name start with ‘m’
3. To remove all leading space from a file f1
4. To display line number before each line
5. To display line 10 to 20 from file f1
6. To remove3 dir. Tree dir1/dir2/dir3 using single command
7. To move all files begin with digit from the parent dir to current dir
8. To convert decimal number 192 to hexadecimal
9. To give read and write permission to file f1
10. To change modification time of a file f1 to dec 01 10:30 am
11. To display all unique words of file f1

TOPIC 10 : AWK UTILITY THEORY:

S.NO: QUESTION MARKS YEAR


1. Using AWK utility explain system variables. (significance) 6/3 2014,2012
2. Using AWK utility explain system variables 6/3 2014/2012
3. Using AWK utility explain Hash Arrays 6 2014
4. Using AWK utility explain any four built in functions 6 2014
2012,2012
march,201
5. Explain concept of array in awk utility 3 1,2011
mar,2010,
2010oct
Write note on pattern matching feature of awk utility
6. 4 2013
giving example
Write an awk script to display file contents in reverse.(i.e
7. last line should be displayed first,…..,first line should be 3 2012
displayed last.)
8. Write operators of awk 2 2011
Write a script using awk utility to create two 3*3 matrix
9. 6 2011
and multiply it
10. Explain matching operators of awk utility with example 6 2011/2010
Differentiate between system variables of awk utility FNR 2010/2010
11. 2
and NR _oct
Explain with example the purpose of BEGIN and END
12. 2 2010
block of awk utility.

Prepared By: Ms. Nidhi Solanki (Assist. Prof.) Page 9


MKICS, BHARUCH UNIX

TOPIC 11 : WRITE COMMANDS


(1 mark each)

TOPIC 11.1 : 2014 nov./dec.


USING awk UTILITY

S.NO: QUESTION
1. print odd numbers of words in each line
2. Print lines no 18 to 30 from file f1.txt.
3. Count the total no. of lines in a file.
4. Count occurrence of pattern ‘Unix’ in file f1.
5. Print lines, which end with 5, 6, and 7 from, file f1.
6. Write a script to print 1 to 10 nos.
7. Write a command to print those lines where field2 is computer field 3> 15000 from
sales file.
8. Display those words whose length is greater than 8 characters and consist of alphabet
only
.

TOPIC 11.2 : 2014 march/april (2 mark each)

S.NO: QUESTION
1. Print even numbers of words in each line.
2. Count occurrence of pattern ‘operating system’ in file f1.
3. Display those words whose length greater than 10 characters and consist of alphabet
only
.
TOPIC 11.3 : 2014 nov./dec.

S.NO: QUESTION
1) Write awk script to display the user login ids, their home directories and login shells
from the “/etc/passwd” file.
2) Switch the first two fields in each line of a text and put the result in a new file
3) To only print lines wherein the first field had a numeric value of less than 20
4) Write script using awk utility to display files contents in toggle case. Assume that file
should be passed from command line.(8)(2010)

Prepared By: Ms. Nidhi Solanki (Assist. Prof.) Page 10


MKICS, BHARUCH UNIX

TOPIC 11.4 : 2014 march/april

S.NO: QUESTION
1. To count number of occurrence of pattern ‘bca’ in file f1
2. To print words whose length is greater than 4 characters and consist digits only
3. To print even number of words in each line

TOPIC 11.5 : 2010 march/april

S.NO: QUESTION
1. Write script using awk utility to display files contents in toggle case. Assume that file
should be passed from command line.(5)
2. Write a script that removes all empty files in current working directory. Appropriate
data validation is expected.(3)

TOPIC 12 : SHELL SCRIPTS:

S.NO: QUESTION MARKS YEAR


1. What is the use of test statement 2 2012
2. Write a shell script to reverse a number. 5 2014
Write a shell script to perform mathematical operations using 2013/2
3. 5
menu. (+_*/) 010
4. Write a shell script to test the file is a executable file or not. 5 2014
Write a shell script to check whether the given file is empty or
5. 5 2013
not
Write a shell script to find smallest of three numbers that are
6. 5 2014
read from keyboard
Write a shell script to validate the name of a person accepted
7. through the keyboard so that it does not exceed 10 chars of 5 2014
length
Write a shell script to display list of all files in the current
8. 5 2012
directory to which you have read write and execute permissions.
2011/2
9. Write a shell script to check the entered no is palindrome or not 4/5/5 012/20
13
Write a shell script to accept two decimal numbers from
10. keyboard and display their sum in hexadecimal form. Make 5 2013
proper validation.
Write a shell script to remove only empty files from current
11. 5 2012
directory

Prepared By: Ms. Nidhi Solanki (Assist. Prof.) Page 11


MKICS, BHARUCH UNIX

12. Check whether the number is Armstrong or not 4 2011


Write a shell script to enter two strings, check they are equal or 2011/2
13. 4
not, also check the length of both strings should greater than 0 010
An integer or a floating point number should be accepted from
user. Write a menu driven script for the following options:
1) convert decimal to binary number
14. 2) convert decimal to octal number 8 2010
3) convert decimal to hexadecimal number

do proper validations
Write a script that removes all empty files in current working
15. 5 2010
directory. Appropriate data validation is needed.
Write script to enter 5 subjects marks from command line and
16. 4 2010
display % and appropriate class
Write script to check entered character is uppercase lowercase
17. 4 2010
numeric digit or special character

TOPIC 13 : COMMANDS

S.NO: QUESTION MARKS YEAR


2013,20
1. Note on ls command with options and example(detail note) 3/7
12
2. Umask 4 2014
2011/20
3. Bc 4
13/2014
4. Ln 2 2013
5. Explain –u,-n,-r options of sort. 2 2013
2014/20
13/2011/
2011
6. Tee 2/3
mar/201
0/2010
oct
7. Mv 2 2014
8. Shift 2 2011
9. explain expr command giving example for string manipulation 5 2014
list default file as well as directory permission when making has
10. 2 2013
been set by the command as umask 333
11. What chmod 615 employee command does? 2 2013
2013,20
12,2011,
12. nice 2
2011
mar

Prepared By: Ms. Nidhi Solanki (Assist. Prof.) Page 12


MKICS, BHARUCH UNIX

13. find command 3 2014


14. what do you mean by Unix internal external command 2 2011
2013,20
15. uniq filter 2
12,2011
16. Wall 2 2013
17. What happened when cd command is run without arguments? 2 2014
18. Explain any two communication command 4 2013
19. -a command 2 2012
20. Why –r option of rm is dangerous 2 2012
2012/20
21. Tr 2
11
22. Kill 2 2012
23. More 2 2012
2012oct,
2012mar
24. Touch 2/2/4/4
ch,2010/
2014
25. Explain -u,-n,-r option of sort 2 2012
26. detail note on diff and comm. 4 2012
2012,20
11/2011
27. sort command with options(any 3 option for 4 marks) 5/7/4
mar,201
0
28. chown and chgrp 4 2012
2012,20
29. Ps 2
10
30. pr and tr filters 4 2012
2011,20
31. diff?example 2 10,2010
oct
32. what is use 0f –v and –n option with cat 2 2011
33. Significance if cp – R option 2 2011
34. Head and tail filters 4 2011
2011,20
35. cmp and comm. 5
10
36. wc and cal 2 2011
37. Explain head filter 2 2012
38. difference between diff and cmp command 2 2011
39. Difference between cat and more command 2 2011
40. What will $echo* command do 2 2011
41. Purpose of –n option with sed 2 2011
42. Difference between ‘grep’ and ‘fgrep’ command 2 2011
43. Difference between cat test and cat>test 2 2011
44. What is purpose of . and .. 2 2011
45. Chmod 2 2011

Prepared By: Ms. Nidhi Solanki (Assist. Prof.) Page 13


MKICS, BHARUCH UNIX

How you use egrep and grep to take pattern from a file? give
46. 5 2011
example
47. Mail command 4 2011
2011/20
48. Significance of sleep and wait command. 2
10
49. Cut and paste command 2 2011
2011/20
50. Why ‘file’ command is used 2
10
51. Why ‘test’ command is used 2 2011
52. Output of tail –20 file 1 2 2011
2010,20
53. Write and eval 2
10oct
54. Use of test statement 2 2010
2010,20
55. Explain online communication commands 4/4
10oct
2010/20
56. batch command 2/3/3/3 14/2013/
2011
57. Explain command mv* ../bin 1 2010
58. Explain cp[!a-zA-Z]* progs. 1 2010
59. Explain significance of ‘expr’ and ‘echo’ 1 2010
60. Explain significance of ‘tty’ 1 2010
61. What is output of head –n 5 f1 and tail +5 f1 command 1 2010
2010/20
14/2013/
62. at command 1/3/3/3/3
2011/20
10
63. Why -r option of rm command is dangerous 2 2010
64. grep command use 2 2010

TOPIC 14 : SOME MORE IMPORTANT SHORT QUESTIONS

S.NO: QUESTION MARKS YEAR


1. Explain here document 2 2012
2. What is major and minor number? 2 2014
3. What do you mean by command substitution? 2 2013
Devise a pipeline sequence which lists five largest files in the
4. 2 2013
current working directory?
5. What is the purpose of ^ in regular expression 2 2013
6. When do wild card characters lose their meaning? 2 2013
7. Define redirection. List out the symbols used for redirection. 2 2013
2013/2
8. Differentiate between $@ and $*(2) 2
013oct/

Prepared By: Ms. Nidhi Solanki (Assist. Prof.) Page 14


MKICS, BHARUCH UNIX

2010/2
010 oct
9. What information contained by $? And $# variable? 2 2014
What will be the output of following code:A=’expr –5%2’ echo
10. 2 2011
$A
What is exit status of a command? What is its normal value, and
11. 2 2014
where is the value store?
12. Explain conditional parameter substitution giving example 5 2012
2012/2
13. What do you mean by pipe give example 2
010
2012,2
14. Remembered pattern and repeated pattern 5
010
15. Explain pipe 1 2011
What is regular expression? Explain any one utility which use
16. 5 2011
regular expression, with proper example
17.
How command substitution differs from piping mechanism?
18. 2 2010
Explain with example
19. Explain booting sequence of Unix OS. 4 2010
What is difference between screen and line editor? List any two
20. 1 2010
names of line and screen editor
What is regular expression? Write a regular expression that
21. 2 2010
matches comment line of c program
22. Explain different role of ^ in regular expression. 2 2010
23. Explain features of Unix OS. 6 2010
Explain remembered pattern and repeated pattern giving suitable
24. 6 2011
example.
25. Give significance of following system variable HOME,PSI 2 2010
26. Explain find operator in detail 5 2011
27. Features of UNIX OS 5 2011
Which attribute change, when* you copy a file from another user
28. 1 2011
account
29. Significance of FSCK utility 1 2011
30. Detail note on FSCK utility of Unix 6 2011
2011/2
31. Purpose of sticky bit 2
010
32. Differentiate > and >> 2 2011

Prepared By: Ms. Nidhi Solanki (Assist. Prof.) Page 15

Вам также может понравиться