0

operating systems Online Quiz - 8

Description: operating systems Online Quiz - 8
Number of Questions: 20
Created by:
Tags: operating systems
Attempted 0/20 Correct 0 Score 0

In vi if we want to replace any string e.g. "NAME" with "name" from line number 1 to 10 only, what command we can use?

  1. :%s/NAME/name/

  2. :1-10s/NAME/name/

  3. :1,10s/NAME/name/

  4. :s/NAME/name/


Correct Option: C

How to check the exit status of the previous command?

  1. $?

  2. $$

  3. $#

  4. $@


Correct Option: A

echo this || echo that && echo other What will be the output?

  1. this

  2. that

  3. this other

  4. this that other


Correct Option: C

AI Explanation

To understand the output of the given command, let's break it down:

The command is: echo this || echo that && echo other

The echo command is used to display a message on the console.

The || operator is the logical OR operator, which means that if the command on the left side of || fails (returns a non-zero exit status), then the command on the right side of || will be executed.

The && operator is the logical AND operator, which means that if the command on the left side of && succeeds (returns a zero exit status), then the command on the right side of && will be executed.

Now, let's evaluate the given command:

  1. echo this - This command will be executed regardless of the previous command's exit status. It will display "this" on the console.

  2. echo that - This command will not be executed because the previous command (echo this) was successful and returned a zero exit status.

  3. echo other - This command will be executed because the previous command (echo this) was successful. It will display "other" on the console.

Therefore, the output of the given command will be "this other", which corresponds to option C.

How could you check if two strings are equal?

  1. test $a -eq $b

  2. test a -eq b

  3. test $a -equal $b

  4. test $a = $b


Correct Option: D
  1. sleep 1 & echo $!

  2. sleep 1 & echo $?

  3. sleep 1 & echo $#

  4. sleep 1 & echo $$


Correct Option: A

Which command will create a soft link to a file?

  1. ls -n

  2. ln

  3. ln -s

  4. link -s


Correct Option: C
  1. ls -lrt file1

  2. ls -lR file1

  3. find . -s file1

  4. find . -name file1


Correct Option: D
  1. $# will print the same

  2. $? will print the same

  3. $! will print the same

  4. $$ will print the same


Correct Option: A

How can we know two text files are identical?

  1. if the output of “cmp -s file1 file2” is not zero

  2. if the output of “cmp -s file1 file2” is zero

  3. if the output of “cmp -s file1 file2” is one

  4. if the output of “cmp -diff file1 file2” is zero


Correct Option: B

The purpose of the nohup command is to prevent programs from closing when you log out. True or False?

  1. True

  2. False


Correct Option: A

How can the time stamps of a file be preserved while copying a file?

  1. cp -i

  2. cp -r

  3. cp -p

  4. cp -R


Correct Option: C
  1. ctrl+c then bg

  2. ctrl+z then bg

  3. ctlr+m then bg

  4. ctrl+z then fg


Correct Option: B

"what does the command do? find . -type f -mtime 2"

  1. list all ordinary files in current dir that have been modified within last 24 hours

  2. list all ordinary files in current dir that have been modified within last 4 days

  3. list all ordinary files in current dir that have been modified within last 48 hrs

  4. list all ordinary files in current dir that have been modified within last 2 hrs


Correct Option: C

AI Explanation

To answer this question, let's break down the command and its options:

The command "find" is used to search for files and directories within a given directory hierarchy.

The dot (.) represents the current directory.

The option "-type f" is used to specify that the search should only include ordinary files (not directories or other types of files).

The option "-mtime 2" is used to specify that the search should include files that have been modified within the last 48 hours. The number 2 represents the number of days.

Therefore, the correct answer is C) list all ordinary files in the current directory that have been modified within the last 48 hours.

what is the name of the data structure to maintain file identification?

  1. inode

  2. filter

  3. kernel

  4. shell


Correct Option: A

How to save the output of any command in a file as well as display the same on the VDU?

  1. echo “hello world” > temp.txt

  2. echo “hello world” | tee temp.txt

  3. echo "hello world">tmp.txt|tee tmp.txt

  4. echo "hello world">tmp.txt|print


Correct Option: B

How can you print the first 10 line of a file

  1. head +10 file

  2. cat file

  3. tail -10 file

  4. head -10 file


Correct Option: D
- Hide questions