Unix Question Answers


Hello friends in this post we are going to discuss about Unix Multiple choice questions with answers | Unix MCQ with answers | Unix Objective type questions with answers | Unix Wipro TrendNXT Question answers

If you are looking for more Dumps for MYSKILLZ Visit Here

1 )chown utility

a) changes file owner ship

b) changes group owner ship

c) changes file and group owner ship

d) none

ans – c

2) the user interacts with the unix system or application using

a)hardware

b)shell

c)device drivers

d)compiler

Ans:

Shell: This is an interface between the user and the kernel. It interprets the commands from a user and executes the resulting request. Post processing the commands kernel returns back the instructions to the shell.

User: communicates with Shell through Commands.

3)

 #!/bin/ksh

While [$# -gt 0]

Do

last “@”

Shift done

Echo $last

a ) first secone third

b)First  second

C)First

d)Third

 Ans:

Note:Required to run the script practically by running the script with required parameters andand provide answer

Eg:

$# = number of arguments. Answer is 3.

$@ = what parameters were passed. Answer is 1 2 3

4)

Print hello abc infinite times

5)

{ echo “$# args”

}

Set one two three “ four not five”

$ count args “$@”

a)1 args

b)4 args

c)6 args

d)None

6)

The environment variable which specifies the locations in which the shell should look for commands or executables

a)manpath

b)look

c)dir

d) PATH

7)

  $ export myvar=(This is unix UNIX assignment)

$echo & {myvar[3]}

Anss: UNIX

8) process running command

a) bc

 b) ps

 c) jobs

d) list

The ps command displays active processes.

9)how does the root user execute the command mycmd –af as the user mydb in the user ‘mydb’ environment?

a) exec mydb “mycmd –af”

d exec –env –l mydb “mycmd –af”

Ans:

10) $ export var1=wipro

$echo $var1

Wipro Technologies

$/bin/bash

$echo $var1

Xxxx

$export var1-india

$exit

$echo $var1

Yyyy

a)null,Wipro Technologies b)wipro,india

c)wipro,Wipro d) wipro null

Ans:

11

Tail -5 filename

12) The exit status of the unix command

a) 0 success nonzero fail b) non zero if successful and 0 failure.

c) 1 if successful and -1 on failure d) 1 if successful and 0 on failure

Ans: a

After a script terminates, a $? from the command-line gives the exit status of the script, that is, the last command executed in the script, which is, by convention, 0 on success or an integer in the range 1 – 255 on error.

13) what value does $# have? If the shell script called “testscript arg1 arg2″

a) test sciprt   arg1 & nbsp; arg2

b) arg1 arg2 c) 2 d) 3

ans – c

14)

Cat filename

15)

 u= g= o= wipro.file what does it mean? (Options didn’t write it will ask which one enable something)

Not able to understand the question

16)

Option c is correct


17) rwxrwxr-x to rwxr-xr-w?

a) chmod 755 b) chmod g+w c) a&b d)none

18) the command used to get rid of the variables assigned in bourne shell

a) unset b) deset c) disset d) reset

Ans:a

$ unset NAME

where NAME is the variable name, and value is a character string that is the value of the variable. If the string includes blanks (i.e. if it encompasses multiple values), enclose the string in double quotes, e.g.,

19) assume  b=5 and ignore the value of assignment. Only focus on valid assignment

a) a=10 b) a=100+$b c) a=$b d) all of the above

ans – d

20) Which of the following variables denotes the command Names?

A. $?  B.$*  C.$0  D.$c

ans – c

21)#/bin/bash

n=”test”

echo $n”$n”1$n1

A. Text n1  B. Test $n1 n1  C. Test Test1   D. Test Test1 Test1

ans – c

22)  ((6>9)) echo ‘$?’

A.0    B.1    C.127    D. Error

ans – a

23)#…..begin of Printargs.sh…….

#!/bin/sh

  echo “$# arguments”

#……end of printargs.sh……..

what is the output on exception of printargs.sh with arguments as below

#sh printargs.sh one two three “four not five”

