Explore topic-wise MCQs in Testing Subject.

This section includes 657 Mcqs, each offering curated multiple-choice questions to sharpen your Testing Subject knowledge and support exam preparation. Choose a topic below to get started.

1.

The ‘mapfile’ command

A. reads lines of standard input and assigns each to the element of an indexed array
B. reads lines of standard output file
C. reads lines of standard error file
D. none of the mentioned
Answer» B. reads lines of standard output file
2.

The command ‘umask -S’

A. prints the current mask using symbolic notation
B. prints the current mask using octal numbers
C. sets the mask to 000
D. sets the mask to 777
Answer» B. prints the current mask using octal numbers
3.

The ‘logout’ built in command is used to

A. shutdown the computer
B. logoff of the computer
C. logout the current user
D. to exit the current shell
Answer» E.
4.

The command ‘hash’

A. manages a internal hash table
B. find and remember the full path name of the specified command
C. displays used command names and the number of hits
D. all of the mentioned
Answer» E.
5.

Which command concatenate the specified argument into a single command, then execute the command?

A. fc
B. eval
C. exec
D. getopts
Answer» C. exec
6.

Which command can create environment variable?

A. export
B. set
C. read
D. none of the mentioned
Answer» B. set
7.

The command ‘enable -n ‘

A. enables the specified built-in command
B. disables the specified built-in command
C. print the status of the command
D. none of the mentioned
Answer» C. print the status of the command
8.

The command ‘disown -r’

A. removes all jobs
B. removes all running jobs
C. marks jobs to not receive SIGHUP when bash exits
D. marks all jobs
Answer» C. marks jobs to not receive SIGHUP when bash exits
9.

Which command prints the directory stack?

A. cd
B. dirs
C. popd
D. pushd
Answer» C. popd
10.

Which statement resumes the next iteration of a for, while, select, or untill loop?

A. continue
B. break
C. complete
D. command
Answer» B. break
11.

The command ‘compgen -c’ shows

A. all variable names
B. all system wide aliases
C. full list of all commands
D. none of the mentioned
Answer» D. none of the mentioned
12.

What is the function of bind command in bash shell?

A. defining new macros
B. defining new key bindings for existing commands
C. dumping the installed key bindings
D. all of the mentioned
Answer» E.
13.

Which command sets up shorthand for command or command line?

A. set
B. alias
C. new
D. echo
Answer» C. new
14.

Which command terminates a running process by name of the process?

A. kill
B. pkill
C. killall
D. none of the mentioned
Answer» D. none of the mentioned
15.

‘stty tostop’ command will

A. stop all jobs running in the shell
B. stop background jobs if they try to send output to the terminal
C. this is not a valid command
D. none of the mentioned
Answer» C. this is not a valid command
16.

‘kill %s’ command will

A. terminate the job whose command line starts with s
B. terminate the last job
C. terminate the first job
D. none of the mentioned
Answer» B. terminate the last job
17.

Which command brings a background job into the foreground?

A. fg
B. bg
C. jobs %1
D. none of the mentioned
Answer» B. bg
18.

Ctrl-Z key combination

A. generates a SIGINT signal
B. stops the process running in the shell
C. kills the process running in the shell
D. generates a SIGINT signal & kills the process running in the shell
Answer» C. kills the process running in the shell
19.

What is job number?

A. same as PID
B. a unique number, assigned to each job in shell
C. same as PID and a unique number, assigned to each job in shell
D. none of the mentioned
Answer» C. same as PID and a unique number, assigned to each job in shell
20.

Which command allows to view the current jobs being handled by the shell?

A. jobs
B. view
C. show
D. none of the mentioned
Answer» B. view
21.

Which one of the following is not correct about job control in bash shell?

A. it is the ability to stop and resume any process running in shell at a later point
B. user employs this facility via an interactive interface supplied by the kernel’s terminal driver and bash
C. it is the ability to create any process
D. none of the mentioned
Answer» D. none of the mentioned
22.

Which command is used to reexecute the previous command?

