Awk Programming Question:
Download Questions PDF

What is the output of this program?

#! /usr/bin/awk -f
BEGIN {
a=10;
b=10;
print a==b ? "true":"false"
}
a) true
b) false
c) syntax error
d) none of the mentioned

Answer:

a) true
Output:
root@ubuntu:/home/google# chmod +x test.awk
root@ubuntu:/home/google# ./test.awk
true
root@ubuntu:/home/google#

Download Awk Programming Interview Questions And Answers PDF

Previous QuestionNext Question
What is the output of this program?

#! /usr/bin/awk -f
BEGIN {
one=10;
two=3;
print (one%two)+10
}
a) (one%two)+10
b) 13
c) 11
d) syntax error
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