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

Lecture 5 Single File Programming Questions

Uploaded by

syash9457
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
310 views

Lecture 5 Single File Programming Questions

Uploaded by

syash9457
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 12
oven © ‘Single Fle Programming Question ‘ovine magne youre devaepinga payrel management sytem for acorgon hanes oop tockal amplyee sary lamatin fepertf tha ysem yous toead wah cestngacxe ana eployen to epresrt each eployessla,. te clos shod have te folowng spctetons | prt tate data mare named cout eps Hackl ha tel number ployee tect este shou ned d ‘pub tae rebar uncon named gato that lows he company ftv he ttl cour eploes cies | put member incon raed ete nes thai ery’ parce crt ecrerpansng can membarforanameoyee bc. icin lloe he company oat ‘nasa or on empoyes ‘pune mera uncon nada ries cnieturathe oie "ary for anempsyes ect Th incon als th comgany te eee on employes sl fr varus ‘pris Sta mame nods sore ne eg saun clon employers sony Ts ta member spect to sch empayes obec ose ont ven spcicson your tats to implemen te Employes coss ht met the eaten enna above This close hp he company manoge eros slay slematonalicary thn te poyl managementeatrs Note: This is a sample question asked in an HCL interview. Input format : The first line of the input consists of an integer denoting the number of employees (n). The next n lines consist of the salaries of n employees stored as integers. Output format : The output displays the total number of employees, followed by their salary on each line. Refer to the sample output for formatting specifications. ‘Sample test cases : Input: output: 3 ‘Total number oF employees: 3 200 Solary for enployee 1: 100 200 salary for employee 2: 200 200 Salary for exployes 3: 200 Woitetiae «) CD CD xa Cea Ct) #include Penge ee ete ee storie peers eters Sirarey Cars public: erate rare home| reas) 3 void setsalary(int s) { Pesan ernie rr Tira ie STONE t Peart o es Cee cy oe Pat tet ae ra OOS pos Stee ooo aH Ce ea aC Pec SU erit TS Oa cee Serie ie 3 CeCe Ce Soret cea cae) CL ae ee eae et cout << “Salary for employee } pects Sea Ore ERE oe eT cers sconmacedsonngcoim: UGE) (NE) (GR) panes! ‘on comect | antotind 19h | ntuted © Tinescompled 1 | Tnesauimiied 1 | lel Ward | Gueianhge geriePegemming Siti ve ‘opie Clomeandenhels SubTene Chaeeondehiec —tosrstenny sey oat aa recat Paesed Compr Messo9e Salary for eapoyee 10100 Solary for erpoye a 200 Slory for saployee 6: 0 cones ouoe Salary far empoyee 3: 300 Solar far erpoyee 3 200 met) ‘ime complosty space Complenhy tne ue corpse 2 ° eect “ : = corplatonnccute pet Sony Yor employe 1 10 ‘Siar fon eater 2 508 Stary for enloyee 3: 08 Slory for cnloye 4 90 Sy for clos: 0 ‘Slay for caployes 6 Slur for cmloje 7 30 Sin for clos 6 50 neti esl aber of emoyees: 8 Sin Yer eaployee 1 to SsLy for satay 3: So Slory for culoyer 3 60 SLi for cuployes 4 9 Sy for saptoyn 8 a Siar for eto 6 10 Ser for suloye 7 20, SELLY for Saptoyn 0 Dn ent oe Salers for erployee 25 56 Sity fee Sloe Se Slary foreplay 6: Salery for erploye 6 cues out tol ater of employees 10 ‘Slary tor sapoyen 12 1528 ‘any for splojes 3: 3356 Sslery for erployee 31 856 Slory for enloyes es 15 Solution 1 ttrees Cree Perag ros cei rm one etre static int count; SUT ICL Pry ete) estar ico Os Roce sy i iret Ca eLiars Erna i rarer One return salary; iy es ortO ne eras Sires SRT Solution 1 eran Cora oc cret sc aeeers int main() { fay) teem Employee “emp — new Employee[n]; for (int i = 0; i

You might also like