Awk Programming Question:
Download Questions PDF

What is the output of this program?

#! /usr/bin/awk -f
BEGIN {
two=2;
two++;
print two
}
a) two
b) three
c) 2
d) 3

Answer:

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

Download Awk Programming Interview Questions And Answers PDF

Previous QuestionNext Question
What is expression in awk programming?
a) expression evaluates a value to print, test or pass to a function
b) expression assigns a new value to a variable or field
c) both (a) and (b)
d) none of the mentioned
What is the output of this program?

#! /usr/bin/awk -f
BEGIN {
var1="google"
var2="linux"
print var1" provides "var2" MCQs "
}
a) google provides linux MCQs
b) var1 provides var2 MCQs
c) provides MCQs
d) syntax error