

practical 3
Presentation
•
Information Technology (IT)
•
9th - 12th Grade
•
Practice Problem
•
Hard
Jovani Rose
Used 1+ times
FREE Resource
9 Slides • 0 Questions
1
p4 revision
By Jovani Rose
2
​(i) Write program code to declare the global array DataArray
3
​The procedure PrintArray() takes an integer array as a parameter and outputs the contents of the array in the order they are stored.
4
​(c) The function LinearSearch(): • takes an integer array and integer search value as parameters • counts and returns the number of times the search value is found in the array. Write program code for the function LinearSearch()
5
​(d) (i) Amend the main program to: • prompt the user to input a whole number between 0 and 100 inclusive • read and validate the input from the user • call LinearSearch() with DataArray and the validated input value • output the result in the format: The number 7 is found 2 times.
6
​2 Study the following pseudocode for a recursive function. FUNCTION Unknown(BYVAL X, BYVAL Y : INTEGER) RETURNS INTEGER IF X < Y THEN OUTPUT X + Y RETURN (Unknown(X + 1, Y) * 2) ELSE IF X = Y THEN RETURN 1 ELSE OUTPUT X + Y RETURN (Unknown(X - 1, Y) DIV 2) ENDIF ENDIF ENDFUNCTION The operator DIV returns the integer value after division e.g. 13 DIV 2 would give 6 (a) Write program code to declare the function Unknown().
7
2 Study the following pseudocode for a recursive function. FUNCTION Unknown(BYVAL X, BYVAL Y : INTEGER) RETURNS INTEGER IF X < Y THEN OUTPUT X + Y RETURN (Unknown(X + 1, Y) * 2) ELSE IF X = Y THEN RETURN 1 ELSE OUTPUT X + Y RETURN (Unknown(X - 1, Y) DIV 2) ENDIF ENDIF ENDFUNCTION The operator DIV returns the integer value after division e.g. 13 DIV 2 would give 6 (a) Write program code to declare the function Unknown().
8
9
p4 revision
By Jovani Rose
Show answer
Auto Play
Slide 1 / 9
SLIDE
Similar Resources on Wayground
10 questions
Genetics Dihybrid Crosses
Presentation
•
9th - 12th Grade
7 questions
Mechanical vs. Electromagnetic Waves Vocab Building
Presentation
•
9th - 12th Grade
3 questions
8) Protecting Data Part 1
Presentation
•
9th - 12th Grade
8 questions
Normal Distribution Curve
Presentation
•
9th Grade - University
6 questions
Consumer Rights and Responsibilities
Presentation
•
9th - 12th Grade
8 questions
Finals Study Guide - Context Clues
Presentation
•
9th - 12th Grade
10 questions
Grammar 4A - ir + a + infinitive
Presentation
•
9th - 12th Grade
10 questions
Synthetic Division
Presentation
•
9th - 12th Grade
Popular Resources on Wayground
24 questions
PBIS-HGMS Day 10
Quiz
•
6th - 8th Grade
10 questions
HCS SCI 03 Summer School Review 3
Quiz
•
3rd Grade
11 questions
Home Scope
Quiz
•
7th - 8th Grade
15 questions
HCS SCI 05 Summer School Assessment 3 Review
Quiz
•
5th Grade
35 questions
Lufkin Road Middle School Student Handbook & Policies Assessment
Quiz
•
7th Grade
18 questions
Geo 11.3 Area of Circles and Sectors
Quiz
•
9th - 11th Grade