Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages
Filter by Categories
nmims post
Objective Type Set
Online MCQ Assignment
Question Solution
Solved Question
Uncategorized

Linux MCQ Set 1

1. What is sed?
a) a non-interactive stream editor
b) an IDE
c) a hex editor
d) none of the mentioned

View Answer

Answer: a [Reason:] None.

2. Sed maintains the hold space (a buffer) to
a) copy the each line of input
b) save the data for later retrieval
c) copy the each line of input & save the data for later retrieval
d) none of the mentioned

View Answer

Answer: b [Reason:] To copy the each line of input, sed maintains the pattern space.

3. Which is the correct syntax for sed on command line?
a) sed [options] ‘[command]’ [filename].
b) sed ‘[command]’ [options] [filename].
c) sed [filename] [options] ‘[command]’
d) sed ‘[command]’ [filename] [options].

View Answer

Answer: a [Reason:] None.

4. If any sed command does not specify any address then the command is applied to
a) each input line
b) none of the input line
c) last input line
d) none of the mentioned

View Answer

Answer: a [Reason:] None.

5. If no file is specified in sed command then
a) sed command will not work
b) sed reads from standard input
c) sed reads the data already present in buffer
d) it is necessary to provide the filename

View Answer

Answer: b [Reason:] None.

6. Which sed command deletes the specified address range
a) [address range]/s
b) [address range]/p
c) [address range]/d
d) [address range]/y

View Answer

Answer: c [Reason:] To use the command correct syntax specified for sed editor should be followed.

7. Which command is used to replace word ‘cat’ (already present in the file) with ‘mouse’ at all places in a file ‘old.txt’ and save the result in a new file ‘new.txt’?
a) sed ‘s/cat/mouce/g’ old.txt > new.txt
b) sed ‘s/cat/mouse’ old.txt new.txt
c) sed ‘/s/cat/mouse/g’ old.txt new.txt
d) sed ‘/s/cat/mouse’ old.txt > new.txt

View Answer

Answer: a [Reason:] None.

8. Which command will delete all the blank lines in file old.txt?
a) sed ‘/d’ old.txt
b) sed ‘/^/d’ old.txt
c) sed ‘/^$/d’ old.txt
d) sed ‘/^*/d’ old.txt

View Answer

Answer: c [Reason:] None.

9. The command “sed -n ‘/aidlo/p’ old.txt” will
a) print the lines containing the word ‘aidlo’ in file old.txt
b) delete the lines containing the word ‘aidlo’ in file old.txt
c) will generate an error message
d) none of the mentioned

View Answer

Answer: a [Reason:] None.

10. Which option is used by sed to specify that the following string is an instruction or set of instructions?
a) -n
b) -e
c) -f
d) -i

View Answer

Answer: a [Reason:] None.

Linux MCQ Set 2

1. Which one of the following statement is not true?
a) vim editor is the improved version of vi editor
b) vi editor commands are not case sensitive
c) vi editor has two modes of operation: command mode and insert mode
d) vi stands for visual editor

View Answer

Answer: b [Reason:] None.

2. Which command is used to close the vi editor?
a) q
b) wq
c) both q and wq
d) none of the mentioned

View Answer

Answer: c [Reason:] The command ‘q’ just closes the file and ‘wq’ saves and closes the file.

3. In vi editor, the key combination CTRL+f
a) moves screen down one page
b) moves screen up one page
c) moves screen up one line
d) moves screen down one line

View Answer

Answer: a [Reason:] None.

4. Which vi editor command copies the current line of the file?
a) yy
b) yw
c) yc
d) none of the mentioned

View Answer

Answer: a [Reason:] The command ‘p’ puts the copied text after the cursor.

5. Which command is used to delete the character before the cursor location in vi editor?
a) X
b) x
c) D
d) d

View Answer

Answer: a [Reason:] The command ‘x’ is used to delete the character under the cursor locarion.

