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.

___ function is used for joining lists.

A. foreach
B. for
C. split
D. join
Answer» E.
2.

___ is known as range operator.

A. . .
B. $1
C. $.
D. $_
Answer» B. $1
3.

The command @x=(1. .10) will assign first ten integer values to the array ‘a’.

A. True
B. False
C. May be
D. Can't say
Answer» B. False
4.

For deleting the elements from the right of the array ___ function is used.

A. pop
B. push
C. queue
D. shift
Answer» B. push
5.

Which function can combine the functionalities of push, pop, unshift and shift?

A. splice
B. add
C. delete
D. split
Answer» B. add
6.

To add elements to the right side of the array ____ function is used.

A. pop
B. push
C. queue
D. unshift
Answer» C. queue
7.

File x .c has 5 lines of code. The commanddate l tee abc l sort - x. c l wc -1, displays

A. 5
B. 6
C. 0
D. an error message
Answer» C. 0
8.

For looping in a list, ____ is used.

A. for
B. fordo
C. foreach
D. while
Answer» B. fordo
9.

awk doesn’t use $ in evaluation or assignment of variables.

A. True
B. False
C. may be
D. Can't say
Answer» B. False
10.

Which option is used for storing awk programs in a file?

A. -e
B. -f
C. -i
D. -h
Answer» B. -f
11.

awk supports the use of arrays.

A. True
B. False
C. May be
D. Can't say
Answer» B. False
12.

Which of the following is not true about awk arrays?

A. they are not expanded automatically
B. they are initialized to zero or an empty string
C. index can be a string also
D. they are not formally defined
Answer» B. they are initialized to zero or an empty string
13.

Which function is used by perl for displaying the length of a string?

A. string
B. len
C. split
D. length
Answer» E.
14.

___ function returns the first occurrence of a character in a string.

A. string
B. index
C. split
D. length
Answer» C. split
15.

We cannot perform sorting on columns using sort command.

A. True
B. False
C. May be
D. Can't say
Answer» C. May be
16.

Context switch changes the process mode from

A. user to kernel mode
B. kernel to user mode
C. kernel mode to the kernel process
D. Both (a) and (b)
Answer» E.
17.

awk uses _____ dimensional arrays.

A. one
B. two
C. multi
D. three
Answer» B. two
18.

The ___ prefix to an array name signifies the last index of the array.

A. $0
B. $#
C. #$
D. $_
Answer» C. #$
19.

Which of the following is referred to as default variable?

A. $0
B. $1
C. $!
D. $_
Answer» E.
20.

A user-defined variable is initialized to ____

A. zero
B. zero or null string
C.
D. operator
Answer» C.
21.

___ operator is used for selecting current line number.

A. $0
B. $1
C. $.
D. $_
Answer» B. $1
22.

The printf function uses ___ for string data and ___ for numeric.

A. %f, %l
B. %s, %f
C. %s, %d
D. %s, %s
Answer» D. %s, %s
23.

head -n 3 emp.lst | tr ‘[a-z]’ ‘[A-Z]’Above command will change the case of text from lower to upper.

A. True
B. False
C. May be
D. Can't say
Answer» B. False
24.

______ option is used for compressing multiple consecutive characters.

A. -d
B. -c
C. -n
D. -s
Answer» E.
25.

The output of the following command will be:$ uniq foo1 foo2

A. erroneous
B. output stored in foo2
C. concatenates both files
D. process foo1 and output is stored in foo2
Answer» E.
26.

To perform context addressing, we have to enclose the pattern in ____

A. double quotes
B. single quotes
C. / /
D. $ $
Answer» D. $ $
27.

The following command will match the lines beginning with ‘2’.$ grep “^2” emp.lst

A. True
B. False
C. May be
D. Can't say
Answer» B. False
28.

The following command will match ‘Agarwal’, ‘agarwal’ and ‘agrawal’.$ grep “[aA]g[ar][ar]wal” emp.lst

A. True
B. False
C. May be
D. Can't say
Answer» B. False
29.

If there are special characters in a pattern, then we’ve to enclose them in ______

A. single quotes
B. double quotes
C. without any quotes
D. all quotes
Answer» C. without any quotes
30.

perl is ____ of grep, tr, sed and awk.

A. subset
B. superset
C. child
D. parent
Answer» C. child
31.

Which of the following will be used to print lines containing ‘manager’ in emp.lst?

A. awk ‘/manager/ { print }’ emp.lst
B. awk ‘/manager { print }’ emp.lst
C. awk ‘/manager/ { print } emp.lst
D. awk ‘manager { print }’ emp.lst
Answer» B. awk ‘/manager { print }’ emp.lst
32.

For deleting the elements from the left of the array ___ function is used.

A. pop
B. push
C. queue
D. shift
Answer» E.
33.

To repeat a string, perl uses ___ operator.

A. /
B. .
C. x
D. \\
Answer» D. \\
34.

____ function breaks up a string on the basis of delimiter.

A. length
B. substr
C. system
D. split
Answer» E.
35.

Which of the following are concatenation operators?

A. /
B. .
C. _
D. \\
Answer» E.
36.

The command $ sed -n ‘$p’ emp.lst will display the last line.

A. True
B. False
C. May be
D. Can't say
Answer» B. False
37.

Which of the following is an associative array?

A. a[ ]
B. arr[ ]
C. envr [ ]
D. ENVIRON[ ]
Answer» E.
38.

We can specify filenames in command line using perl.

A. True
B. False
C. May be
D. Can't say
Answer» B. False
39.

The following will display :perl -e ‘print “UNIX” x 10 . “\n” ;’

A. UNIX
B. UNIX 10 times
C. error message
D. \n
Answer» C. error message
40.

____ section can be used if we’ve to print something after processing the last line.

A. end
B. begin
C. start
D. first
Answer» C. start
41.

Perl also supports use of for loop in the following manner.for($i=0;$i

A. True
B. False
C. May be
D. Can't say
Answer» B. False
42.

awk uses ___ operator for concatenating strings.

A. >
B. |
C. *
D. no operator available
Answer» E.
43.

To add elements to the left side of the array ____ function is used.

A. pop
B. push
C. queue
D. unshift
Answer» E.
44.

sqroot(x) function returns the square root of x.

A. True
B. False
C. May be
D. Can't say
Answer» C. May be
45.

____ section can be used if we’ve to print something before processing the first line.

A. end
B. begin
C. start
D. first
Answer» C. start
46.

The following command will produce an error.$ cut -d “|” -f 1,4 emp.lst

A. True
B. False
C. May be
D. Can't say
Answer» C. May be
47.

Which one of the following commands is incorrect?

A. $ cut -d “|” -f 1,4 emp.lst
B. $ cut -c -3 emp.lst
C. $ tail -c -511 foo
D. $ tail -c 500 foo
Answer» E.
48.

Which function is identical to Strstr ( )?

A. Strlen ( )
B. Strchar ( )
C. Strcmp ( )
D. None of them
Answer» C. Strcmp ( )
49.

Process of breaking up a long string into words is called as

A. Stroking
B. Delimiters
C. Tokenizing
D. Parsing
Answer» D. Parsing
50.

Case functions are used for

A. Changing lowercase to uppercase
B. Changing the length of string
C. String replacement functions
D. Searching functions
Answer» B. Changing the length of string