0% found this document useful (0 votes)
59 views4 pages

Computer Assignment 15

The document consists of an assignment involving pseudocode functions and operators, requiring the completion of tables related to data types, expressions, and state-transition diagrams. It includes tasks on identifying types of Abstract Data Types (ADTs) and describing algorithms for grading systems. The assignment is structured with multiple parts, each focusing on different programming concepts.

Uploaded by

sumanbasnet80123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views4 pages

Computer Assignment 15

The document consists of an assignment involving pseudocode functions and operators, requiring the completion of tables related to data types, expressions, and state-transition diagrams. It includes tasks on identifying types of Abstract Data Types (ADTs) and describing algorithms for grading systems. The assignment is structured with multiple parts, each focusing on different programming concepts.

Uploaded by

sumanbasnet80123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

2

Assignment
Refer to the insert for the list of pseudocode functions and operators.

1 (a) (i) Complete the following table by giving the appropriate data type in each case.

Variable Example data value Data type


Name "Catherine"
Index 100
Modified FALSE
Holiday 25/12/2020
[4]

(ii) Evaluate each expression in the following table by using the initial data values shown in
part (a)(i).

Expression Evaluates to
Modified OR Index > 100
LENGTH("Student: " & Name)
INT(Index + 2.9)
MID(Name, 1, 3)
[4]

(b) Each pseudocode statement in the following table contains an example of selection,
assignment or iteration.

Put one tick (‘✓’) in the appropriate column for each statement.

Statement Selection Assignment Iteration


Index Index + 1
IF Modified = TRUE THEN
ENDWHILE
[3]

© UCLES 2021 9618/22/M/J/21


3

2 (a) Examine the following state-transition diagram.

Low level detected | Activate pump

Low level detected

X S2
S1

Normal level detected Normal level detected | Deactivate pump


S3

(i) Complete the table with reference to the diagram.

Answer
The number of transitions that result in a different state
The number of transitions with associated outputs
The label that should replace ‘X’
The final or halting state
[4]

(ii) The current state is S1. The following inputs occur.

1. Low level detected


2. Low level detected
3. Low level detected
4. Low level detected

Give the number of outputs and the current state.

Number of outputs .............................................................................................................

Current state .....................................................................................................................


[2]

© UCLES 2021 9618/22/M/J/21 [Turn over


5

3 The following diagram represents an Abstract Data Type (ADT).

A B
Dolphin Cat Fish Elk

(a) Identify this type of ADT.

............................................................................................................................................. [1]

(b) Give the technical term for the item labelled A in the diagram.

............................................................................................................................................. [1]

(c) Give the technical term for the item labelled B in the diagram.

Explain the meaning of the value given to this item.

Term ..........................................................................................................................................

Meaning ....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................
[2]

(d) Complete the diagram to show the ADT after the data has been sorted in alphabetical order.

Dolphin Cat Fish Elk

[2]

© UCLES 2021 9618/22/M/J/21 [Turn over


6

4 A teacher uses a paper-based system to store marks for a class test. The teacher requires a
program to assign grades based on these results.

The program will output the grades together with the average mark.

Write a detailed description of the algorithm that will be needed.

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

.................................................................................................................................................... [6]

© UCLES 2021 9618/22/M/J/21

You might also like