6. Which one of the following statement is true?
a) autoindentation is not possible in vi editor
b) autoindentation can be set using the command ‘:set ai’
c) autoindentation can be set using the command ‘:set noai’
d) autoindentation is set by default in vi editor

View Answer

Answer: b [Reason:] None.

7. Which command searches the string in file opened in vi editor?
a) / or ?
b) f or F
c) t or T
d) none of the mentioned

View Answer

Answer: a [Reason:] The command ‘/’ searches downward in the file and command ‘?’ searches upward in the file.

8. In vi editor, which command reads the content of another file?
a) read
b) r
c) ex
d) none of the mentioned

View Answer

Answer: c [Reason:] None.

9. Which command shows all the abbreviations in vi editor?
a) ab
b) abb
c) show
d) none of the mentioned

View Answer

Answer: a [Reason:] None.

10. Which command sets the number for all lines?
a) :set li
b) :set ln
c) :set nu
d) :set nl

View Answer

Answer: c [Reason:] None.

Linux MCQ Set 3

1. The file permission 764 means:
a) Every one can read, group can execute only and the owner can read and write
b) Every one can read and write, but owner alone can execute
c) Every one can read, group including owner can write, owner alone can execute
d) Every one can read and write and execute

View Answer

Answer: c [Reason:] None.

2. The permission -rwxr–r– represented in octal expression will be
a) 777
b) 666
c) 744
d) 711

View Answer

Answer: c [Reason:] None.

3. Effective user id can be set using following permission
a) 0777
b) 2666
c) 4744
d) 1711

View Answer

Answer: c [Reason:] None.

4. Effective group id can be set using following permission
a) 0777
b) 2666
c) 4744
d) 1711

View Answer

Answer: b [Reason:] None.

5. Sticky bit can be set using following permission
a) 0777
b) 2666
c) 4744
d) 1711

View Answer

Answer: d [Reason:] None.

6. The permission -rwSr–r– represented in octal expression will be
a) 0777
b) 2666
c) 4744
d) 4644

View Answer

Answer: d [Reason:] None.

7. The permission -rwxr-sr– represented in octal expression will be
a) 0777
b) 2766
c) 2744
d) 2754

View Answer

Answer: d [Reason:] None.

8. If user tries to remove (rm) a readonly file (444 permission), what will happen?
a) The file is removed successfully (and silently)
b) The rm command prompts for a confirmation, the command is successful upon confirmation
c) The rm command prompts for a confirmation, however the operation fails because of insufficient permissions
d) The rm command fails because of insufficient permissions

View Answer

Answer: b [Reason:] None.

9. A user does a chmod operation on a file. Which of the following is true?
a) The last accessed time of the file is updated
b) The last modification time of the file is updated
c) The last change time of the file is updated
d) None of the mentioned

View Answer

Answer: c [Reason:] None.

10. If the umask value is 0002. what will be the permissions of new directory
a) 777
b) 775
c) 774
d) 664

View Answer

Answer: b [Reason:] None.

11. What is the command to set the execute permissions to all the files and subdirectories within the directory /home/user1/direct
a) chmod –r +x /home/user1/direct
b) chmod –R +x /home/user1/direct
c) chmod –f –r +x /home/user1/direct
d) chmod –F +x /home/user1/direct

View Answer

Answer: b [Reason:] None.

Linux MCQ Set 4

1. Which command is used to check filesystem usage in a system?
a) mount
b) df
c) du
d) dd

View Answer

Answer: b [Reason:] None.

2. Which among the following allows fast file system recovery?
a) Ext2
b) Journaling
c) Caching
d) Sysfs

View Answer

Answer: b [Reason:] None.

3. Which filesystem can be used to change certain kernel parameters at runtime using sysctl command?
a) Ext3
b) Sysfs
c) Ext4
d) Procfs

View Answer

Answer: d [Reason:] None.

