Question1
What is the output of the program?
echo "Give input \c";read str
set $str
echo " Give the word \c";read word
count=0
for i in $*
do
if [ $i -eq $word ]
then
count=`expr $count + 1`
fi
done
echo $count
if the input is "This is a test to test your knowledge" and the given word to search is "test"
- Syntax error
- 8
- 2
- 9
Question 2
Which of the following provides information about the current users and their terminal types?
- who | tr -s ' ' | cut -f1,2 -d ' '
- who | tr -s ' ' | cut -f1-2 -d ' '
- who | cut -f1-2 -d ' '
- who | cut -f1,2 -d ' '
Question 3
How can you find out the exit status of a shell script using exit?
- echo $#
- echo $@
- echo $?
- echo $??
Question 4
What is the output of the following shell script, if a file "test" exists?
cat test |
tr -sc A-Za-z | sort | uniq -c | sort -n | tail
- displays the last ten lines from the file "test"
- displays the first ten lines from the file "test"
- displays only the last line from the file "test"
- displays only the first line from the file "test"
Question 5
What is the output of the following shell script?
While true
Do
Sleep 5
Echo "\007 Check it out again \007"
Done
- After every 5 seconds it displays the message \007 Check it out again \007
- After every 5 seconds it displays the message Check it out again in bold letters
- After every 5 seconds it displays the message Check it out again with a beep sound
- None of the above
Question 6
Which of the following option is used to find out whether a given name is the name of a file or a directory?
- -fd
- -d
- -ff
- -f
Question 7
Which command displays maximum of 10 lines from the end of the file?
- Head
- Tail
- Both A and B
- None of the above
Question 8
Which of the following gives the count of number of links of a particular file?
- ls -l |grep filename |cut -f2 -d ' '
- ls |grep filename | tr -s ' ' | cut -f2 -d ' '
- ls |grep filename | cut -f2 -d ' '
- ls -l |grep filename | tr -s ' ' | cut -f2 -d ' '
Question 9
What is the signal number to terminate a process?
- 1
- 9
- 3
- 12
Question 10
Console is a
- Ordinary file
- Character based file
- Stream
- None of the above
Question 11
When you login to Unix system kernel starts
- Init
- Getty
- Device files
- Both A and B
Question 12
What does the following statement perform?
who -u | grep unix | tr -s ' ' | cut -f6 -d ' '
- It will search for all the user logged, and return their login time
- It will search for all the user logged, and return their ideal time
- It will search for all the user logged, and return the time spend by them in the lab
- None of the above
Question 13
Which command displays the first few lines of a particular file?
- grep
- tail
- search
- head
Question 14
What is the significance of execl()?
- It kills the original process and start a new process
- It continues the original process by overlaying memory with a new set of instructions
- It does not kill the original process but creates a copy of the existing one and starts a new process
- None of the above
Question 15
What would be the output of the following shell script "Display", if the files one, two and three exist
echo Displaying the contents of all the files
cat "$*"
It is executed as: sh Display one two three
- displays the contents of the file one, two and three
- displays the contents of the file one and two
- displays the contents of the file two and three
- displays the message cannot open file one two and three
Question 16
// Old ones follow
What does the following shell script do?
echo "Enter the name ";read name
for name
do
if [ -d $name ]
then
echo "YES"
elif [ -f $name ]
then
echo "NO"
else
echo "JUNK"
fi
done
- displays YES if the given name is the name of a directory
- displays NO if the given name is the name of a file
- displays JUNK if the given name is neither a file nor a directory
- All of the above
Question 17
Which of the following command compares two files, and displays bytes and line number if there are differences?
- diff
- cmp
- comm
- ed
Question 18
What is the exit status of the following, if file "one" is existing and the other "file" two in not existing?
cmp one two
- 0
- 1
- 2
- 4
Question 19
When unix is adapted to a new kind of computer, what needs to be done?
- Commands has to be changed
- Command interpreter (shell) has to be modified
- Kernel has to be modified
- None of the above
Question 20
The command which waits for user to login is?
- Init
- Getty
- Kernel
- Getttydef
Answers
Answer 1 - B
Answer 2 - A
Answer 3 - C
Answer 4 - A
Answer 5 - C
Answer 6 - D
Answer 7 - B
Answer 8 - D
Answer 9 - B
Answer 10 - B
Answer 11 - D
Answer 12 - B
Answer 13 - D
Answer 14 - B
Answer 15 - D
Answer 16 - D
Answer 17 - B
Answer 18 - C
Answer 19 - C
Answer 20 - B
No comments:
Post a Comment