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
As technology​ advances, A. all opportunity costs increase. B. the PPF shifts outward. C. the PPF shifts inward because unemploy
irinina [24]

Answer:

"Option B" is the correct answer to this question.

Explanation:

Technological progress involves the development of print head arrays and numerous carrying structures to covering a wider area of the tissue in one pass of the substratum. In this technology, an external shift of PPF implies, that even an economy can create all products more effectively, that's why other options were wrong, that can be described as follows:

  • Option A, and Option E, is wrong because all opportunities can't increase or decrease the overall cost.
  • In option C, In is wrong, because the PPF shift can't be inward.
  • In option D, It is incorrect, because It can't move to the midpoint.
4 0
3 years ago
How can getchar function be used to read multicharacter strings?​
alex41 [277]

69696969696969969696969696966969696969696V69696969696969969696969696966969696969696VVVV696969696969699696969696969669696969696966969696969696996969696969696696969696969669696969696969969696969696966969696969696V69696969696969969696969696966969696969696V6969696969696996969696969696696969696969669696969696969969696969696966969696969696V69696969696969969696969696966969696969696VVVV696969696969699696969696969669696969696966969696969696996969696969696696969696969669696969696969969696969696966969696969696V69696969696969969696969696966969696969696V6969696969696996969696969696696969696969669696969696969969696969696966969696969696V69696969696969969696969696966969696969696VVVV696969696969699696969696969669696969696966969696969696996969696969696696969696969669696969696969969696969696966969696969696V69696969696969969696969696966969696969696V69696969696969969696969696966969696969696

5 0
3 years ago
Define a function calculate_range that consumes a temperature and returns a tuple of two numbers, the high and the low. These nu
Setler [38]

Answer:

def calculate_range(temperature):

   high = temperature + 20

   low = temperature - 30

   return low, high

today_temp = 70

today_low , today_high = calculate_range(today_temp)

print('Today\'s low = {}\nToday\'s high = {}'.format(today_low, today_high))

Explanation:

The programming language used is python.

The code define the calculate_range function that takes only one parameter temperature.

The function evaluates both high and low temperature and returns a tuple containing both values.

we test the function by creating a temperature variable for today and passing it to the function and this in turn returns two values today_low and today_high.

Your question specifies no need for indexing.

There is a really simple way of unpacking tuple objects, which is used to assign the values returned by the function to separate variables.

<em>today_low , today_high = calculate_range(today_temp)  </em>

Finally, today_low and today_high is printed to the screen.

check the picture to see results of running the code.

7 0
3 years ago
What is the typical name of the input file for the compiler?
lys-0071 [83]

Answer:

jpg or jenp or png

Explanation:

6 0
4 years ago
In the Linux Bash shell, the ____ key combination deletes the content of the command line from the current cursor position to th
Blizzard [7]

Answer:

C. Ctrl+k.

Explanation:

The bash shell is a command processor interface in Linux operating system as a default login shell. There are other versions for operating systems like Windows and Mac OS. A user can input a plain text command to the command line interface and use different key combinations to initiate different action.

The key combination used to delete the content of the command line from the position of the cursor is the Ctrl+k combination.

5 0
4 years ago
Other questions:
  • ________ a file transfers a copy of the file from the storage media into your computer memory
    10·1 answer
  • Describe how place value is used in the binary number system. How is it similar or different from the way place value is used in
    10·1 answer
  • What happens if you move unencrypted files into an encrypted folder?
    5·1 answer
  • Quiz
    5·1 answer
  • Jason is working on a Microsoft Excel worksheet and he wants to create a Print Preview shortcut. His teacher asks him to access
    9·1 answer
  • which scheduling algorithm allocate the CPU firt to the process that request the CPU first, (a) first come first serve,(b) short
    9·1 answer
  • Write an algorithm
    15·1 answer
  • Computer that process digital as well as analogue signals​
    11·1 answer
  • What is uncopyrighted software that is given away without cost
    13·1 answer
  • Which statement is most true about computers today?
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!