Quiz+7+Programs

Program 1
put ord (“M”) + ord (“a”)

Program 2
put ord (chr(ord(“h”) - 37))

Program 3
put chr (index("Mr.Foster", "F") + 98)

Program 4
var ph1 := "Rockland Wildcats are" var ph2 := "not pussycats!" var ph3 := "Meowww!" **% a** put ph1 (5 .. 9) + ph1 (15 .. 16) + ph3 (1) + ph2 (11 .. 12)

**%b** put length (ph2)

for x : 2 .. 6 by 6 put ph1 (x + 1) + ph2 (x) + ph3 (x) end for
 * %c **

**%d** put sqrt (length (ph1) - 5)

Program 5
% This is a sample output of the program you must write. Note that the program should do this to % any word entered, not just the word "Simple". Hint: You will need to use the length function and a % counted loop

var 1word : string
var count : int := 1 get word <span style="font-family: 'Calibri','sans-serif'; font-size: 10pt;">for a : 1 .. length (word) - 1 <span style="font-family: 'Calibri','sans-serif'; font-size: 10pt;">if word (a) = "t" and word (a - 1) = "h" then <span style="font-family: 'Calibri','sans-serif'; font-size: 10pt;">count := count + a <span style="font-family: 'Calibri','sans-serif'; font-size: 10pt;">end if <span style="font-family: 'Calibri','sans-serif'; font-size: 10pt;">end for <span style="font-family: 'Calibri','sans-serif'; font-size: 10pt;">put " There are " count, " th's in this text."

Program 7
<span style="display: block; margin: 0in 0in 0pt 1.65pt; mso-pagination: widow-orphan; tab-stops: 1.65pt 20.65pt 56.65pt 92.65pt 128.65pt 164.65pt 200.65pt 236.65pt 272.65pt 308.65pt 344.65pt 380.65pt 416.65pt 452.65pt; text-align: justify; text-indent: 0.95pt; text-justify: inter-ideograph;"><span style="color: black; font-family: 'Calibri','sans-serif'; font-size: 10pt;">var P,R,S,T: string (23) <span style="display: block; margin: 0in 0in 0pt 1.65pt; mso-pagination: widow-orphan; tab-stops: 1.65pt 20.65pt 56.65pt 92.65pt 128.65pt 164.65pt 200.65pt 236.65pt 272.65pt 308.65pt 344.65pt 380.65pt 416.65pt 452.65pt; text-align: justify; text-indent: 0.95pt; text-justify: inter-ideograph;"><span style="color: black; font-family: 'Calibri','sans-serif'; font-size: 10pt;">P:= "nosecone" <span style="display: block; margin: 0in 0in 0pt 1.65pt; mso-pagination: widow-orphan; tab-stops: 1.65pt 20.65pt 56.65pt 92.65pt 128.65pt 164.65pt 200.65pt 236.65pt 272.65pt 308.65pt 344.65pt 380.65pt 416.65pt 452.65pt; text-align: justify; text-indent: 0.95pt; text-justify: inter-ideograph;"><span style="color: black; font-family: 'Calibri','sans-serif'; font-size: 10pt;">R:= "rocket" <span style="display: block; margin: 0in 0in 0pt 1.65pt; mso-pagination: widow-orphan; tab-stops: 1.65pt 20.65pt 56.65pt 92.65pt 128.65pt 164.65pt 200.65pt 236.65pt 272.65pt 308.65pt 344.65pt 380.65pt 416.65pt 452.65pt; text-align: justify; text-indent: 0.95pt; text-justify: inter-ideograph;"><span style="color: black; font-family: 'Calibri','sans-serif'; font-size: 10pt;">S:= P (5..*) <span style="display: block; margin: 0in 0in 0pt 1.65pt; mso-pagination: widow-orphan; tab-stops: 1.65pt 20.65pt 56.65pt 92.65pt 128.65pt 164.65pt 200.65pt 236.65pt 272.65pt 308.65pt 344.65pt 380.65pt 416.65pt 452.65pt; text-align: justify; text-indent: 0.95pt; text-justify: inter-ideograph;"><span style="color: black; font-family: 'Calibri','sans-serif'; font-size: 10pt;">put S <span style="display: block; margin: 0in 0in 0pt 1.65pt; mso-pagination: widow-orphan; tab-stops: 1.65pt 20.65pt 56.65pt 92.65pt 128.65pt 164.65pt 200.65pt 236.65pt 272.65pt 308.65pt 344.65pt 380.65pt 416.65pt 452.65pt; text-align: justify; text-indent: 0.95pt; text-justify: inter-ideograph;"><span style="color: black; font-family: 'Calibri','sans-serif'; font-size: 10pt;">S:= R(1..4) + "s and " + S + "s" <span style="display: block; margin: 0in 0in 0pt 1.65pt; mso-pagination: widow-orphan; tab-stops: 1.65pt 20.65pt 56.65pt 92.65pt 128.65pt 164.65pt 200.65pt 236.65pt 272.65pt 308.65pt 344.65pt 380.65pt 416.65pt 452.65pt; text-align: justify; text-indent: 0.95pt; text-justify: inter-ideograph;"><span style="color: black; font-family: 'Calibri','sans-serif'; font-size: 10pt;">put S <span style="display: block; margin: 0in 0in 0pt 1.65pt; mso-pagination: widow-orphan; tab-stops: 1.65pt 20.65pt 56.65pt 92.65pt 128.65pt 164.65pt 200.65pt 236.65pt 272.65pt 308.65pt 344.65pt 380.65pt 416.65pt 452.65pt; text-align: justify; text-indent: 0.95pt; text-justify: inter-ideograph;"><span style="color: black; font-family: 'Calibri','sans-serif'; font-size: 10pt;">T:= P(3) + R(2..6) <span style="display: block; margin: 0in 0in 0pt 1.65pt; mso-pagination: widow-orphan; tab-stops: 1.65pt 20.65pt 56.65pt 92.65pt 128.65pt 164.65pt 200.65pt 236.65pt 272.65pt 308.65pt 344.65pt 380.65pt 416.65pt 452.65pt; text-align: justify; text-indent: 0.95pt; text-justify: inter-ideograph;"><span style="color: black; font-family: 'Calibri','sans-serif'; font-size: 10pt;">put T <span style="display: block; margin: 0in 0in 0pt 1.65pt; mso-pagination: widow-orphan; tab-stops: 1.65pt 20.65pt 56.65pt 92.65pt 128.65pt 164.65pt 200.65pt 236.65pt 272.65pt 308.65pt 344.65pt 380.65pt 416.65pt 452.65pt; text-align: justify; text-indent: 0.95pt; text-justify: inter-ideograph;"><span style="color: black; font-family: 'Calibri','sans-serif'; font-size: 10pt;">put P (1) + P(6..*) <span style="display: block; margin: 0in 0in 0pt 1.65pt; mso-pagination: widow-orphan; tab-stops: 1.65pt 20.65pt 56.65pt 92.65pt 128.65pt 164.65pt 200.65pt 236.65pt 272.65pt 308.65pt 344.65pt 380.65pt 416.65pt 452.65pt; text-align: justify; text-indent: 0.95pt; text-justify: inter-ideograph;"><span style="color: black; font-family: 'Calibri','sans-serif'; font-size: 10pt;">put length (P):5