Tag: operating systems

Questions Related to operating systems

How could you check if two strings are equal?

  1. test $a -eq $b

  2. test $a -equal $b

  3. test $a = $b

  4. sh -c test $a == $b


Correct Option: A

Which of the following would return the process ID of the sleep command?

  1. sleep 1 & echo $#

  2. test sleep 1

  3. sleep 1 & echo $?

  4. sleep 1 & echo $!


Correct Option: A,C

Which of the following will always output "xyz"?

  1. $abc=xyz; echo $abc

  2. abc=xyz ; echo $abc

  3. export abc=xyz ; echo $abc

  4. abc=xyz; export abc=xyz ; echo $abc


Correct Option: D

How do you get help about the command "cp"?

  1. help cp

  2. man cp

  3. cp ?

  4. f2 cp


Correct Option: B

AI Explanation

To get help about the command "cp" in the terminal, you can use the "man" command followed by the command you want help with. The correct answer is B.

Option A) help cp - This option is incorrect because the "help" command is used to get help about built-in shell commands, not external commands like "cp".

Option B) man cp - This option is correct. The "man" command is used to display the manual pages for a command. By typing "man cp" in the terminal, you will get detailed information about the "cp" command, including its usage, options, and examples.

Option C) cp ? - This option is incorrect because typing "cp ?" would not give you any help or information about the "cp" command. The question mark is not recognized as a command or argument in this context.

Option D) f2 cp - This option is incorrect because typing "f2 cp" would not give you any help or information about the "cp" command. "f2" is not a recognized command or argument in this context.

The correct answer is B. Using the "man" command followed by the command you want help with, such as "man cp", will provide you with the necessary information about the "cp" command.

  1. mv new old

  2. none

  3. cp new old

  4. rm new old


Correct Option: A

What do you use to forward errors to a file?

  1. 2> filename

  2. 1> filename

  3. &> filename

  4. 2> /dev/null


Correct Option: D

What command do you have to use to go to the parent directory?

  1. cd -

  2. cd ..

  3. cd ~

  4. cd /up


Correct Option: C
  1. rm filename

  2. less filename

  3. touch filename

  4. dl filename


Correct Option: A