Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Pascal 1 Practice Quiz Smith Answers 9/19/2013 Names:_____________________________________ I. Matching a)__6_ writeln(): 1) Doing a problem by hand so you understand what to do. b) _11__ readln(); 2) A decision construct used when you want to a chunk of code only when something is true.. c) _8__ for..do 3) The section of a program where you declare variables. d) _2__ if 4) Writing out, in English, instructions on HOW you will solve the problem. e) _9__ := 5) Testing your pseudo-code or code. f) _3__ VAR 6) A command used to write information on the screen. g) _12__ reserved word 7) Multiply h) _10__ CONST 8) A loop used to repeat something a set number of times. i) _1__ hands-on 9) ‘is assigned the value of’… j) _4__ pseudo-code 10) A section of the program where constants are declared. k) _5__ dry run 11) A command used to get information from the user. l) _13__ code 12) A word that has special meaning in Pascal and cannot be used as a variable name. m) _7__ * 13) Instructions written in Pascal n) _15__ integer 14) Square root o) _17__ real 15) A type of variable that stores numbers without a decimal point. p) _16__ sqr() 16) Square q) _14__ sqrt() 17) A type of variable that stores numbers with a decimal point. III. Math: Translate the following into Pascal. Assume each letter is a separate variable. 1) 2) 3) 4) 2x + 5y 2*x + 5*y 3a(b- 12) 3*a*(b-12_ 2 5x – 4x + 3 5*sqr(x) – 4 *x + 3 a + (18cd – 6) (a + sqrt(18*c*d – 6))/(5*x-3) 5x – 3 Evaluate the following 1) 2*3-sqr(4) -10 2) 5*(6*4 – 3*sqrt(25-9)) 60 3) (5<6) TRUE 4) (4>2) or (6<(8-2)) TRUE IV. Dry run. (write out the variable boxes, the screen and how they change when the program is run.) program dryrunfun; var a,b, c:integer; begin a:= 4; b:= 5; c:= 3; writeln(a,b,c); if (b <(a+c)) then a:= a*3 else a:= a – c; writeln(a,b,c); end. . A 4 12 b 5 c 3 Screen 453 12 5 3 Program TeenyBopper; Var age:integer; Begin Writeln(‘Please your age’); Readln(age); If (age<20) and (age>=13) then Writeln(‘You are a teenage’) Else Writeln(‘You are not a teenager.’); End.