This is a mock Exam for the Unix programmers. It is created by Genesis InSoft Limited
(admin@genesisinsoft.com)
and may be freely distributed so long as it is unmodified. Please email us if you
have any corrections or comments.
Which of the following is true?
- Both user and superuser can execute the executable file etc/cron
- Only user can execute the executable file etc/cron
- Only superuser can execute the executable file etc/cron
- Neither the user nor the superuser can execute the executable file etc/cron
Answer to Question 1
What is the output of the following command?
ls | grep '^d' | wc -l
- Gives a count of all the files starting with the word d
- gives a count of all the files except the files starting with the word d
- gives a count of all the files in present directory
- syntax error
Answer to Question 2
What is the output of the following code
A=$1
B=$2
for i in $A
do
mv $i ${i}$B
done
if the arguments passed are
test *5t
- test*
- test*5t
- testtest*5t
- syntax error
Answer to Question 3
Default status permission for a file is set based on
- chmod
- Owner
- umask
- Group
Answer to Question 4
For setting environment variables in Unix which of the following files do you edit
- .profile
- .exrc
- .login
- None of the above
Answer to Question 5
To compile program in Unix having mathematical library functions, we need to
- include math.h
- include stdlib.h
- cc filename -lm
- Both A and C
Answer to Question 6
What happens if the following command is executed?
At 12:00 am Jan 1
Echo "happy New Year"
- Syntax error
- At 12:00 am on January 1, displays the message happy new year on the terminal
- At 12:00 am on January 1, the following message is mailed by cron
- Incorrect usage of at command
Answer to Question 7
To list the files in a directory, we need to have
- Write permission to the directory
- Read permission to the directory
- Execute permission to the directory
- Both A and B
Answer to Question 8
Which one among the following is a filter command?
- ls
- awk
- vi
- None of the above
Answer to Question 9
What happens if you don't redirect the output to the terminal, when using at command
- It would throw a syntax error
- It would be mailed to us by the cron
- It would throw an error stating improper usage of the at command
- Nothing, because by default it would be redirected to the terminal
Answer to Question 10
Which of the following provides information regarding which users are allowed and
which users are disallowed from using the at command
- at.deny and at.allow
- at.allow and at.disallow
- at.deny and at.show
- All of the above
Answer to Question 11
Which command would you use to find out how much time is required to execute a particular
process?
- time
- nice
- who
- ps
Answer to Question 12
Using the kill command which of the following processes cannot be killed?
- sched
- vhand
- nice
- Both A and B
Answer to Question 13
The correct way to search for a pattern in a file one, sort that file and file called
two and write the contents of the sorted files to a new file called three is
- grep test one | sort - two > three
- grep test one | sort cat two > three
- grep test one | sort one | sort two > three
- All of the above
Answer to Question 14
How can you say that a particular command is a filter or not?
- If the command takes only input from the standard input
- If the command send only output to the standard output
- If the command takes input form the standard input and it sends its output to
the standard output
- All of the above
Answer to Question 15
Which of the following files do you edit for setting the path in Unix
- .exrc
- .profile
- .login
- None of the above
Answer to Question 16
Which of the following shell variable would change the existing prompt to your name?
- PS1
- PS2
- PATH
- HOME
Answer to Question 17
What is the output of the following program?
echo "Enter your name"
read name
t=`expr $name | wc -c | bc`
echo "The length of the given string is $t"
if the input given is "this is a test from genesis"
- 5
- 28
- 22
- Syntax error
Answer to Question 18
How to compile a list a files given as command-line arguments, and if they are complied
successfully how do we run them?
- cc $* || a.out
- cc $* && a.out
- cc $* -a a.out
- cc $* -o a.out
Answer to Question 19
If the grep command is successful in finding a pattern, it returns a exit status
of
- 0
- 1
- 2
- 3
Answer to Question 20
Answers
Answer 1 - D
Back to question 1
Answer 2 - A
Back to question 2
Answer 3 - B
Back to question 3
Answer 4 - C
Back to question 4
Answer 5 - B
Back to question 5
Answer 6 - D
Back to question 6
Answer 7 - C
Back to question 7
Answer 8 - C
Back to question 8
Answer 9 - B
Back to question 9
Answer 10 - B
Back to question 10
Answer 11 - A
Back to question 11
Answer 12 - A
Back to question 12
Answer 13 - D
Back to question 13
Answer 14 - A
Back to question 14
Answer 15 - C
Back to question 15
Answer 16 - B
Back to question 16
Answer 17 - A
Back to question 17
Answer 18 - D
Back to question 18
Answer 19 - B
Back to question 19
Answer 20 - A
Back to question 20