A.1 argument B.4 Argument c. 6 arggument D.7 argument

ans – b

24)if [$# -eq 0]

 then 

  echo “usage : give multiple integers”

     exit 1

 fi output=0

   until [$# -eq 0]

 do output= ‘expr $output+$1’     (Wrongly Noted this statement)

  shift

done

echo $output

Wht will be the output for input below values:

16,23,44,70,0,50

A.16 B.50 C.96 D. 203

ans – d

25)#!/bin/bash

n=756

r=0

s=0

while[$n -gt 0]

do

s=’expr $n%10′

r=’expr $r\*10+$s’

n=’expr $n/10′

done 

echo ‘$r’

A.750 B.567 C.765 D.657

ans – d

26)Invisible file in Present directory

 A. ls -l B.ls -d C.ls -r D. ls-a

ans – d

27)unix shell , esh, ksh and bash are derived from 

A.C shell B.T shell C.Bourne shell D.k Shell

ans – c

28)a.sh

————

———–

#! user/bin/ksh

ABC=”set in a.sh”

$export ABC=”set at command prompt”

$ksh

$echo $ABC

what would be the output

A.set at command prompt B.set in a.sh C. nothing D. Script error

ans – a

29) which is help command in Unix

display information about bash builtin commands

30)srw -rw -rw root root 0 Mar 24 20:46 /root/server  what this file?

A. Symbolic line B. Sticky bit enabled C. socket D. shared file

ans – a

31) Absolute path:

A) ../home/file.txt B) bin/cat c) /user/cat D)cs2704

Ans:- c

32.Execute permission set for all the files in the text

A. stat %x -R/home/excess

B. chmod -r+x-f/home/excess

C. chmod -R+x/home/excess

D.chmod +rx-f/home/excess

ans – d

33) $? stands for?

The exit status of the last command executed.

34)

Option b is right

35 )$$ holds? The process number of the current shell. For shell scripts, this is the process ID under which they are executing.

36)User attempt to delete a file which is owned by him, which one is true?
A. Any permission on file
B.write permission on file
C.write permission to directory which file located
D.A&C

ans – d

37)

Newvar=”new variable defined”
echo FOO${newvar}BAR
What is output for above?

FOO new variable definedBAR

38)count=1
While(count -le 5)
do
echo $count
done

What is the output for above?

  1. 12345
  2. 1234
  3. There is no loop commands
  4. error

ans – 2

Script is not completely noted. But I guess option B is more suitable.

39)

What is the output for above?

echo ‘set r w x :TFS=”-“;echo”$”

  • r-w-x
    • rwx
    • r
    • no

40) what is output of df?

is a standard Unix command used to display the amount of available disk space for file systems on which the invoking user has appropriate read access.

41) The exit status of the typical unix command using header values 0

42 )What is the output /home/user/mydir

pwd=’pwd’

echo’pwd’ $pwd

a)/home/user/mydir

b)pwd/user/mydir

c)/home/user/mydir//home/user/mydir

d)/home/user/mydir//home/user/mydir1

ans – b

43 )What is the command to list the shell variables?

  1. Set
  2. Disp
  3. Print
  4. None

ans – 1

44) What is the command of expression $[sport[*]}

45)the command which specified the location in which the shell command loops is a command is

  1. manpath
  2. loop
  3. dir
  4. path
  5. home

ans – 5

home or path which ever gives in options

46 ) User attempt to delete a file which is owned by him, which one is true?

  1. Any permission on file
  2. write permission on file
  3. write permission to directory which file located
  4. A&C

ans – 4

47 until=1

 while($until=1)

do

echo ” “

done

What is the question here?

48) echo Foo

${newvar}Boo

Ans: FootextBoo

49)

 n=”Test”

Echo “$n” | ‘$n’,

50)

Count=1

For avg

Do

Echo “Find $count; $avg”

$((count=count + 1)

Done

Exit 0

51) how root user can execute the user in my DB ?

ans: may be su command


Leave a Reply

Your email address will not be published. Required fields are marked *