AWK
Which answer best describes what this script does?
1 BEGIN {
2 MYVAR=0
3 }
4 {
5 OC[$1]++
6 }
7 END {
8 for (C in OC) {
9 print C,OC[C]
10 }
11 }
| a. | Does nothing; the array used on line 5 was never declared |
| b. | Prints a list of field 1 values and a count of how many times that value was encountered |
| c. | Does nothing; arrays must be indexed with an integer |
| d. | Runs, but prints nothing. The process block is missing a pattern statement |
AWK Which answer best describes what this script does? 1 BEGIN { 2 MYVAR=0 3 }...
For this Linux script, answer the questions following it: # Sort lines 7 - 26 of the file BEGIN { idx = 1; while (getline line<"makefile" ) { data[idx] = line; idx++; } for (idx2 = 7; idx2 <= 26; idx2++) { data2[idx2 - 6] = data[idx2]; } count = asort(data2); for (idx3 = 1; idx3 < 7; idx3++) { print data[idx3]; } for (idx3 = 1; idx3 <= 20; idx3++) { print data2[idx3]; } for (idx3 = 27; idx3...
1. All functions should be written AFTER the main procedure. 2. A function prototype should be written for each function and placed BEFORE the main procedure. 3. Each function should have a comment explaining what it does. 4. Each function parameter should have a comment explaining the parameter. 5. Prompt for the number of elements of the list. 6. Allocate an array whose size equals the number of elements specified by the user. 7. Read into the array the elements...
Part 1: Using Idle Write a Python Script that Does the Following 1. At the top of your program, import the math library as in from math import * to make the functions in the math module available. Create a variable and assign into it a constant positive integer number of your choice. The number should be at most 10. 1 Suppose we call this variable x for this writeup document Try something like x = 4 2. Create another...
this is true and false for C++
(1 point each) Circle T for true or F for false for the following questions. 1. T/F The Boolean expression b1 || b2 evaluates to true if either Boolean value (b1, b2) is true. T/F The code we write in C++ (e.g. code in file project1.cpp) is referred to as source code. 2. 3. T/F The statement float scores[3][3] creates 3 arrays, each containing 3 floating-point variables. T/F For loops work best when...
Assignment 6, Merge Arrays (java) Instructions In this assignment, you will write a program which merges two arrays of positive integers and removes any duplicate entries. Your program will first ask for a valid length which must be an integer which is 10 or greater. The program should continue to ask until a valid length is entered. The program will then create two arrays of the length entered, fill these with random integers between 1 and 100 inclusive, and print...
Please help me!
For Problem 1, 2 and 3: You are required to submit three .c
files that contain the instructions that you have written to solve
the following problems. Place the C source code to solve the first
problem in a file called lab5a.c. Place the C source code to solve
the second problem in a file called lab5b.c. And place the C source
code to solve the third problem in a file called lab5c.c. Remember
to include your...
Consider the two strings "doggie dish" and "Drip coffee". What letters do they have in common? That is, what is the letter intersection count for the pair of strings? Let's look at 'd' first. The first string has 2 d's (d's occurrence count is 2), while the second has just 1 d (capitalization doesn't count) - so the intersection for the strings for d is 1. What about g? There the occurrence counts are 2 and 0, so the intersection...
MySQL Multiple Choice Answer as soon as possible 1. What does the pt-table-checksum tool do? (a) It adds a column to every table in every database, that will be populated with the checksum of the row, so that when data is changed, the data can be verified when replicated. (b) It calculates checksums on every table that can be used to compare a table on a master and slave to see if the data matches. (c) It installs and runs...