MCQ Module 5
MCQ Module 5
ANDHRA PRADESH
EXAMINATION CELL
MODULE NO: 5
S. MCQ Image if any
NO
1 Which shell is commonly
used for scripting on Linux
systems?
A Bash YES
B Sh
C Csh
D Ksh
D myVar
3 How do you define a bash
array?
A my_array=(value1, value2,
value3)
B my_array=[value1, value2,
value3]
C my_array={value1, value2,
value3}
D my_array=(value1 value2 YES
value3)
4 Which operator is used for
arithmetic division in bash?
A / YES
B %
C *
D -
5 Which conditional
statement is used to
execute code based on a
single condition in bash?
A if YES
B elif
C else
D switch
6 Which loop statement is
used to execute a block of
code until a condition is met
in bash?
A for
B while YES
C until
D do-while
7 Which command is used to
define a function in bash?
A define
B function YES
C def
D fn
8 How do you access the nth
element of a bash array?
A my_array[n]
B my_array[n-1] YES
C my_array{n}
D my_array[n+1]
9 Which operator is used for
string concatenation in
bash?
A +
B &
C #
D : YES
10 Which conditional
statement is used to
execute code based on
multiple conditions in bash?
A if
B elif
C else
D case YES
B while
C until
D do-while
12 Which of the following is
NOT a valid output
redirection operator in
bash?
A < YES
B >
C >>
D &>
13 Which command is used to
read input from the user in
bash?
A read YES
B input
C get
D scan
14 How do you pass arguments
to a bash function?
A By reference
B By value YES
C By pointer
D By name
15 Which operator is used to
test for string equality in
bash?
A == YES
B =
C !=
D <>
16 Which conditional
statement is used to
execute code based on a
negated condition in bash?
A if
B elif
C else YES
D unless
17 Which loop statement is
used to execute a block of
code at least once in bash?
A for
B while
C until
D Do-while YES
B print
C display
D show
19 How do you delete a bash
variable?
A delete my_variable
B unset my_variable YES
C remove my_variable
D clear my_variable
20 Which operator is used for
integer exponentiation in
bash?
A ^
B ** YES
C //
D ^^
21 Which conditional
statement is used to
execute code based on a
range of values in bash?
A if
B elif
C else
D case YES
22 Which loop statement is
used to execute a block of
code until a condition is
false in bash?
A for
B while
C until YES
D do-while
23 Which of the following is
NOT a valid output
redirection operator in
bash?
A >
B >>
C < YES
D &>
24 Which command is used to
read input from a file in
bash?
A read YES
B cat
C head
D tail
25 How do you declare a global
bash variable?
A By using the -g option
B By not declaring it locally
C By using the export YES
command
D By using the global
command
26 Which operator is used to
test if a string contains a
substring in bash?
A $
B * YES
C %
D #
27 Which conditional
statement is used to
execute code based on the
exit status of a command in
bash?
A if YES
B elif
C else
D test
28 Which loop statement is
used to execute a block of
code for each item in a
bash array?
A for YES
B while
C until
D do-while
29 Which command is used to
redirect the standard output
and standard error streams
to a file in bash?
A >
B >>
C &> YES
D &>>
30 How do you pass an array
to a bash function?
A By reference YES
B By value
C By pointer
D By name
31 Which operator is used to
test for string inequality in
bash?
A ==
B =
C != YES
D <>
32 Which command is used to
write output to a file in
bash?
A write
B output
C cat with > or >> YES
D printf
33 How do you pass a variable
number of arguments to a
bash function?
A By using the shift command
B By using the $@ variable
C By using the $* variable YES
C else
D case
35 Which loop statement is
used to execute a block of
code a specified number of
times in bash?
A for YES
B while
C until
D do-while
36 Which command is used to
redirect the standard input
stream from a file in bash?
A <
B <<
C Both A and B YES
D None
37 Which conditional
statement is used to
execute code based on
multiple possible values of a
variable in bash?
A if
B elif
C else
D case YES
D <<
40 The redirection used for
passing one output to input
as another command is
A >
B | YES
C <
D <<