1 3 V base height = â â - Christos Markides
1 3 V base height = â â - Christos Markides
1 3 V base height = â â - Christos Markides
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
AEEE195 – Programming Principles<br />
Time 1 hour Semester: Fall 2012<br />
Instructor: <strong>Christos</strong> <strong>Markides</strong> Date: 23 Dec. 12<br />
Test<br />
Instructions:<br />
1. Answer ALL questions on the answer sheet provided.<br />
2. Please ensure that you use comments in your program as instructed.<br />
Question 1<br />
a) Given the program in Figure 1, rewrite the code thus correcting any syntax errors.<br />
[30 marks]<br />
b) Given the program in Figure 2, what is the output of the program? What is the output of the<br />
program if all variables (a, b, and c) have initial values equal to 0 (zero).<br />
[10 marks]<br />
c) Given the program in Figure 3, what is the output of the program if the user enters the values 3<br />
and 4, ‘y’? What is the output of the program if the user enters -5, 6, ‘n’? How many times will the<br />
program execute?<br />
[20 marks]<br />
[1] double side_a, side_b, hyp;<br />
[2] char opt;<br />
[3] do {<br />
[4] cout > side_a >> side_b;<br />
[6] if ((side_a > 0) && (side_b > 0)) {<br />
[7] hyp = sqrt( pow(side_a, 2.0) + pow(side_b, 2.0) );<br />
[8] cout
Question 1<br />
[1] ||include{iostream}<br />
[2] =define SIZE=10<br />
[3] get spacename DTS;<br />
[4] INT kyria()<br />
[5] [<br />
[6] ---! Variables !---<br />
[7] InTeGeR x;<br />
[8] Diplo y, z<br />
[9] Twice res;<br />
[10] SingleLetter opt;<br />
[11] Cout -> x;<br />
[13] touc