1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Dominik [7]
3 years ago
6

In the following shell scripting extract, the initial values of variables s, c and p are 0, 1, 1 respectively. What will be the

final value of s, at the end of the while loop?

Computers and Technology
1 answer:
____ [38]3 years ago
3 0

Answer:

The first example simply counts the number of lines in an input file. It does so by iterating over all lines of a file using a while loop, performing a read operation in the loop header. While there is a line to process, the loop body will be executed in this case simply increasing a counter by ((counter++)). Additionally the current line is written into a file, whose name is specified by the variable file, by echoing the value of the variable line and redirecting the standard output of the variable to $file. the current line to file. The latter is not needed for the line count, of course, but demonstrates how to check for success of an operation: the special variable $? will contain the return code from the previous command (the redirected echo). By Unix convention, success is indicated by a return code of 0, all other values are error code with application specific meaning.

Another important issue to consider is that the integer variable, over which iteration is performed should always count down so that the analysis can find a bound. This might require some restructuring of the code, as in the following example, where an explicit counter z is introduced for this purpose. After the loop, the line count and the contents of the last line are printed, using echo. Of course, there is a Linux command that already implements line-count functionality: wc (for word-count) prints, when called with option -l, the number of lines in the file. We use this to check wether our line count is correct, demonstrating numeric operations on the way.

You might be interested in
A cloud data storage company develops a proprietary system of hardware and software, trains its systems analysts on the technolo
cupoosta [38]

Answer:

Creating Strategic Fit

Explanation:

Strategic fit expresses the degree to which an organization is matching its resources and capabilities with the opportunities in the external environment. The matching takes place through strategy and it is therefore vital that the company has the actual resources and capabilities to execute and support the strategy. Strategic fit can be used actively to evaluate the current strategic situation of a company as well as opportunities such as M&A and divestitures of organizational divisions.

7 0
3 years ago
We are supposed to go to the concert tomorrow, but it has been raining for three days straight. I just know that we won’t be abl
Mumz [18]

Its the worried tone

Hope this helps!

3 0
3 years ago
Read 2 more answers
Mightier than the waves of the sea is his love for you
Inessa05 [86]

cool but kinda creepy ngl

8 0
3 years ago
Your office printer was working earlier in the day but is no longer printing any documents. Pre-existing workstations are manual
VARVARA [1.3K]

Answer:

I think it is either A or B

Explanation:

3 0
3 years ago
Many documents use a specific format for a person's name. Write a program whose input is: firstName middleName lastName, and who
never [62]

Answer:

Python Program:

if __name__ == '__main__':

   a = input("Enter Name: ")

   b = a.split()

   print(b[2] + ',' , b[0], b[1][0])

Explanation:

The input function will be used to prompt user to enter the name of the person. The person's name will be stored in variable a.

Let us assume that the user entered a name mentioned in the example, which is Pat Silly Doe, Now variable a = 'Pat Silly Doe'.

The function a.split() is used to split a string into a list. The splitting (by default) is done on the basis of white-space character. Therefore, a.split() will give a list

['Pat', 'Silly', 'Doe']

which will be later on stored in variable b.

We can use the subscript operator [] to access the values in a list. Suppose if we have a list a, then a[i] will give us ith element of a, if i < length of a.

Finally, we print the answer. b[2] will give us the last name of the person. We append a comma using '+' operator. b[0] will give us the first name. b[1] will give us the middle name, but since we only need one character from the middle name, we can use another subscript operator b[1][0] to give us the first character  of the middle name.

Note: Characters of strings can be accessed using subscript operator too.

4 0
3 years ago
Other questions:
  • Why are there 2 types of ip addresses like 172.16.254.1 or 2001:db8:0:1234:0:567:8:1?
    10·1 answer
  • Course hero 21. say you have a /15 network address. you are asked to create subnets with at least 1,000 hosts/ subnet. what is t
    9·1 answer
  • Will there be a season 3 of Gravity Falls?
    5·2 answers
  • For what parties the prepare documentation ​
    9·1 answer
  • Animations and transitions are added from the _____.
    11·2 answers
  • How do I write the yearly salary for something without copying it word for word? I'm doing a PowerPoint ( which you had to choos
    15·1 answer
  • What is cloud computing?
    9·1 answer
  • Individuals who break into computer systems with the intention of doing damage are called​ _____________.
    5·1 answer
  • Uploading Your Work
    14·1 answer
  • Design a for loop that gets 6 integer numbers from a user, accumulates the total of them, then displays the accumulated total to
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!