Awk(Engineering > Computer Science And Engineering ) Questions and Answers

Question 1. RSTART is set by invoking the
  1.    match function
  2.    index function
  3.    asort function
  4.    split function
Explanation:-
Answer: Option A. -> match function





Question 2. In awk program, the name of the array can not be same with the
  1.    name of variable
  2.    value of the array element
  3.    name of variable & value of the array element
  4.    none of the mentioned
Explanation:-
Answer: Option A. -> name of variable





Question 3. 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.    awk reads an input record and the record is automatically seperated by the interpreter into pieces called fields"
  4.    the number of fields need to be a constant
Explanation:-
Answer: Option D. -> the number of fields need to be a constant





Question 4. 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
Explanation:-
Answer: Option A. -> c" prints a number as an ASCII character





Question 5. 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
Explanation:-
Answer: Option A. -> redirection





Question 6. All numeric values are represented within awk in
  1.    double precision floating point
  2.    integer
  3.    exponential notation
  4.    fixed point
Explanation:-
Answer: Option A. -> double precision floating point





Question 7. 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
Explanation:-
Answer: Option A. -> its value is used as the exit status code for the awk process





Question 8. 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
Explanation:-
Answer: Option C. -> immediately stops processing the current record & go to the next record





Question 9. 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
Explanation:-
Answer: Option C. -> is equivalent to print $0" & prints the entire current record





Question 10. What is the output of this program?#! /usr/bin/awk -f   BEGIN {       print "20"
  1.    true
  2.    false
  3.    syntax error
  4.    none of the mentioned
Explanation:-
Answer: Option A. -> true