A. !!
B. !cat
C. !3
D. !$
Answer» B. !cat
23.

fc stands for

A. find command
B. fix command
C. both find & fix command
D. none of the mentioned
Answer» D. none of the mentioned
24.

Which one of the following is bitwise ‘exclusive or’ operator?

A. ^=
B. |=
C. !=
D. none of the mentioned
Answer» B. |=
25.

If a and b are 2 variables then the meaning of a

A. b = a << b
B. a = a << b
C. b = b << a
D. a = a << b
Answer» C. b = b << a
26.

Which expression use the value of the enclosed arithmetic expression?

A. $(())
B. $()
C. ${}
D. $[].
Answer» B. $()
27.

Which built-in command performs integer arithmetic in bash shell?

A. let
B. get
C. set
D. none of the mentioned
Answer» B. get
28.

To redefine a variable, it can be removed from the list of variables by using the command

A. unset
B. delete
C. remove
D. clear
Answer» B. delete
29.

Which one of the following is not a valid shell variable?

A. _san
B. san_2
C. _san_2
D. 2_san
Answer» E.
30.

Which one of the following statement is true about variables in shell?

A. variables do not require declaration before assigning value to them
B. variables are case sensitive
C. to extract the contents of a variable, we have to provide the variable a preceding $
D. all of the mentioned
Answer» E.
31.

Which command reads user input from the terminal and assign this value to a variable name?

A. read
B. get
C. declare
D. set
Answer» B. get
32.

In the shell, by default, all variables are considered and stored as

A. string
B. integer
C. character
D. float
Answer» B. integer
33.

Functions improves the shell’s programmability significantly, because

A. when we invoke a function, it is already in the shell’s memory, therefore a function runs faster than seperate scripts
B. function will not provides a piece of code for repetative tasks
C. all of the mentioned
D. none of the mentioned
Answer» B. function will not provides a piece of code for repetative tasks
34.

The keyword ‘local’ is used

A. to define a variable within a function for its local scope
B. to redefine any global variable
C. this is not a valid keyword
D. none of the mentioned
Answer» B. to redefine any global variable
35.

Which of the following command provides the list of the functions defined in the login session?

A. declare -f
B. declare -F
C. both declare -f and -F
D. none of the mentioned
Answer» D. none of the mentioned
36.

Parameters can be passed to a function

A. by using the parameter variables $1, $2, $3…….
B. by using the environment variables
C. by using the parameter & environment variables
D. none of the mentioned
Answer» B. by using the environment variables
37.

When the return value of any function is not specified within the function, what function returns?

A. nothing
B. exit status of the last command executed
C. 0
D. none of the mentioned
Answer» C. 0
38.

What is the command that can print lines of first file matching with second file?

A. printline
B. cmp
C. com
D. comm
Answer» E.
39.

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
Answer» B. user1 tty 0 1234
40.

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
Answer» B. sort -u foo | uniq -d
41.

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
Answer» C. grep ‘[a-zA-Z0-9]’
42.

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
Answer» C. grep ‘[BOB]’ files
43.

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
Answer» B. uniq -d
44.

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
Answer» C. The count of lines that ends with the pattern echo in file abc
45.

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
Answer» D. fileAB, fileBC and fileABC
46.

How can you search for blank line in a file?

A. $ grep “ “ file
B. $ grep “^$” file
C. $ grep [“ “] file
D. $ grep [^$] file
Answer» C. $ grep [“ “] file
47.

Which option of grep displays the line number as well?

A. -v
B. -l
C. -n
D. -E
Answer» D. -E
48.

Which variable will display the list of the positional parameters?

A. $#
B. $*
C. $?
D. $$
Answer» C. $?
49.

What is the output of the following command for bash shell: echo linux $0

A. linux echo
B. linux linux
C. linux bash
D. linux
Answer» D. linux
50.

What command would send the output of cmd1 to the input of cmd2?

A. cmd1 | cmd2
B. cmd1 || cmd2
C. cmd1 && cmd2
D. cmd1 ; cmd2
Answer» B. cmd1 || cmd2