1. What does the command awk \'BEGIN {for(i=1; i<10; i++) {sum += i;} print sum;
ID: 3747330 • Letter: 1
Question
1. What does the command awk 'BEGIN {for(i=1; i<10; i++) {sum += i;} print sum;}' display when it is run?
a. Sum of numbers from 1 to 10
b. Sum of numbers from 1 to 9
c. Results in an error
d. None of the above
2. awk allows the use of functions with and without parantheses. (True or False)
3. awk stores all the environment variables in an associative array called ENV[ ]. (True or False)
4. gawk is an enhanced, public domain version of awk that is part of the GNU system.(True or False)
5. Associative arrays store information as key-value pairs (True or False)
6. The built-in function index(s1,s2) returns position of string s1 in string s2. (True or False)
7. awk allows the creation of user defined functions. (True or False)
8. awk arrays are associative.(True or False)
9. awk allows user defined variables to be used without having to declare them.(True or False)
10. ARGV signifies the number of arguments facilitated at the command line.(True or False)
Explanation / Answer
According to chegg guidelines i have to solve first four bits only but i solve first five bits
1.
'BEGIN {
for(i=1; i<10; i++) // It runs from 1 to 9
{
sum += i; // It sums the numbers from 1 to 9
}
print sum; // print Sum of numbers from 1 to 9
2.
True
3.
True
4.
True
5.
Example:
insert(key, value) // This function task is Add a (key, value) pair to the associative array.
True
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.