11.3 Structured programming
32 questions in this subtopic. Open a question to solve it and check the official answer.
Structured programming · 5 marks · official answer ready
(a) Examine the pseudocode and complete the following table: Answer The identifier name of a global variable The name of the loop structure The identifier involved in a data type …
Structured programming · 5 marks · official answer ready
(ii) The headers for three modules in a program are defined in pseudocode as follows: Pseudocode module header PROCEDURE Create(S2 : INTEGER, P3 : STRING) PROCEDURE Modify(S2 : IN…
Structured programming · 8 marks · official answer ready
(a) Write pseudocode for a function GroupNum(), which takes a telephone number and a template as parameter strings and returns a formatted string. You may assume that the template…
Structured programming · 4 marks · official answer ready
(b) The function GroupNum() is to be extended to include parameter checking. State one check that could be applied to each parameter. Give an example of test data that could be us…
Structured programming · 16 marks · official answer ready
(b) Write program code for a module GroupReport(), which will summarise the stock data for a given product group. The product group will be passed to the module as a string. The t…
Structured programming · 5 marks · official answer ready
(iii) The function, getCustomer(): • takes the customer ID as a parameter • passes the customer ID to the function getRecordLocation(), which returns the calculated hash value • r…
Structured programming · 2 marks · official answer ready
(i) The function Hash() takes the booking ID as a parameter, calculates and returns the hash value. Write program code for the function Hash(). Programming language ..............…
Structured programming · 5 marks · official answer ready
(i) The function Enqueue() takes the value to be added to the queue as a parameter. The function returns TRUE if the item was added, or FALSE if the queue is full. Complete the ps…
Structured programming · 5 marks · official answer ready
(iii) The function, getCustomer(): • takes the customer ID as a parameter • passes the customer ID to the function getRecordLocation(), which returns the calculated hash value • r…
Structured programming · 6 marks · official answer ready
(a) Write pseudocode for the procedure Button(). Declare any additional variables you use. The value of MaxVol should not be changed within the procedure. Parameter validation is …
Structured programming · 6 marks · official answer ready
(b) The procedure Button() is to be tested using black-box testing. Fill in the gaps below to define three tests that could be carried out. TEST 1 – VolLevel is changed Parameter …
Structured programming · 3 marks · official answer ready
(ii) Stub testing is a technique often used in the development of modular programs. Describe the technique. .......................................................................…
Structured programming · 8 marks · official answer ready
(ii) Function FindBooksBy() will: • receive the Author Name as a parameter • search Library.txt for matching entries • store the Book Title and Location of matching entries in the…
Structured programming · 8 marks · official answer ready
(b) A student is learning about random number generation. She is investigating how many times the random function needs to be called before every number in a given series is gener…
Structured programming · 2 marks · official answer ready
(iii) The following pseudocode uses the subroutine DoSomething(). Answer 23 + DoSomething("Yellow") State whether the subroutine is a function or a procedure. Justify your answer.…
Structured programming · 6 marks · official answer ready
(b) A procedure, CountLines(), is being written to count the number of lines in a text file. The procedure will: • take a filename as a string parameter • count the number of line…
Structured programming · 7 marks · official answer ready
(iii) The stack is implemented as a 1D array, with eight elements, and given the identifier ArrayStack. The global variable Top contains the index of the last element in the stack…
Structured programming · 5 marks · official answer ready
(i) Examine the pseudocode. Complete the following table. Answer The identifier name of a local variable The identifier name of a user-defined procedure The identifier name of a u…
Structured programming · 1 mark · official answer ready
(i) State how structured programming languages support the implementation of sub-tasks. ...........................................................................................…
Structured programming · 8 marks · official answer ready
(b) Line 118 of the function Update() calls the subroutine Insert(). A designer decides to convert Insert() from a procedure to a function. Insert() returns TRUE or FALSE. A progr…
