SlideShare a Scribd company logo
musadoto ©2018 slideshare2
AE 219-COMPUTER PROGRAMING TEST 2017 MANUAL SOLUTION
1.Write a program to describe the weather according to the following
temperature Classifications:
Temperature, T(O
C) Classification
T>40 Very Hot
T>25 and T≤40 HOT
T>20 and T≤25 Cool
T>3 and T≤20 Cold
T≤3 Freezing
answer
PROGRAM WeatherTester(INPUT,OUTPUT);
VAR
Temperature :INTEGER;
VeryHot, Hot, Cool, Cold, Freezing :BOOLEAN;
BEGIN
WRITE('Please enter the temperature:');
READLN(Temperature);
VeryHot := (Temperature > 40);
Hot := (Temperature > 25) AND (Temperature <= 40);
Cool := (Temperature > 20) AND (Temperature <= 25);
Cold := (Temperature > 3) AND (Temperature <= 20);
Freezing := (Temperature <= 3);
WRITELN;
IF VeryHot THEN
WRITELN('Very Hot')
ELSE IF Hot THEN
WRITELN('Hot')
ELSE IF Cool THEN
WRITELN('Cool')
ELSE IF Cold THEN
WRITELN('cold')
ELSE IF Freezing THEN
WRITELN('freezing')
ELSE
{ End of the IF construct }
WRITELN('Press ENTER to continue..');
READLN
END.
musadoto ©2018 slideshare2
2.Write the output of the program below using exponent values from 1 - 20.
PROGRAM Prog_Q2;
VAR
Base, Power, Start, Final :INTEGER;
BEGIN
Base := 2;
WRITE('Enter starting exponent:');
READLN(Start);
WRITE('Enter ending exponent:');
READLN(Final);
WRITELN;
WRITELN('Number Power of two');
FOR Power := Start TO Final DO
BEGIN
WRITE(Power:3);
WRITELN(EXP(LN(Base)*Power):20:0)
END;
WRITELN;
WRITELN('Press ENTER to continue..');
READLN
END. {Prog_Q2}
Answer
Enter starting exponent:1
Enter ending exponent:20
Number Power of two
1 2
2 4
3 8
4 16
5 32
6 64
7 128
8 256
9 512
10 1024
11 2048
12 4096
13 8192
14 16384
15 32768
16 65536
17 131072
18 262144
19 524288
20 1048576
Press ENTER to continue..
3.Write the output of the following program with the following input data
45 3 60
45 5 60
45 6 60
Comment on the results (outputs)
musadoto ©2018 slideshare2
PROGRAM Prog_Q3;
Const
g=9.8;{acceleration due to gravity}
Pi=3.1415927;{a well-known constant}
var
A:integer; {launch angle in degrees}
T:integer; {time of flight}
Theta:integer; {direction at time T in degrees}
U:integer; {launch velocity}
V:integer; {resultant Velocity}
Vx:integer; {horizontal Velocity}
Vy:integer; {vertical velocity}
X:integer; {horizontal displacement}
Y:integer; {vertical displacement}
begin
write(‘Enter launch angle(A),time of flight(T),and launch
velocity(U):’);
READ(A,T,U);
A:=ROUND(A*Pi/180); {Convert angle to radians}
X:=ROUND(U*COS(A)*T);
Y:=ROUND(U*SIN(A)*T-g*T*T/2);
Vx:=ROUND(U*COS(A));
Vy:=ROUND(U*SIN(A)-g*T);
V:=ROUND(SQRT(Vx*Vx+Vy*Vy));
Theta:=ROUND(ARCTAN(Vy/Vx)*180/Pi);
Writeln(‘x:’, X:10,’ ’,‘y:’,Y:10);
Writeln(‘v:’, V:10,’ ’,‘Theta:’,Theta:5);
end.{prog_Q3}
Answers
RUN 1
Enter launch angle(A),time of flight(T),and launch velocity(U):45 3 60
X: 97 y: 107
V: 38 Theta 33
RUN 2
Enter launch angle(A),time of flight(T),and launch velocity(U):45 5 60
X: 162 y: 130
V: 32 Theta 2
RUN 3
Enter launch angle(A),time of flight(T),and launch velocity(U):45 6 60
X: 195 y: 127
V: 33 Theta -14
musadoto ©2018 slideshare2
4.Write the output of the program below for the following inputs
40.0 10.0
0.0 15.0
60.0 15.0
70.0 15.0
-1.0 0.0
PROGRAM Prog_Q4;
{Repetitive pay algorithm}
CONST
WeekHours = 7 * 24;{hours in a week}
VAR
Hours, Rate, Pay :REAL;
BEGIN
Write(‘Enter number of hours and rate ’);
Read(hours, rate);
WHILE Hours >= 0 DO
BEGIN
IF(Hours < 0) OR (Hours > WeekHours) THEN
Writeln(‘Errors in hours’)
ELSE
BEGIN
IF Hours <= 60 THEN
IF Hours <= 40 THEN
Pay := Hours * Rate
ELSE
Pay := 40 * Rate + 1.5 * Rate * (Hours - 40)
ELSE
Pay := 70 * Rate + 2 * Rate * (Hours - 60);
Writeln(‘The pay is ’,Pay:7:2);
END;{IF}
Write(‘Enter number of hours and rate ’);
Read(hours, Rate);
END;{WHILE}
END.{Prog_Q4}
Answer
Enter number of hours and rate 40.0 10.0
The Pay is 400.00
Enter number of hours and rate 00.0 15.0
The Pay is 0.00
Enter number of hours and rate 60.0 15.0
The Pay is 1050.00
Enter number of hours and rate 70.0 15.0
The Pay is 1350.00
Enter number of hours and rate -1.0 0.0
Errors in Hours
Note for ‘ and ’
SOLUTIONS BY FRIENDS

