Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Q 1 ( a ) ( 6 marks ) The function definition below is taken from Chapter 4 and describes the general problem of finding
Qa marks The function definition below is taken from Chapter and describes the general problem of finding the first occurrence of a given character in a given string. In : javascript var headdocument.getElementsByTagNameheadstyle document.createElementstyle Function: first index Inputs: text, a string; character, a string Preconditions: character Output: index, an integer Postconditions: if character occurs in text, index is the smallest integer such that textindex character, otherwise index text Write a function defintion that finds the second occurrence of any vowel in a given string. If a second vowel is not found, the function should indicate this by returning the length of the string. The vowels do not need to be the same letter or the same case ie uppercase or lowercase Examples: In the string 'Hello', the first occurrence of any vowel is e the second occurrence of any vowel is o so the function would return In the string Hi there is no second occurence of any vowel, so the function would return Write your answer here Function: Inputs: Preconditions: Output: Postconditions:
Qa marks
The function definition below is taken from Chapter and describes the general problem of finding the first
occurrence of a given character in a given string.
In :
javascript
var headdocument.getElementsByTagNameheadstyle document.createElementstyle
Function: first index Inputs: text, a string; character, a string Preconditions: character Output: index,
an integer Postconditions: if character occurs in text, index is the smallest integer such that textindex
character, otherwise index text
Write a function defintion that finds the second occurrence of any vowel in a given string. If a second vowel is
not found, the function should indicate this by returning the length of the string. The vowels do not need to be
the same letter or the same case ie uppercase or lowercase
Examples: In the string 'Hello', the first occurrence of any vowel is e the second occurrence of any vowel is
o so the function would return In the string Hi there is no second occurence of any vowel, so the function
would return
Write your answer here
Function: Inputs: Preconditions: Output: Postconditions:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started