t/take/launch,jsp/course assessment id- 37588 18course id-_22489 18content id- 6
ID: 3706222 • Letter: T
Question
t/take/launch,jsp/course assessment id- 37588 18course id-_22489 18content id- 604891, 18step-null Question Completion Status: What will be printed from this program? et bin/csh @var 5 @sum-0 while ( Svar 0) @sum-Ssum-Svar @var = Sva-. 1 end echo Ssum 0 15 O 10 0 14 O none of above QUESTION 13 What will be printed from this program called CountTine if the user executes it in the terminal command line(shell) as: /CountTine 10 Below is the program: #1 /bin/csh if ( S#argv-_ 0 ) then echo -n "Enter time in minutes: " o min- 5 else endif o sec $min 60 echo "Smin minutes is $sec seconds O Smin minutes is Ssec seconds O 10 minutes is 600 seconds O s10 minutes is 5600 seconds 10min minsites is Cliek Save and Submit to saue and submit. Cliek Save All Ansuwers to sare all anseers Save All AnsExplanation / Answer
Solutions :Here @ var=5,@sum=0 in the unix shell program
Then we are going to while loop .in while loop first we check the condition $var .Here condition is true then @sum =0+5=5
and @ var becomes 4.Then again check the condition in while loop condition evaluates true. Then @sum=5+4=9 .Similarly process will be repeated until @var >0. At the end @ var=0 then the condition in while loop false . Then control goes to echo $sum using this statement sum value is printed i.e. 15
So the first option is correct .
Explanation:
@sum=0+5=5
@sum =5+4=9
@sum=9+3=12
@sum=12+2=14
@sum=14+1=15
Solution 13: output of the program using count time in the command line terminal.
Here given count time is 10 .
First we check the condition in if block . Condition becomes false because #argv is 10. Then else block is executed. Now
@ min becomes 10.
After endif @ sec = 10*60=600
So @ sec becomes 600
At the end using echo statement min and sec value are printed using $ min and $ sec respectively.
Then echo " $min minutes is $sec seconds" using this statement output becomes 10 minutes is 600 seconds
So option second are executing.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.