Professional Documents
Culture Documents
Roll No.
Invigilator's signature: -------
Mark Obtained: _ _ _ __
Examiner's signature: _ _ _ _ _ __
Instructions
There are 12 pages including this page in the question paper.
Q.1 (a) (i) Procedural high-level languages usually su ~port diff~rent data types. Give an
appropriate data type for each data value in the following table.
- - -
Data value Data type
FALSE l3M~tt\~
03/03/2013
~Mt.
35 1~Vco~tt.
"INTEGER" ~-m,~1.
3.5
R~ft..L
" 35"
e\\~i
(6)
(ii) The following is a declaration in a high-level language:
DEFINE MyGrade[1 to 100]
State two features of the code that the programmer should be able to recognise.
1 ................. J .t'.\\e.t\\ ~~~.<?.~..... -~-~~-'t~ .....~-~- ... -~~!: .. -~~!.... .. ... ...-~-~-~! .. --~~- -~ ~:... ~~-'I l
Ill\~ \~ L
02 (a) In the ASCII character set 'A' is represented by the value 65.
The values representing the other characters of the alphabet follow in sequence, so 'B' is
represented by 66, 'C' by 67 and so on.
The following table represents consecutive memory locations. Each memory location stores
one byte. Complete the table to show how the string "CAGE" may be stored in memory using
the ASCII set. A ' , 61
C:,I
t 68 O c;gE; 10f' 11
G
Address Data
G1
100 67
c;,r
101 €15
7\
102 71
103 69
104
.
J
105
[2]
(b) Functions and procedures are subroutines. Explain why parameters are used with
...:' :'.~. . .
1
I< ·····l'"''6~11A-.... .,,, .... At1n11.1"" .... ~ho.\. .. ·· ........\!!- .!s ... ,~!!'. ........... .
~~~\~.~~.<N!.... ....~.~! ..... ... !t ... .. ~.~.".1!.~\~~....:~...... .
·········--·······.................... .................. ..... ........ .......................... ........... ................ .......... ........ .. (2)
M.G.S/Computer Science/Gr:12/Term 1/Nov-Dec 2022 \ 4
03
The following pseudocode is an example of a CASE structure.
CASE OF MyMark
75 to 100: MyGrade "Distinction"
35 to 74: MyGrade "Pass"
0 to 34: MyGrade "Fail"
Describe what will happen if the pseudocode is tested when MyMark has the following
values:
.
27 .............. ......... ... .. ........C?.~.~j~~..... ::.:.~.\ .. ::........................................................... ..
······················· ·· ························· ······· ... ,......... .................... ................................................ .
101 ................... J~ ......~~\\ ... ...:.. .. .~\~.....~.!>:\~.~ ..... .......................... .......
................. .. ........ .................. .............. .. ..... ........................... .. ........ ...... ............................ .. [2]
M.G.S/Computer Science/Gr:12/Term 1/Nov-Dec 20221 5
Q.4
Jemma is designing a program that will work out the end of year bonuses for her
I employees. The main steps are:
\• input employee·s data
• calculate the bonus
• calculate deductions
o tax
o optional contribution to charity
• print out the bOnus
(a} Draw a structure diagram to show the modules that will be needed.
[3]
(b)
(i) Jemrna is using the variable Percentage in one module and a different variable
called Percentage in another module.
Explain the feature of a high-level programming language that avoids any possible
conflict
.....J.t.....~.'?.~...... ....!.. ..... ..... .... .... .... ...............
...... ....~.?.~.~... ... ... .... .... ~~.?.~ .. ~~~::.
-inu u oa\\o6 ~o,!:\MO{~'ii,\~. It \ 1 IA)\,er, ~ht 1Jllnohlt1 ote
......................................................... ................................................................................
.. .. . . . . J.~'..~~~~.~~::.................................................................. [2]
(Ii) Some modules require data values that originate from another module.
,, .,
,.,J~~•••"~~~.....
S~\'l\t M.\c, \)d\Ut>
.. ....
o.~
.....
ti> ~\ ll\e&. 11-t
.... I ~~I.
H\e,,e~t: ....................... ...
................................................................................................................................... (2)
M.G.S/Cornputer Science/Gr:12/Terrn 1/Nov-~ec 202216
(c)
I Jemma is designing a range validation check for the input of an employee's pay. The
pay range depends on the employee's job type, which may be P(part-time), F(full-time)
or C(commission only).
Complete the table showing five more rows of test data. Give a different reason for
each, describing what is being tested.
c:. ao.roo E~t,el't1t h,\0,,) .\lo.\io Ill i\ ·,i . I>.\ ~k e4,t Q\ bl)lt<bl~
V lo\ol.) 13oonalM~ Oo.to.-" ?i~~t oho'(\ -\\. ~DWlb\~ ,
5 t\~1\0\M,\ '\)(U11. -"1 ~~0{1'11:1.\ l\(}\O \ll}.\Ul .\\\O.l t\oelJ\ reer,, reo,onaMe.
p 9() \3cu"~~,, 'ba\o- -') be\ow \'11t 1',1\1\l t'tlU.\" ~C>U\t\W"
[5]
M.G.S/Computer Science/Gr:12/Term 1/Nov-Dec 202217
05
!Soni works for a S?ft'.""are house which has been asked to design software for Super Bikes, a
I company that spec1ahses in hiring out motorbikes.
[fhe t~pe of each bike is also recorded. The intention of this pseudocode is to allow
pnly tnal. scooter and road as valid bike types.
I
!INPUT BikeType
IF ((BikeType = "trial") AND (BikeType "scooter"))
OR (BikeType "road")
THEN
OUTPUT BikeType \\ is valid"
ELSE
OUTPUT "Invalid"
I NDIF
~ tate the output when the BikeType input is:
lh~a.\\i - - .. , ·
scrambler .............................................................................................. 1., ••••••••••••••••••••••
trial •••••••••••••••••-'-''•n•••••••••••
"\ ·,\ ... ~I\\\~ -· · ·
:r................................. ,•• ,....................,,.................
, · ,•• ,•• , •••••••••
'
Ii Rewrite the line in the pseudocode in part which needs changing in order to
1 correctly validate bike types.
;·································z.
}(-/ ;e>'r'1'~-1-~~ ......•.............................................................................•.......................
.......................................................................................................................................... (1)
t~~,,.,.
O\l'\V\J:\ \lo.\\!\
~'1\t
\f \\i'#..t\~\t L- \00-0 .
M.G.S/Computer Science/Gr:12/Term 1/Nov-Dec 202218
0.6 Write a short program to declare the class shape with the public method area. Declare the
derived classes circle, rectangle and square. Use polymorphism to redefine the method area for
these derived classes. Declare objects for each derived class and instance them with suitable
data. Use your methods to display the areas for these shapes. [5]
:::::::::t\~~:::::~~~~~:::c0~t\~::~~,<~~:;~~:~::_:.;_:,::::::::::::::::::::::::::::::::::::::::::::::
\h~ e
···················~··\~............ '"\\·· ·(j~,,,. 1\1 ••••••••.•••••••••••.••••••••••••••••••••••..••• •• •••••.•••• • ..••
.-1.1:
0 7 Writ~ a short program to declare a class, student, with the private attributes name,
dateOfB1rth and examMark, and the public method displayExamMark. Declare an object
myStudent, with a name and exam mark of your choice, and use your method to display the
exam mark. [5)
~,~r. '""'~ee..\
······················································································································
........ .. .. ....~~\.~)1\~.=-.(.!.~~~i .. .. .. ............................
. . . . . . . . . . . . . . . . . . . . . . . . . ,~,~ :o.,..,-.~().Sll.1?,~..1'.\.Q.!!I.~ ........... .... ............. .. .... ...... ... .. ..... ..... ..... .... ..
......................... :7. -~~~~-~\~_\_~\ ... .. .. .. .... .......... ... ....... ... ......... .
Q.9
The table shows assembly language instructions for a processor which has one general purpose
register, the Accumulator (ACC).
Instruction
Main memory
120 00001001
121 0 1 1 1 0101
122 10 1 1 0 110
123 11100100
124 01111111
126 01000001
127
;
0110 1001
200 10001000
22
M.G.S/Computer Science/Gr:12/Term 1/Nov-Dec 20 j 11
!
320
(
49
321 36
3?? 0
323 0
Trace table:
Memory address
Accumulator "'~'l
, l / .~
'.),' 1 3?.?
J?()
0 0
49 36
'36
'31
37
~9
)C)
5"0
(6)
. ~
A customer can uae the petrol pump when It la ready to dlapense petrol.
The pump is in use when the customer takes the nozzle from a holster on the pump.
The pump dispenses petrol while the customer preasee the trigger on the nozzle.
When the customer replaces the nozzle into the holster, the pump is out of use.
The cashier must press a reset button to make the pump ready for the next customer to use.
The petrol pump's four poaalble etatH and the tranaltlon from one state to another are as shown in
the table below.
[4)