Genesis Insoft The name you can TRUST
twitterlogo facebooklogo
Home  |  Contact Us |  Careers
Unix Question Bank / FAQs

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.

Question1

Which of the following is true?

  1. Both user and superuser can execute the executable file etc/cron
  2. Only user can execute the executable file etc/cron
  3. Only superuser can execute the executable file etc/cron
  4. Neither the user nor the superuser can execute the executable file etc/cron

Answer to Question 1

Question 2

What is the output of the following command?
    ls | grep '^d' | wc -l

  1. Gives a count of all the files starting with the word d
  2. gives a count of all the files except the files starting with the word d
  3. gives a count of all the files in present directory
  4. syntax error

Answer to Question 2

Question 3

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

  1. test*
  2. test*5t
  3. testtest*5t
  4. syntax error

Answer to Question 3

Question 4

Default status permission for a file is set based on

  1. chmod
  2. Owner
  3. umask
  4. Group

Answer to Question 4

Question 5

For setting environment variables in Unix which of the following files do you edit

  1. .profile
  2. .exrc
  3. .login
  4. None of the above

Answer to Question 5

Question 6

To compile program in Unix having mathematical library functions, we need to

  1. include math.h
  2. include stdlib.h
  3. cc filename -lm
  4. Both A and C

Answer to Question 6

Question 7

What happens if the following command is executed?

    At 12:00 am Jan 1
    Echo "happy New Year"

  1. Syntax error
  2. At 12:00 am on January 1, displays the message happy new year on the terminal
  3. At 12:00 am on January 1, the following message is mailed by cron
  4. Incorrect usage of at command

Answer to Question 7

Question 8

To list the files in a directory, we need to have

  1. Write permission to the directory
  2. Read permission to the directory
  3. Execute permission to the directory
  4. Both A and B

Answer to Question 8

Question 9

Which one among the following is a filter command?

  1. ls
  2. awk
  3. vi
  4. None of the above

Answer to Question 9

Question 10

What happens if you don't redirect the output to the terminal, when using at command

  1. It would throw a syntax error
  2. It would be mailed to us by the cron
  3. It would throw an error stating improper usage of the at command
  4. Nothing, because by default it would be redirected to the terminal

Answer to Question 10

Question 11

Which of the following provides information regarding which users are allowed and which users are disallowed from using the at command

  1. at.deny and at.allow
  2. at.allow and at.disallow
  3. at.deny and at.show
  4. All of the above

Answer to Question 11

Question 12

Which command would you use to find out how much time is required to execute a particular process?

  1. time
  2. nice
  3. who
  4. ps

Answer to Question 12

Question 13

Using the kill command which of the following processes cannot be killed?

  1. sched
  2. vhand
  3. nice
  4. Both A and B

Answer to Question 13

Question 14

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

  1. grep test one | sort - two > three
  2. grep test one | sort cat two > three
  3. grep test one | sort one | sort two > three
  4. All of the above

Answer to Question 14

Question 15

How can you say that a particular command is a filter or not?

  1. If the command takes only input from the standard input
  2. If the command send only output to the standard output
  3. If the command takes input form the standard input and it sends its output to the standard output
  4. All of the above

Answer to Question 15

Question 16

Which of the following files do you edit for setting the path in Unix

  1. .exrc
  2. .profile
  3. .login
  4. None of the above

Answer to Question 16

Question 17

Which of the following shell variable would change the existing prompt to your name?

  1. PS1
  2. PS2
  3. PATH
  4. HOME

Answer to Question 17

Question 18

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"

  1. 5
  2. 28
  3. 22
  4. Syntax error

Answer to Question 18

Question 19

How to compile a list a files given as command-line arguments, and if they are complied successfully how do we run them?

  1. cc $* || a.out
  2. cc $* && a.out
  3. cc $* -a a.out
  4. cc $* -o a.out

Answer to Question 19

Question 20

If the grep command is successful in finding a pattern, it returns a exit status of

  1. 0
  2. 1
  3. 2
  4. 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

Copyright © 2000 to 2011 Genesis InSoft Limited. All Rights Reserved.