SELF TEST

1. Which of the following is an invalid Pascal relational operator

	==
	<>
	<
	>
2. Write a Pascal statement which compares the integer variable sum to the constant value 10, and if it is the same prints the string "Good guess"

	if  sum = 10  then  writeln('Good guess');

3. Write a Pascal statement which compares the character variable letter to the character variable chinput, and if it is not the same, prints the value of letter

	if  letter <> chinput  then  writeln( letter );

4. Write a Pascal statement to compare the character variable letter to the character constant 'A', and if less, prints the text string "Too low", otherwise print the text string "Too high"

	if  letter  <  'A' then  writeln('Too low') 
	else  writeln('Too high');

5. Write a Pascal statement to display the text string "Valve open", if the variable waterflow is equal to 1, AND the variable outputvalue is equal to 0

	if  (waterflow = 1)  AND  (outputvalue = 0) then  writeln('Valve open');

6. Write a Pascal statement which declares a constant called MAXSIZE with a value of 80

	const  MAXSIZE  =  80;

7. Write a Pascal statement which will display the value of the real variable degrees using a fieldwidth of 5 with three decimal places

	writeln('Degrees = ', degrees:5:3 );


Copyright B Brown/P Henry/CIT, 1988-1996. All rights reserved.