Professional Documents
Culture Documents
Ex Ch1
Ex Ch1
Exerctse 7
Multiple Cbolcc Quntioru
- - - .;
A. S1J11rce eodes
9, •
B, rnachll\C c:odcs C.
I}
C. ASCH t.ode-s "
D. tTTMtcode3 -l. Whi~b<lftl'<fotboo~h•,"alid~~in
2. Which of lhe. following 11 1101 a rtffl\'co wo,d of
Puscul? ( I } mon dti
{1l 1'1:affitl.\
A. begln
(31 l:ICJl'U.b_4
B. end
C. v,u · A. (IJ only
,I D. st.art (l. l 2) ooi)'
C. fl J li!d (J) Clbly
J . Cunsidrr rhe foltowing Pascal progmm: D. 0) !lfld 0) ml)'
,,
).'•
prog·taJII i;eat. X
S. Whkh of t!KI rl.llloloinp d c c ~ u frN Ciffll
conet
«mt!i
,,'l ~qo Y l S1
begin t\ , con• t 090 , iln (19!H'. ,
w-r .i.t.elrt r oge
p.1 11. oga : l z
0 ·011•t
end ----Z C. va.r e:nd intC9or1
1·
P· Which o:f thv follt1wl ng s.;l'! of s~ ml!OI~ can lx1 u~ 10 D. Y,U' l\gb l tntll'90t1
P,1: ,omplt tc 1hc nbovc prugr11m " ilh<:>til 1:rrN '.'
p.l:
2~
Pascal Programming
1111111
I:
1j
I iI Short Questions
ii 1. Locate and correct the errors in the following program:
1i
1! program my-first
' { This is my first Pascal program
begin
writeln( "First line•) ;
writeln('Second line') ;
writln(last line)
end
2. Write Pascal programs which use several writeln statements to produce the following patterns of
asterisk (*) on computer screen.
(a) (b)
***** *
* * **
***** ***
* * ****
***** *****
I ·~ 11111
My First Pascal Program
3. In a Pascal program, characters are represented using the ASCII characters. If these characters are used
for the assembling pieces of a picture, they are called ASCII art. Write a program which produces the
following ASCII art on computer screen.
I\\\\
o-o-3 I I
< 11
> I
(5 marks)
4. Write a Pascal program which displays your school name, school address, class, class number and your
name as follows:
• School name
• School address
• Class name (Class number)
• Yourname
For example,
ABC School
10 Main street, Central District, H.K.
S4B (16)
Chan Tai Man
(4 marks)
5. Write a Pascal program which displays the following conversations on computer screen:
Peter: Hi!
Mary: How are you?
Peter: I am fine. How about you?
Mary: Fine. Thanks!
(4 marks)
2y -