4. Filesystem for CDROM is:
a) Ext2
b) Ext3
c) Isofs
d) Procfs

View Answer

Answer: c [Reason:] None.

5. Which file system has journaling capability?
a) Ext2
b) Ext4
c) Isofs
d) Procfs

View Answer

Answer: b [Reason:] None.

6. Which file contains the filesystems to be automatically mounted during boot?
a) /etc/mount
b) /etc/fstab
c) /etc/inittab
d) /etc/boot

View Answer

Answer: b [Reason:] None.

7. ____ is a directory (which should exist), on which to mount the file system?
a) Root
b) Boot
c) Mount-point
d) Partition

View Answer

Answer: c [Reason:] None.

8. Which command is used to mount file system read only.
a) mount –a
b) mount –v
c) mount –f
d) mount –r

View Answer

Answer: d [Reason:] None.

Linux MCQ Set 5

1. Which option of grep displays the line number as well?
a) -v
b) -l
c) -n
d) -E

View Answer

Answer: c [Reason:] None.

2. How can you search for blank line in a file?
a) $ grep “ “ file
b) $ grep “^$” file
c) $ grep [“ “] file
d) $ grep [^$] file

View Answer

Answer: b [Reason:] None.

3. Assuming the files fileA, fileB, fileAB, fileBC and fileABC, exist in a directory, which files match with the pattern file[ABC]?
a) fileA, fileB and fileABC
b) fileABC
c) fileA and fileB
d) fileAB, fileBC and fileABC

View Answer

Answer: c [Reason:] None.

4. What will be printed for the command below?
$ grep –c “^echo” abc
a) The count of lines that do not contain the pattern echo in file abc
b) The count of lines which begin with the pattern echo in file abc
c) The count of lines that ends with the pattern echo in file abc
d) None of the mentioned

View Answer

Answer: b [Reason:] None.

5. Which one is used to select only one copy of the repeated lines?
a) uniq -u
b) uniq -d
c) uniq -c
d) uniq –I

View Answer

Answer: a [Reason:] None.

6. Indicate the right option to search for BOB, Bob, BOb or BoB?
a) grep –i Bob files
b) grep ‘B[oO][bB]’ files
c) grep ‘[BOB]’ files
d) grep -v ‘Bob’ files

View Answer

Answer: b [Reason:] None.

7. Indicate the right option to search for anything not a letter or number
a) grep ‘^[a-zA-Z0-9]’
b) grep ‘[^a-zA-Z0-9]’
c) grep ‘[a-zA-Z0-9]’
d) None of the mentioned

View Answer

Answer: b [Reason:] None.

8. How do you remove duplicate lines from the file foo using uniq?
a) sort foo | uniq –u
b) sort -u foo | uniq -d
c) sort foo | uniq –c
d) sort foo | uniq –I

View Answer

Answer: a [Reason:] None.

9. One of the entry of /etc/passwd file is shown below:
user1:x:1111:2222:Aidlo:/home/user1:/bin/bash
Which among the following will print userid and home dir in the following pattern “user1:/home/user1”
a) awk `{print $1 “:” $6}` /etc/passwd
b) awk `{print $1 “:” $7}` /etc/passwd
c) awk `{print $2 “:” $6}` /etc/passwd
d) awk `{print $2 “:” $7}` /etc/passwd

View Answer

Answer: a [Reason:] None.

10. who | cut –d ” ” -f1
what is the ouput if the who command displays like this
user1 tty 0 1234
a) user1
b) user1 tty 0 1234
c) tty
d) tty 0 1234

View Answer

Answer: a [Reason:] None.

11. What is the command that can print lines of first file matching with second file?
a) printline
b) cmp
c) com
d) comm

View Answer

Answer: d [Reason:] None.

12. Which character to use to escape meaning of special characters in search operations?
a) [].
b) ^
c) .
d)

View Answer

Answer: d [Reason:] None.

.woocommerce-message { background-color: #98C391 !important; }