a) jumps out of the innermost for loop
b) jumps out of the innermost while loop
c) jumps out of the innermost do-while loop
d) all of the mentioned
Answer: d
Clarification: None.
2. Which statement skips over the rest of the loop body, causing the next cycle around the loop to begin immediately?
a) continue
b) break
c) next
d) none of the mentioned
Answer: a
Clarification: None.
3. The next statement
a) immediately stops processing the current record
b) go to the next record
c) immediately stops processing the current record & go to the next record
d) none of the mentioned
Answer: c
Clarification: None.
4. If the argument is supplied to the exit statement,
a) its value is used as the exit status code for the awk process
b) syntax error will generate
c) exit returns status 0
d) exit returns status 1
Answer: a
Clarification: None.
5. Which statement instructs gawk to stop processing the current data file?
a) next
b) nextfile
c) exit
d) exitfile
Answer: b
Clarification: None.
6. What is the output of this program?
-
#! /usr/bin/awk -f
-
BEGIN {
-
a=5
-
while (a<5) {
-
print ""
-
a++;
-
}
-
}
a) nothing will print
b) “” will print 5 times
c) program will generate syntax error
d) none of the mentioned
7. What is the output of this program?
-
#! /usr/bin/awk -f
-
BEGIN {
-
a=0
-
do {
-
print ""
-
a++
-
} while (a<5)
-
}
a) “” will print 4 times
b) “” will print 5 times
c) nothing will print
d) syntax error
8. What is the output of this program?
-
#! /usr/bin/awk -f
-
BEGIN {
-
a=6
-
do {
-
print ""
-
a++
-
} while (a<5)
-
}
a) nothing will print
b) “” will print 5 times
c) “” will print 4 times
d) “” will print only 1 time
9. 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
10. The command “awk ‘{if (“9″>”10”) print “” else print “linux”}’”
a) will print “”
b) will print “linux”
c) will generate syntax error
d) none of the mentioned