Unix/Lunux/Linux Mcqs Questions Set 6 Sample Test,Sample questions

Question:
All numeric values are represented within awk in

1.double precision floating point

2.integer

3.exponential notation

4.fixed point


Question:
An awk program can be run by

1.including the program in the command that runs awk

2.putting it into a file and run with a command

3.running an executable awk script

4.all of the mentioned


Question:
Concatenation is performed by

1.writing expressions next to one another, with no operator

2.conditional operator

3.relational operator

4.matching operator


Question:
If any sed command does not specify any address then the command is applied to

1.each input line

2.none of the input line

3.last input line

4.none of the mentioned


Question:
If no file is specified in sed command then

1.sed command will not work

2.sed reads from standard input

3.sed reads the data already present in buffer

4.it is necessary to provide the filename


Question:
If the argument is supplied to the exit statement,

1.its value is used as the exit status code for the awk process

2.syntax error will generate

3.exit returns status 0

4.exit returns status 1


Question:
In awk program, the statement “print” with no items

1.is equivalent to “print $0”

2.prints the entire current record

3.is equivalent to “print $0” & prints the entire current record

4.none of the mentioned


Question:
In awk, the built-in variable FS is

1.input field seperator

2.output field seperator

3.record seperator

4.subscript seperator


Question:
In vi editor, the key combination CTRL+f

1.moves screen down one page

2.moves screen up one page

3.moves screen up one line

4.moves screen down one line


Question:
In vi editor, which command reads the content of another file?

1.read

2.r

3.ex

4.none of the mentioned


Question:
RSTART is set by invoking the

1.match function

2.index function

3.asort function

4.split function


Question:
Sed maintains the hold space (a buffer) to

1.copy the each line of input

2.save the data for later retrieval

3.copy the each line of input & save the data for later retrieval

4.none of the mentioned


Question:
The break statement

1.jumps out of the innermost for loop

2.jumps out of the innermost while loop

3.jumps out of the innermost do-while loop

4. all of the mentioned


Question:
The built-in function tolower()

1.converts all lowercase characters into uppercase characters

2.returns the string with all lowercase characters

3.changes the nonalphabetic characters

4.none of the mentioned


Question:
The command awk {if (“9″>”10”) print sanfoundry else print linux}

1.will print sanfoundry

2.will print linux

3.will generate syntax error

4.none of the mentioned


Question:
The command “awk {print $1} san.txt” will

1.print the first line of file san.txt

2.print the first field of every line in san.txt

3.generate syntax error

4.none of the mentioned


Question:
The command “sed -n ‘/sanfoundry/p’ old.txt” will

1.print the lines containing the word ‘sanfoundry’ in file old.txt

2.delete the lines containing the word ‘sanfoundry’ in file old.txt

3.will generate an error message

4.none of the mentioned


Question:
The comparison expression x ~ y will true if

1.x is not equal to y

2.the string x does not match the regular expression denoted by y

3.the string x matches the regular expression denoted by y

4.none of the mentioned


Question:
The next statement

1.immediately stops processing the current record

2.go to the next record

3.immediately stops processing the current record & go to the next record

4.none of the mentioned


Question:
The print and printf statements can be told to send their output to other place except standard output, is called

1.redirection

2.redistribution

3.reinsertion

4.none of the mentioned


Question:
What is expression in awk programming?

1.expression evaluates a value to print, test or pass to a function

2.expression assigns a new value to a variable or field

3.expression evaluates a value to print, test or pass to a function & also assigns a new value to a variable or field

4.none of the mentioned


Question:
What is FNR?

1.FNR is the current record number in the current file

2.FNR is the number of fields in the current input record

3.FNR is an array contains the value of environment

4.None of the mentioned


Question:
What is sed?

1.a non-interactive stream editor

2.an IDE

3.a hex editor

4.none of the mentioned


Question:
What is the difference between the built-in functions rand() and srand() in awk programming?

1.rand() generates the random number but srand() does not generate the random number

2.rand() generates the same random number always whenever the program runs but srand() generates the different

3.srand() requires the seed() function but rand() does not require to produce the same result

4.none of the mentioned


Question:
What is the meaning of $ sign in awk programming?

1.the word following is the name of variable

2.we are refering to a field or column in the current line

3.$ sign is used for comment

4.none of the mentioned


Question:
What is the output of the command awk ‘BEGIN {printf “%c
”,65}’

1.A

2.65

3.syntax error

4.none of the mentioned


Question:
Which built-in function divides string into pieces seperated by fieldsep and stores the pieces in array?

1.split()

2.divide()

3.index()

4.sub()


Question:
Which built-in function returns the arctangent of a/b in radians.

1.atan2(a/b)

2.atan(a/b)

3.atan_2(a/b)

4.none of the mentioned


Question:
Which command executes ‘command’ in place of the current process instead of creating a new process?

