Interviewer And Interviewee Guide

Awk Programming Interview Question:

What is the output of this program?

#! /usr/bin/awk -f
BEGIN {
a=5
while (a<5) {
print "google"
a++;
}
}
a) nothing will print
b) "google" will print 5 times
c) program will generate syntax error
d) none of the mentioned

Submitted by: Murtaza
a) nothing will print
Explanation:
The condition of while statement is false so commands inside the loop will not execute.
Output:
root@ubuntu:/home/google# ./test.awk
root@ubuntu:/home/google#
Submitted by: Murtaza

Read Online Awk Programming Job Interview Questions And Answers
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.