You are on page 1of 16
CONFIDENTIAL, CS/AUG2021/ CSC128/FINALTEST UNIVERSITI TEKNOLOGI MARA FINAL TEST taal FUNDAMENTALS OF COMPUTER PROBLEM SOLVING COURSE CODE : CSC128 SEMESTER : 7 AUGUST 2021 TIME 3 HOURS INSTRUCTIONS TO CANDIDATES 1. This question paper consists of two (2) parts : PART A (7 Questions) PART B (1 Question) 2. Answer ALL questions 3 Allanswers must be handwritten. 4. Do not contact anyone during the test. Name SITI NUR LYANA FARAH FAQIRAH BT HUSSIN UITM Student's Id Number: 2020836154 Lecturer's Name KHAIRUNNISA ABDUL KADIR Group EC11026 Part Total Marks Marks A 55 B 15 Total 70 DO NOT TURN THIS PAGE UNTIL YOU ARE TOLD TO DO SO This examination paper consists of 7 printed pages Subject ck int float price, totalfrices DQ = = a cout é' menu" ze endl couiee" a" ce setw (12) <6" Pizzq! ceendl coud ee" 6" 4é $e4wli2) ee" doughnut" <4 endl! coud 22" C" ze Setwli2dez * Ice cream" ? code? . couree" Please enter the Quantity + "2 Gin 2> quantitys Fis if Ceode =='A') i cout <<" Our pizza is homemade pizza" * price = 25-02 else if (code == 'B') cout <<" Our dowghnut soft til the end": price = 15-0! Not Subject. Dae else if Ccode 'c') — Gur ice cream isthe best "3 flice = 10-0 u else i pice = 0 cout" Thane You!" ay HeraiPice = Price * quantity coutee" your +ota) is + AM "2etotalPrice 2 endit cout 46" ThONK You |" ze endl: return 0: j > 7 = | 71 4 — — ~ — — ——, "_= 7 Subject: a) fp FIRST — . i) SECOND eZ. b) it Cvofue 220) : - c if (value 2 >20) 3 r coure coutze" C~ Contract worker ze end cowtee" Choose Your cate9ory + "zz end|: Cin >> coregory : cout ze" Enter the basic salary : RM "3 Cin 22 basic Sa)arys Switch (category? eqse «Pp! ti 'p! increags€ = 0-054 break? increase = 91023 breaks couree" Please enter the correct category": DRT wow costaione Subject: new Salary besicSalary + incremen Couthes “Your bosic colony iy kM" 4e basic Salary 2 end cout de® Your ere ment iS RM ee increment <¢ endl: covtec” Your new $aMary iy RM " ze DEWSaletry ve endl: yerurn 05 be? No: Subject ee 7 os . lor firstnum ) cecondNum: int sumodd=0 . simEven=o: Ficst pam &r must be ess course" Enter she first Number: cin > firsdNum! than second number "<< endl: Coutec" Enter the second numbers "y Cin>> secondNum} if CfirstNum <$econdNum? § for Cint i i firsinum . ig =SecondNum , it) Comes" Odd numbers " <¢ sedw Cis) ze " Even Number” << ends if ipa =0? A cout eelce ver: sum Odd+4s 3 else 4 couteci >0um 5 if (num <1 8 num 250) 5 cove" ERROR INPUT I) THE NumBeR must 8t BETWEEN 1 To 50, ENTER THE NUMBER AGAIN "<< i<<) "> cin >> pum 4 its fC num 2 5 t Hf Cnume miP) L mines num 5 he cout 22 "the lowest odd dt Vecmind rete OF 4 —— ORY wm costetionerycommy Sujet Date: double squareRoct 5 value sivisibie 3, fixed? Couteprecision (325 value Divisible 53 cout: Seif (ios : do cout" Enter q number (ess than 2027 2 Cin 22h) cour" PLEASE enter an integer +o continues” da eum s value Divisible3 = num 2 } valudivisible 2 tts valupivisibled = Dum “s 5¢ Va lve Divisible S ++ sum © yum + num squareRogt = Pow( sum , 0:T) 4 while Cnum 2= 20) cout ze" Number of inte9er value divisible by 3 = " >2 value Divisible? << endl? cout> valuevivivible 5 << end 3 coupes" SP roth of summation value =" squoreRoot 5 returos SOR «enn ryc0n Subject: Date: Question > 0) int HeKet®nce ( int NumodtAdul 4 int numCf Children? double fotPrice 5 to+alPrice = Numot Adu reture tofalPoces =i1Gcs esse 2 Char g ‘ : a grade status ( Hoat Score ) 7 Cout<<" PICASE input You Score is fC score >=45) 4 <" Your grade =A 3 S EIS if C score >= 40) Coutze" Your grade =8" 3 4 else Coul<<" Your grade= cv; 4 retum Score + —_| a __ | = — —_ | pecs i No:_. Date: PART & CRuestion 1) —_—— — Minclude ge Cinteode , int r imofDay) ind moin Q _ chor name Uso? double ieNum =: int code + numofdays char category, cqot fleat discount? Cour e" Do You want 4o start the program C¥- yer, N-no} 2? "5 Cin oe spatuss while Giatuy =='¥') cout cc" please enter she patient name: ": cin-getline (nome, 50)? cour ze" Plerye enter your IC number i" 2 cin 2? icNum? cine igocre; cout ce" warded Patient category << seiw C502 x "warded Patent Type Code "<< seiw( se) 4" charge Per Day (KM) " << endl Covtec s€4w IS) <4" Surgery " 2 setw C15) "cop! 2eSetw Cis) 24 "Bee 00 Nee endl: cent ee ser 4" Orthopedic! 2¢ 3e4w U5) << "oa" ze Sedw C152 44 1250: 00"« endl 3 cout Z selwis)2é" Medical ee S01 CS) 22" 00 3 hee SeAWOIS) £" 200-00 2e endl CREE ewe conaenerycons the warded patient tupe code: cin >> code 3 vsze" Choose the category [e-Chiid, A- Adu yes an cate ony) ce’ Please enxer the number of days warded i "5 cn Ca >zourn Of Days if Ceategory =='C') ¢ t diSCOUNT = warded Patient Charge C code. numoibay) * 0-25 ri ‘ else it (category == 'A') t discount = wardedPatient harge( code, numef Pay) *® 055 5 No: Subject... Date I | | | cout 2c" Potent name << nome 2c endl | i | | coudee* 1C Numbers “ eeicnum << ends | -* Patient category} " 4¢ category « endii u Number of day? | << numotday

You might also like