1.exec

2.command

3.trap

4.none of the mentioned


Question:
Which command is used to close the vi editor?

1.q

2.wq

3.both q and wq

4.none of the mentioned


Question:
Which command is used to delete the character before the cursor location in vi editor?

1.X

2.X

3.D

4.d


Question:
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’?

1.sed ‘s/cat/mouce/g’ old.txt > new.txt

2.sed ‘s/cat/mouse’ old.txt new.txt

3.sed ‘/s/cat/mouse/g’ old.txt new.txt

4.sed ‘/s/cat/mouse’ old.txt > new.txt


Question:
Which command searches the string in file opened in vi editor?

1./ or ?

2.f or F

3.t or T

4.none of the mentioned


Question:
Which command sets the number for all lines?

1.:set li

2.:set ln

3.:set nu

4.:set nl


Question:
Which command shows all the abbreviations in vi editor?

1.ab

2.abb

3.show

4.none of the mentioned


Question:
Which command will delete all the blank lines in file old.txt?

1.sed ‘/d’ old.txt

2.sed ‘/^/d’ old.txt

3.sed ‘/^$/d’ old.txt

4.sed ‘/^*/d’ old.txt


Question:
Which is the correct syntax for sed on command line?

1.sed [options] ‘[command]’ [filename].

2.sed ‘[command]’ [options] [filename].

3.sed [filename] [options] ‘[command]’

4.sed ‘[command]’ [filename] [options].


Question:
Which one of the following is not true?

1.there are 3 types of constant expressions: numeric, string and regular

2.arithmetic operators are used to evaluate expressions

3.assignment expression is an expression that stores a value into a variable

4.comparison expressions does not compare strings for relationship


Question:
Which one of the following is not true?

1.nawk is the new version of awk

2.gawk is the GNU version of awk

3.linux users have the gawk

4.nawk does not provide the additional capabilities in comparison of awk


Question:
Which one of the following is not true?

1.in typical awk program, all input is read either from standard input or specified files

2.awk language divides its input into records and fields

3.running an executable awk script

4.the number of fields need to be a constant


Question:
Which one of the following is used by awk to control the conversion of numbers to string?

1.RS

2.OFMT

3.SUBSEP

4.RSTART


Question:
Which one of the following statement is not true about the format-control letters for printf statement in awk program?

1.c prints a number as an ASCII character

2.d prints a decimal integer

3.h prints an unsigned hexadecimal integer

4.o prints an unsigned octal integer


Question:
Which one of the following statement is not true?

1.awk’s built-in functions can be categorised into three categories: numeric, string and I/O

2.built-in functions are always available to call

3.extra arguments to built-in function causes syntax error

4.we can also define the function in awk program


Question:
Which one of the following statement is not true?

1.vim editor is the improved version of vi editor

2.vi editor commands are not case sensitive

3.vi editor has two modes of operation: command mode and insert mode

4.vi stands for visual editor


Question:
Which one of the following statement is true?

1.autoindentation is not possible in vi editor

2.autoindentation can be set using the command ‘:set ai’

3.autoindentation can be set using the command ‘:set noai’

4.autoindentation is set by default in vi editor


Question:
Which option is used by sed to specify that the following string is an instruction or set of instructions?

1.-n

2.-e

3.-f

4.-i


Question:
Which sed command deletes the specified address range

1.[address range]/s

2.[address range]/p

3.[address range]/d

4.[address range]/y


Question:
Which statement instructs gawk to stop processing the current data file?

1.next

2.nextfile

3.exit

4.exitfile


Question:
Which statement skips over the rest of the loop body, causing the next cycle around the loop to begin immediately?

1.continue

2.break

3.next

4.none of the mentioned


Question:
Which vi editor command copies the current line of the file?

1.yy

2.yw

3.yc

4.none of the mentioned


More MCQS

  1. Unix MCQS Set 1
  2. Unix MCQS Set 2
  3. Unix MCQS Set 3
  4. Unix MCQS Set 4
  5. Linux Mcqs Questions Set 1
  6. Linux Mcqs Questions Set 2
  7. Linux Mcqs Questions Set 3
  8. Linux Mcqs Questions Set 4
  9. Linux Mcqs Questions Set 5
  10. Linux Mcqs Questions Set 6
  11. Linux Mcqs Questions Set 7
  12. Linux Mcqs Questions Set 8
  13. Linux Mcqs Questions Set 9
  14. Linux Mcqs Questions Set 10
  15. Linux Mcqs Questions Set 11
  16. Linux Mcqs Questions Set 12
  17. Linux Mcqs Questions Set 13
  18. Linux Mcqs Questions Set 14
  19. Unix MCQ Set 01
  20. Unix MCQ Set 02
  21. UNIX SYSTEM Mcq
  22. Unix MCQ
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!