Question: Solve all: Input Filetracing - NotepadFile Edit Format View Helphello, world, hello, universe hello, world, hello, universe Question 1 : What is the value stored

Solve all: Input Filetracing - NotepadFile Edit Format View Helphello, world, hello, universe hello, world, hello, universe
Question 1: What is the value stored in 'sentence' after the function is run with
fname = 'tracing.txt'(the input file)?
Question 2: Suppose you replace Line 11 of the function with:
if word == 'hello'
a. Does the function output the same result as before? (Express your answer as 'yes' or 'no')
b. Will the function error at any point? If not, your answer should be -1, otherwise it should be the wordCount for which it might error.
Question 3: Suppose you duplicate Line 17 at the end of your code. What would be the value stored in 'sentence' after the function is run with fname = 'tracing.txt'?
Question 4: Suppose your input file contains the following text instead:
hello,world,Hello,universe hello,Galaxy,hELlo,planet
Which of the following replacements for Line 11 would lead to the same result as the original function? SELECT ALL THAT APPLY
'A': if lower(word)-- 'hello';
'B': if length(word)=-556 all(lower(word)=- 'hello');
'C': if upper(word)=- 'HELLO' 56 length(word)=-5;
'D': if strcmpi(word, 'hello');
You answer should be a string with all of the correct options in alphabetical order separated by a single comma. For example, if you think all of them are correct, your answer should be 'A,B,C,D'
If you didn't know, the way an if statement works with && is if the first part of the statement is false, it doesn't even look at the second part! So if I have:
if length (vec)>-565vec(5)=-6
when length(vec)5 produces a false, Matlab won't even evaluate vec(5)=6! This is important because if the length of the vector isn't at least 5 then you wouldn't be able to index the 5 th position and it would error!
Keep this necessary ordering in mind when answering the question.
Question 5: Which of the following changes to the code could cause an infinite loop to arise?
SELECT ALL THAT APPLY
'A': removing Line 17
'B': replacing Line 9 with: [word, rest]= strtok(string,',')
'C': removing Line 10
'D': All of the Above
You answer should be a string with all of the correct options in alphabetical order separated by a single comma. For example, if you think the first 3 are correct, your answer should be 'A, B,C'
Solve all: Input Filetracing - NotepadFile Edit

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!