Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

-

My First Plsul Progr,m

9. What 1$ il rm,ved WOJd in PastaJ program? p.13

10. Describe the rules ot naming an identifier in Pascal.

Concept Checker/ . "'


Determine whether·e.1ch ot the following st,temenu u true (J) « false (F).
1. A compiler tta«islates machine cCldfs into. prognm 10Utte codes.

2. Miulng ii wmic.olon betwetn two PiKM U.ttmenU resu!U in .a syntu tfflli.

3, A Pa,cal progrilffi most contiin • d«Jntloo p,n.


D
4. Indenting program statemenu I m ~ the rHdidlitl.ty of • progr-,rn. D
5. A Pax.t P,og,iffl must be termlNted by lht rl!HM!d w«d end {o!Jowld by• period '.'.

Exerctse 7
Multiple Cbolcc Quntioru
- - - .;

.t. 'The cDmputtf hlrdwwrc can only execute 2' I &


A, I

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

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

6. Which of the following Pascal program segments is D.


free from errors? program sample;
( a sample program
A. begin
program sample; writeln( 'Hello!,) ;
{ a sample program wri teln ( 'This is a saltipl
begin program•) e
writeln( 'Hello!'); end.
wri teln ( 'This is a sample program ' l
end. 7• Which of the following variables can be use
storing the name of a student?
B.
program sample; A. student_name
(* a sample program *) B. student name
begin
C. student(name)
writeln ('Hello!•)
writeln('This is a sample program') D. student-name
end .
8. What is the output of the following Pasca1 ~
C. writeln('l + 1 = 2');
program sample;
{ a sample program A. ' l + 1 = 2'
begin B. "l + 1 = 2"
writeln( Hello! );
C. 1 + 1 = 2
writeln( This is a sample program)
end. D. 1+1=2

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 -

You might also like