Awk Programming Question:
Download Questions PDF

What is the output of this program?

#! /usr/bin/awk -f
BEGIN {
a=0
do {
print "google"
a++
} while (a<5)
}
a) "google" will print 4 times
b) "google" will print 5 times
c) nothing will print
d) syntax error

Awk Programming Interview Question
Awk Programming Interview Question

Answer:

b) "google" will print 5 times
Output:
root@ubuntu:/home/google# ./test.awk
google
google
google
google
google
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 {
for(i=0;i<=5;i++) {
print i
i++
}
}
a) 0,2,4 will print
b) 1,3,5 will print
c) 1,2,3,4,5 will print
d) syntax error because i is not initialised
The command "awk '{if ("9″>"10″) print "google" else print "linux"}'"
a) will print "google"
b) will print "linux"
c) will generate syntax error
d) none of the mentioned