0

operating systems Online Quiz - 49

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

How would you check f two strings are equal?

  1. a. test $a –eq $b

  2. b. test $a –equal $b

  3. c. test $a = $b

  4. d. sh –c test $a == $b


Correct Option: C

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

  1. a. sleep 1 & echo $

  2. b. sleep 1 & echo $#

  3. c. sleep 1 & echo $$

  4. d. sleep 1 & echo $!

  5. e. sleep 1 && echo $0


Correct Option: D

Which of the following will always output “maple”?

  1. a. $tree = maple;echo $tree

  2. b. tree = maple; echo $tree

  3. c. tree=maple; export $tree; sh –c “echo $tree”

  4. tree=maple; export tree; sh -c "echo $tree"


Correct Option: D
Explanation:

To solve this question, the user needs to have knowledge of basic programming and shell scripts.

Option A is incorrect because the variable $tree is not enclosed in quotes, which will result in a syntax error. The correct way to assign a string value to a variable in PHP is to enclose it in quotes. Thus, the correct syntax for option A is $tree = "maple";echo $tree

Option B is incorrect because the variable tree is not preceded by a dollar sign $, which will result in a syntax error. Thus, the correct syntax for option B is $tree = "maple"; echo $tree

Option C is incorrect because the export command is used to set an environment variable so that it can be accessed by child processes. In this case, the sh -c command creates a new shell process and prints the value of the environment variable $tree. However, since the variable was not exported, it will not be accessible by the new shell process, and the output will be empty. Thus, the correct syntax for option C is tree=maple; export tree; sh –c "echo $tree"

Option D is correct because it correctly assigns the string value "maple" to the variable tree, exports it so that it can be accessed by child processes, and then prints its value using the sh -c command. Thus, the correct answer is:

The Answer is: D

Which of the following will output “cat”?

  1. a. case “dog” in *) echo cat;; esac

  2. b. case “cat” in cat) echo$1 exit

  3. c. case cat dog rabbit; echo $1

  4. d. echo cat | case $1 in cat) echo $1 ;; esac

  5. e. case (cat dog rabbit) {echo $2}


Correct Option: A

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) a. case "dog" in *) echo cat;; esac - This option is incorrect because the case statement is matching "dog" instead of "cat", so it will not output "cat".

Option B) b. case "cat" in cat) echo $1 exit - This option is incorrect because there is no closing parenthesis after the echo statement. Additionally, the exit command is missing a semicolon before it.

Option C) c. case cat dog rabbit; echo $1 - This option is incorrect because the case statement is missing the "in" keyword. Additionally, the echo statement is outside of the case statement.

Option D) d. echo cat | case $1 in cat) echo $1 ;; esac - This option is incorrect because the variable $1 is not defined before the case statement. Also, the pipe "|" operator is not being used correctly in this context.

Option E) e. case (cat dog rabbit) {echo $2} - This option is incorrect because the case statement is missing the "in" keyword. Additionally, the curly braces "{" and "}" are not used correctly in this context.

The correct answer is A) a. case "dog" in *) echo cat;; esac. This option is correct because the case statement matches "dog" and outputs "cat".

Therefore, the correct answer is A) a. case "dog" in *) echo cat;; esac.

Which of the following will output “onetwothree”?

  1. a. for n in one two three ; do echo –n $n ; done

  2. b. for val ; do echo –n $val ; done

  3. for n in one two three ; do echo -n $n ; done

  4. d. foreach n in one two three; do echo –n $n ; done

  5. e. foreach n in one two three { echo –n $n }


Correct Option: C

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) for n in one two three ; do echo -n $n ; done - This option is incorrect because it uses the incorrect syntax for the echo command. The correct option should use a hyphen (-n) instead of an en dash (–n).

Option B) `for val ; do echo -n $val ; done

What is the command to list the processes running in your system.

  1. ifconfig

  2. top

  3. ps

  4. ls


Correct Option: C

command used to see the last few lines of a file?.

  1. less

  2. tail

  3. more

  4. cat


Correct Option: B

what is GNU.

  1. Gnome not Unix

  2. GNU not unix.

  3. gnome

  4. gnometrics


Correct Option: B

which command is used to display the network interfaces in a linux system.

  1. ipconfig

  2. ifconfig

  3. netstat

  4. neat


Correct Option: B

what is K means in KDE sessions.

  1. killer

  2. knome

  3. K (just k, alphabet before L)

  4. kick


Correct Option: C

command for listing file contents page wise

  1. less

  2. huge

  3. make

  4. take


Correct Option: A

command for crating a new file in linux terminal

  1. hold

  2. touch

  3. make

  4. copycom


Correct Option: B

command for deleating a file in linux terminal

  1. del

  2. delete

  3. rm

  4. remove


Correct Option: C

command for listing all the contents of a folder

  1. dir

  2. show contents

  3. show dir contents

  4. ls


Correct Option: D

command for listing file contents normally

  1. cat

  2. dog

  3. mouse

  4. lion


Correct Option: A

what is the name of Linux boot loader

  1. lilo

  2. grub

  3. ntloader

  4. booter


Correct Option: B

how much amount of disk space is needed for a swap partition in general

  1. 4 times to RAM

  2. 3 Times to RAM

  3. 2 times to RAM

  4. RAM size


Correct Option: C

can you install without creating a home partition

  1. yes

  2. no

  3. cant say

  4. dont know


Correct Option: A

using root user in a GUI environment is a security issue ??

  1. yes

  2. no

  3. cant say

  4. dont know


Correct Option: A
- Hide questions