More Related Content

PPTX
PPT
Glider Flight Test
DOCX
Dam31303 lab sheet 4
DOCX
mat lab code to display heat flow (Q) and Thermal resistance (‘R’)
PDF
knight-Layout1
PDF
kel_mukesh
PPTX
Project
PPTX
Algorithms
Glider Flight Test
Dam31303 lab sheet 4
mat lab code to display heat flow (Q) and Thermal resistance (‘R’)
knight-Layout1
kel_mukesh
Project
Algorithms

Similar to Ae 219 - BASICS OF PASCHAL PROGRAMMING-2017 test manual solution (20)

PPTX
Computer Science Programming Assignment Help
PDF
Matlab solved tutorials 2017 june.
PDF
Chapter 6 Flow control Instructions
PDF
PDF
9608_s19_4_3_qp.pdf
PDF
1153 algorithms%20and%20flowcharts
PPTX
Programming fundamentals lecture 4
PPT
Algorithmsandflowcharts1
PPT
Algorithms and flowcharts1
PPT
Algorithmsandflowcharts1
PDF
BASICS OF COMPUTER PROGRAMMING-TAKE HOME ASSIGNMENT 2018
PDF
Nov 02 P2
PPTX
Programming fundamentals lecture 2 of c
PPTX
Why computer programming
PPSX
Problem solving and design
PPTX
assembly language programming organization of IBM PC chapter 9 part-2(decimal...
PDF
LEC 5 [CS 101] Introduction to computer science.pdf
PDF
chapter 7 Logic, shift and rotate instructions
DOCX
Fatima Aliasgher Portfolio
Computer Science Programming Assignment Help
Matlab solved tutorials 2017 june.
Chapter 6 Flow control Instructions
9608_s19_4_3_qp.pdf
1153 algorithms%20and%20flowcharts
Programming fundamentals lecture 4
Algorithmsandflowcharts1
Algorithms and flowcharts1
Algorithmsandflowcharts1
BASICS OF COMPUTER PROGRAMMING-TAKE HOME ASSIGNMENT 2018
Nov 02 P2
Programming fundamentals lecture 2 of c
Why computer programming
Problem solving and design
assembly language programming organization of IBM PC chapter 9 part-2(decimal...
LEC 5 [CS 101] Introduction to computer science.pdf
chapter 7 Logic, shift and rotate instructions
Fatima Aliasgher Portfolio
Ad

More from musadoto (20)

PDF
The design of Farm cart 0011 report 1 2020
PDF
IRRIGATION SYSTEMS AND DESIGN - IWRE 317 questions collection 1997 - 2018 ...
PDF
CONSTRUCTION [soil treatment, foundation backfill, Damp Proof Membrane[DPM] a...
PDF
Assignment thermal 2018 . ...
PDF
ENGINEERING SYSTEM DYNAMICS-TAKE HOME ASSIGNMENT 2018
PDF
Hardeninig of steel (Jominy test)-CoET- udsm
PDF
Ultrasonic testing report-JUNE 2018
DOCX
Fluid mechanics ...
PDF
Fluid mechanics (a letter to a friend) part 1 ...
PDF
Fluids mechanics (a letter to a friend) part 1 ...
PPTX
Fresh concrete -building materials for engineers
PPT
surveying- lecture notes for engineers
PDF
Fresh concrete -building materials for engineers
DOCX
DIESEL ENGINE POWER REPORT -AE 215 -SOURCES OF FARM POWER
PDF
Farm and human power REPORT - AE 215-SOURCES OF FARM POWER
PDF
ENGINE POWER PETROL REPORT-AE 215-SOURCES OF FARM POWER
PDF
TRACTOR POWER REPORT -AE 215 SOURCES OF FARM POWER 2018
PDF
WIND ENERGY REPORT AE 215- 2018 SOURCES OF FARM POWER
PDF
Hydro electric power report-AE 215 2018
PDF
SOLAR ENERGY - FARM POWER REPORT AE 215
The design of Farm cart 0011 report 1 2020
IRRIGATION SYSTEMS AND DESIGN - IWRE 317 questions collection 1997 - 2018 ...
CONSTRUCTION [soil treatment, foundation backfill, Damp Proof Membrane[DPM] a...
Assignment thermal 2018 . ...
ENGINEERING SYSTEM DYNAMICS-TAKE HOME ASSIGNMENT 2018
Hardeninig of steel (Jominy test)-CoET- udsm
Ultrasonic testing report-JUNE 2018
Fluid mechanics ...
Fluid mechanics (a letter to a friend) part 1 ...
Fluids mechanics (a letter to a friend) part 1 ...
Fresh concrete -building materials for engineers
surveying- lecture notes for engineers
Fresh concrete -building materials for engineers
DIESEL ENGINE POWER REPORT -AE 215 -SOURCES OF FARM POWER
Farm and human power REPORT - AE 215-SOURCES OF FARM POWER
ENGINE POWER PETROL REPORT-AE 215-SOURCES OF FARM POWER
TRACTOR POWER REPORT -AE 215 SOURCES OF FARM POWER 2018
WIND ENERGY REPORT AE 215- 2018 SOURCES OF FARM POWER
Hydro electric power report-AE 215 2018
SOLAR ENERGY - FARM POWER REPORT AE 215
Ad

Recently uploaded (20)

PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
Lecture Notes Electrical Wiring System Components
PDF
Arduino robotics embedded978-1-4302-3184-4.pdf
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PDF
PPT on Performance Review to get promotions
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPTX
Welding lecture in detail for understanding
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PPTX
additive manufacturing of ss316l using mig welding
PPTX
Construction Project Organization Group 2.pptx
DOCX
573137875-Attendance-Management-System-original
PPTX
Lesson 3_Tessellation.pptx finite Mathematics
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Lecture Notes Electrical Wiring System Components
Arduino robotics embedded978-1-4302-3184-4.pdf
CYBER-CRIMES AND SECURITY A guide to understanding
PPT on Performance Review to get promotions
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
Foundation to blockchain - A guide to Blockchain Tech
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Welding lecture in detail for understanding
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
Model Code of Practice - Construction Work - 21102022 .pdf
additive manufacturing of ss316l using mig welding
Construction Project Organization Group 2.pptx
573137875-Attendance-Management-System-original
Lesson 3_Tessellation.pptx finite Mathematics
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...

Ae 219 - BASICS OF PASCHAL PROGRAMMING-2017 test manual solution

  • 1. musadoto ©2018 slideshare2 AE 219-COMPUTER PROGRAMING TEST 2017 MANUAL SOLUTION 1.Write a program to describe the weather according to the following temperature Classifications: Temperature, T(O C) Classification T>40 Very Hot T>25 and T≤40 HOT T>20 and T≤25 Cool T>3 and T≤20 Cold T≤3 Freezing answer PROGRAM WeatherTester(INPUT,OUTPUT); VAR Temperature :INTEGER; VeryHot, Hot, Cool, Cold, Freezing :BOOLEAN; BEGIN WRITE('Please enter the temperature:'); READLN(Temperature); VeryHot := (Temperature > 40); Hot := (Temperature > 25) AND (Temperature <= 40); Cool := (Temperature > 20) AND (Temperature <= 25); Cold := (Temperature > 3) AND (Temperature <= 20); Freezing := (Temperature <= 3); WRITELN; IF VeryHot THEN WRITELN('Very Hot') ELSE IF Hot THEN WRITELN('Hot') ELSE IF Cool THEN WRITELN('Cool') ELSE IF Cold THEN WRITELN('cold') ELSE IF Freezing THEN WRITELN('freezing') ELSE { End of the IF construct } WRITELN('Press ENTER to continue..'); READLN END.
  • 2. musadoto ©2018 slideshare2 2.Write the output of the program below using exponent values from 1 - 20. PROGRAM Prog_Q2; VAR Base, Power, Start, Final :INTEGER; BEGIN Base := 2; WRITE('Enter starting exponent:'); READLN(Start); WRITE('Enter ending exponent:'); READLN(Final); WRITELN; WRITELN('Number Power of two'); FOR Power := Start TO Final DO BEGIN WRITE(Power:3); WRITELN(EXP(LN(Base)*Power):20:0) END; WRITELN; WRITELN('Press ENTER to continue..'); READLN END. {Prog_Q2} Answer Enter starting exponent:1 Enter ending exponent:20 Number Power of two 1 2 2 4 3 8 4 16 5 32 6 64 7 128 8 256 9 512 10 1024 11 2048 12 4096 13 8192 14 16384 15 32768 16 65536 17 131072 18 262144 19 524288 20 1048576 Press ENTER to continue.. 3.Write the output of the following program with the following input data 45 3 60 45 5 60 45 6 60 Comment on the results (outputs)
  • 3. musadoto ©2018 slideshare2 PROGRAM Prog_Q3; Const g=9.8;{acceleration due to gravity} Pi=3.1415927;{a well-known constant} var A:integer; {launch angle in degrees} T:integer; {time of flight} Theta:integer; {direction at time T in degrees} U:integer; {launch velocity} V:integer; {resultant Velocity} Vx:integer; {horizontal Velocity} Vy:integer; {vertical velocity} X:integer; {horizontal displacement} Y:integer; {vertical displacement} begin write(‘Enter launch angle(A),time of flight(T),and launch velocity(U):’); READ(A,T,U); A:=ROUND(A*Pi/180); {Convert angle to radians} X:=ROUND(U*COS(A)*T); Y:=ROUND(U*SIN(A)*T-g*T*T/2); Vx:=ROUND(U*COS(A)); Vy:=ROUND(U*SIN(A)-g*T); V:=ROUND(SQRT(Vx*Vx+Vy*Vy)); Theta:=ROUND(ARCTAN(Vy/Vx)*180/Pi); Writeln(‘x:’, X:10,’ ’,‘y:’,Y:10); Writeln(‘v:’, V:10,’ ’,‘Theta:’,Theta:5); end.{prog_Q3} Answers RUN 1 Enter launch angle(A),time of flight(T),and launch velocity(U):45 3 60 X: 97 y: 107 V: 38 Theta 33 RUN 2 Enter launch angle(A),time of flight(T),and launch velocity(U):45 5 60 X: 162 y: 130 V: 32 Theta 2 RUN 3 Enter launch angle(A),time of flight(T),and launch velocity(U):45 6 60 X: 195 y: 127 V: 33 Theta -14
  • 4. musadoto ©2018 slideshare2 4.Write the output of the program below for the following inputs 40.0 10.0 0.0 15.0 60.0 15.0 70.0 15.0 -1.0 0.0 PROGRAM Prog_Q4; {Repetitive pay algorithm} CONST WeekHours = 7 * 24;{hours in a week} VAR Hours, Rate, Pay :REAL; BEGIN Write(‘Enter number of hours and rate ’); Read(hours, rate); WHILE Hours >= 0 DO BEGIN IF(Hours < 0) OR (Hours > WeekHours) THEN Writeln(‘Errors in hours’) ELSE BEGIN IF Hours <= 60 THEN IF Hours <= 40 THEN Pay := Hours * Rate ELSE Pay := 40 * Rate + 1.5 * Rate * (Hours - 40) ELSE Pay := 70 * Rate + 2 * Rate * (Hours - 60); Writeln(‘The pay is ’,Pay:7:2); END;{IF} Write(‘Enter number of hours and rate ’); Read(hours, Rate); END;{WHILE} END.{Prog_Q4} Answer Enter number of hours and rate 40.0 10.0 The Pay is 400.00 Enter number of hours and rate 00.0 15.0 The Pay is 0.00 Enter number of hours and rate 60.0 15.0 The Pay is 1050.00 Enter number of hours and rate 70.0 15.0 The Pay is 1350.00 Enter number of hours and rate -1.0 0.0 Errors in Hours Note for ‘ and ’ SOLUTIONS BY FRIENDS