SELF TEST 8
Match the inputs and outputs for the following.....


	program READCHARACTERS (input, output);
	var     C1, C2, C3, C4, C5, C6 : char;
	begin
		readln( C1, C2, C3, C4, C5, C6 );
		writeln(C1, C2, C3, C4, C5, C6 )
	end.

	Inputs			Outputs ( spaces shown as _ )

	a) Hi there		a) A1_B2_
	
	b) Hi			b) 57_4_3
	   there
	c) 694			c) Hi_the
	   827
	d) 57 4			d) Hi_the
	   329
	e) A1			e) 694_82
	   B2 C3

Click here for answer

Note: The Enter or Return key on the IBM-PC when running Turbo Pascal is interpreted as two characters, a line feed and carriage return, so the above results can vary from computer to computer and compiler to compiler. This is shown below.

  	Outputs for Turbo Pascal

	a) Hi there		a) A1
				   B2

	b) Hi			b) 57_4
	   there		   <enter>

	c) 694			c) Hi_the
	   827

	d) 57 4			d) Hi
	   329			   th

	e) A1			e) 694
	   B2 C3		   8

PROGRAM THREE
Ohm's law states that the voltage (V) in a circuit is equal to the current flowing in amperes (I) multiplied by the resistance in the ciruit (R) [ ie, E = I * R ]. Write a program to enter in the values of resistance and current, displaying the voltage which would exist.

Click here for answer

 

PROGRAM FOUR
Write a program which inputs two resistance values, and then displays their sum value when placed in series and then in parallel. [ The total series resistance is R1 + R2, whilst the parallel resistance is (R1 * R2) / (R1 + R2) ]

Click here for answer


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