11 July 2013

Linux MCQ Questions and Answers - Set 4

2 comments

linux Question and answer in linux
This is set 4 in the ongoing series of MCQ. Hope you have enjoyed the other parts of the series. Like other sets this set also contains some Linux questions with their answers.

1

In Linux which of following command do you use to know the purpose of a command?

which

whatis

what

purpose

Answer
Option B is correct, whatis display the purpose of a command.
$ whatis ls
ls (1) - list directory contents
LS (6) - display animations aimed to correct users who accident...

2

What is the process id of init process?

2

6

4

1

Answer
Process id of init is always 1. init is known as parent of all processes in Linux. You can check it by running following command
$ pidof init
1

3

Suppose I have made some changes in my Php.ini file and I want to restart my Apache server, which of following command should I use?

sudo service apache2 restart

sudo /etc/init.d/apache2 restart

Both A and B

Only A

Answer
Option C is correct. You can use both command restart/start/stop any service.

4

Which command is used to show process hierarchy in tree format?

ps -tree

pstree

ps -t

none of these

Answer
pstree command is used to show process hierarchy in tree format.

5

Which of the following command is used to see the content of tar(backup.tar) file without extracting it?

tar -xvf backup.tar

tar -svf backup.tar

tar -tvf backup.tar

none of these

Answer
Option c is correct. -t option is used to see the content of tar file without extracting it.

6

Which command is used to execute the last command you have executed?

!!

!-1

Both A and B

Only A

Answer
Option C is correct answer. Both A and B is used to execute last command you have executed.

7

What is the purpose of id command?

Print effective and real UID

Print effective and real GID

Print effective and real UID and GID

None of these

Answer
Option c is correct.
$ id
uid=1000(rajkumar) gid=1000(rajkumar) groups=1000(rajkumar),4(adm),20(dialout),24(cdrom),46(plugdev),116(lpadmin),118(admin),124(sambashare)

8

Which command is used to print the login shell of an user?

echo $SHELL

echo $LOGIN

echo $LSHELL

None of the Above

Answer
Option a is correct
$ echo $SHELL
/bin/bash

9

Which of the following command return the exit status of last command?

$!

$$

$?

$#

Answer
$? return the exit status of last command. 0 means success, any other number means failure

10

which command is used to print the current working direcotry?

pwd

echo $PWD

Both A and B

Only A

Answer
option C is correct.

That's it.
Hope you Enjoyed the MCQ :)



If You Liked This Post Please Take a Time To Share This Post

You May Also Like...

2 comments: