Linux/Unix Interview Questions Part 1

1.How to run a process in the background?
a) |
b) ?
c) &
d) *
2.What would be current working directory at the end of the following command sequence?
$pwd
/home/user1/proj
$ cd src
$ cd generic
$ cd .
$ pwd
a) /home/user1/proj
b) /home/user1/proj/src
c) /home/user1
d) /home/user1/proj/src/generic
3.How do you print the lines between 5 and 10 both inclusive?
a) cat filename | head | tail -6
b) cat filename | head | tail -5
c) cat filename | tail +5 | head
d) cat filename | tail -5| head -10
4.Create a new file new.txt that is concatenation of file1.txt and file2.txt.
a)cp file.txt file2.txt new.txt
b)cat file1.txt file2.txt > new.txt
c)mv file[12].txt new.txt
d)ls file1.txt file2.txt | new.txt
5.Which of these is not a valid variable in bash?
a)__(double underscore)
b)_1var(underscore 1 var)
c)_var_(underscore var underscore)
d)some-var(some hyphen var)
6.What is output of the following code?
os = Unix
echo 1.$os 2."$os" 3.'$os' 4.$os
a)1.Unix 2.Unix 3. Unix 4. Unix
b)1.Unix 2.Unix 3.$os 4.Unix
c).1.Unix 2.Unix 3.Unix 4.$os
d)1.Unix 2.$os 3.$os 4.$os
7.What is the return value ($?) of this code?
os = Unix
[$osName=UnixName] && exit2
[${os}Name=UnixName] && exit3
a)0  b)1  c)2  d)3
8.What is the output of the following program?
x=3;y=5;z=10;
if [($x -eq 3 ) -a ($y -eq 5 -o $z -eq 10 )]
then
echo $x
else
echo $y
fi
a)1  b)3  c)5  d)error
9.The statement z='expr 5/2 ' would store which of the following values in z?
a)0  b)1  c)2  d)2.5
10.The expression expr -9 % 2 evaluates to.
a) 0
b) 1
c) -1
d) 2
11.The file permission 764 means.
a) Every one can read, group can execute only and the owner can read and write
b) Every one can read and write, but owner alone can execute
c) Every one can read, group including owner can write, owner alone can execute
d) Every one can read and write and execute
12.The permission -rwxr–r– represented in octal expression will be.
a) 777
b) 666
c) 744
d) 711
13.Effective user id can be set using following permission.
a) 0777
b) 2666
c) 4744
d) 1711
14.Effective group id can be set using following permission.
a) 0777
b) 2666
c) 4744
d) 1711
15.Sticky bit can be set using following permission.
a) 0777
b) 2666
c) 4744
d) 1711
16.The permission -rwSr–r– represented in octal expression will be.
a) 0777
b) 2666
c) 4744
d) 4644
17.The permission -rwxr-sr– represented in octal expression will be.
a) 0777
b) 2766
c) 2744
d) 2754
18. If the umask value is 0002. what will be the permissions of new directory.
a) 777
b) 775
c) 774
d) 664
19. A user does a chmod operation on a file. Which of the following is true?
a) The last accessed time of the file is updated
b) The last modification time of the file is updated
c) The last change time of the file is updated
d) None of the mentioned
20.Which of the following umask settings allow execute permission to be set by default on regular files.
a) 222
b) 111
c) 000
d) None of the above
Answers:1.c 2.d 3.a 4.d 5.d 6.b 7.d 8.b 9.c 10.c 11.c 12.c 13.c 14.b 15.d 16.d 17.d 18.b
19.c 20.d
SHARE

vlsi4freshers

Hi I’m Designer of this blog.

    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment