0% found this document useful (0 votes)
39 views

Data Structure Finall

This document contains directions for a data structures final examination with two tests. Test 1 involves creating flowcharts to display a menu and determine student year level based on input, and compute the total price of purchased items. Test 2 involves identifying syntax errors in code snippets that perform currency conversions and display options with a menu. The document provides sample code and asks examinees to write answers in their pink book using black ball pen.

Uploaded by

Ian D BacheLor
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views

Data Structure Finall

This document contains directions for a data structures final examination with two tests. Test 1 involves creating flowcharts to display a menu and determine student year level based on input, and compute the total price of purchased items. Test 2 involves identifying syntax errors in code snippets that perform currency conversions and display options with a menu. The document provides sample code and asks examinees to write answers in their pink book using black ball pen.

Uploaded by

Ian D BacheLor
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 5

Data Structure

Final Examination
General Direction: Read everything before you do anything. Erasures will
be marked wrong. Write your answers on your pink book. Use black Ball
pen.
Test 1. The following problem must be answered Using Switch Statement.
A. Create a Flowchart that will display a menu. From the menu, the user
can select an option to display a set of information.(12 points)
Code:
1
2
3

Option:
Greeting
Inspiration
invitations

B. Create a Flowchart that will determine the year level of the student
based on the inputted number.(10 points)
Code:
1
2
3
4

Option:
First Year
Second Year
Third Year
Fourth Year

C. Create a Flowchart that will compute for the total price of the items
purchased by a customer. Use the ff product list as reference.(20
points)
Product Code:
A
B
C

Product name:
Hand Bag
Traveling bag

Price:
350.00
1000.00

Gym Bag

500.00

Test 2 Write Syntax Error if any of the statement/s, condition/s, syntax/s,


number/s, or character/s has an error; else leave it blank.
A.
1. #include<stdio.h>
2. #include<conio.h>
3. #include<process.h>
4. #include<ctype.h>
5. #define g gotoxy
6. #define p printf
7. #define s scanf
8. #define dollar 43.00
9. #define yen .5
10. #define riyal 12
11. #define pound 68
12. main()
13. {
14. char reply;
15. int choice;
16. float dollar1,yen1,riyal1,pound1,peso,peso1;
17. do{
18. clrscr();
19. g(15,3);p("*********************************************** ");
20. g(23,5);p("F O R E I G N E X C H A N G E ");
21. g(15,7);p("*********************************************** ");
22. g(32,10);p("[1] Peso-Dollar");
23. g(32,12);p("[2] Dolar-Peso");
24. g(32,14);p("[3] Peso-Riyal");
25. g(32,16);p("[4] Riyal-Peso");
26. g(32,18);p("[5] Peso-Pound");
27. g(32,20);p("[6] Pound-Peso");
28. g(32,22);p("[7] Peso-Yen");
29. g(32,24);p("[8] Yen-Peso");
30. g(32,26);p("[9] Exit");
31. g(15,30);p("Enter Choice: ");
32. s("%i",&choice);
33. g(15,32);p("*********************************************** ");
34. switch (choice){
35. case 1:
36. g(32,34);p("PESO-DOLLAR");
37. g(22,38);p("Enter Currency in Peso ");
38. s("%f",&peso);

39. dollar1=peso/dollar;
40. g(22,41);p("The equivalent in Dollar is %.2f",dollar1);
41. break;
42. case 2:
43. g(32,34);p("DOLLAR-PESO");
44. g(22,38);p("Enter Currency in Dollar ");
45. s("%f",&dollar1);
46. peso1=dollar*dollar1;
47. g(22,41);p("The equivalent in Peso is %.2f",peso1);
48. break;
49. case 3:
50. g(32,34);p("PESO-RIYAL");
51. g(22,38);p("Enter Currency in Peso ");
52. s("%f",&peso);
53. riyal1=peso*riyal;
54. g(22,41);p("The equivalent in Riyal is %.2f",riyal1);
55. break;
56. case 4:
57. g(32,34);p("RIYAL-PESO");
58. g(22,38);p("Enter Currency in RIYAL ");
59. scanf("%f",&riyal1);
60. peso1=riyal*riyal1;
61. g(22,41);p("The equivalent in Peso is %.2f",peso1);
62. break;
63. case 5:
64. g(32,34);p("PESO-POUND");
65. g(22,38);p("Enter Currency in Peso ");
66. s("%f",&peso);
67. pound1=peso/pound;
68. g(22,41);p("The equivalent in Pound is %.2f",pound1);
69. break;
70. case 6:
71. g(32,34);p("POUND-PESO");
72. g(22,38);p("Enter Currency in Pound ");
73. s("%f",&pound1);
74. peso1=pound*pound1;
75. g(22,41);p("The equivalent in Peso is %.2f",peso1);
76. break;
77. case 7:
78. g(32,34);p("PESO-YEN");
79. g(22,38);p("Enter Currency in Peso ");
80. s("%f",&peso);
81. yen1=peso/yen;
82. g(22,41);p("The equivalent in YEN is %.2f",yen1);
83. break;
84. case 8:

85. g(32,34);p("YEN-PESO");
86. g(22,38);p("Enter Currency in Yen ");
87. s("%f",&yen1);
88. peso1=yen*yen1;
89. g(22,41);p("The equivalent in Peso is %.2f",peso1);
90. break;
91. case 9:
92. exit(0);
93. default:
94. g(32,38);p(" invalid code!!");
95. break;
96. }
97. g(15,44);p("*********************************************** ");
98. g(22,46);p("Do you want to try again? [Yes/No]");
99. reply=getch();
100.
}while(toupper(reply)=='Y');
101.
getche();
102.
}
B.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.

#include<stdio.h>
#include<conio.h>
#include<ctype.h>
#include<process.h>
#define p printf
#define s scanf
#define g gotoxy
main()
{
int choice;
char try;
do {
clrscr();
g(15,4);p("****************************************************");
g(28,7);p("Select an option [1 - 3");
g(15,10);p("****************************************************");
g(28,15);p("[1] greetings");
g(28,18);p("[2] Inspiration");
g(28,21);p("[3] Invitation");
g(15,24);p("****************************************************");
g(20,27); p("Enter your Selection [] ");
s("%d",&choice);
switch(choice) {

126.
127.
128.
129.
130.
131.
132.
133.
134.
135.
136.
137.
138.
139.
140.
141.
142.
143.

case 1:
g(28,30);p("Magandang Umaga Pilipinas");
break;
case 2:
g(28,30);p("There is a positive side to every one");
break;
case 3:
g(28,30);p("Join the club");
break;
default: break;
}
g(20,34);p("Do you want to try agin? [Y]es");
try= getch();
}
while(toupper(try)=='Y');
g(50,38);p("Press any key to exit...");
getch();
}

GOOD LUCK!

You might also like