Awk Programming Question:
Download Questions PDF

What is the output of this program?

#! /usr/bin/awk -f
print "20"<"9" ? "true":"false"
a) true
b) false
c) syntax error
d) none of the mentioned


a) true
The operands of relational operators are converted to, and compared as string if both are not numbers. Strings are compared by comparing the characters of each. Hence 20 is less then 9.
root@ubuntu:/home/google# chmod +x test.awk
root@ubuntu:/home/google# ./test.awk

Download Awk Programming Interview Questions And Answers PDF

Previous QuestionNext Question
The comparison expression "x ~ y" will true if:
a) x is not equal to y
b) the string x does not match the regular expression denoted by y
c) the string x matches the regular expression denoted by y
d) none of the mentioned
All numeric values are represented within awk in:
a) double precision floating point
b) integer
c) exponential notation
d) fixed point