100% found this document useful (1 vote)
2K views32 pages

Cognizant Tech

Teri mkb

Uploaded by

mckvie25
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
100% found this document useful (1 vote)
2K views32 pages

Cognizant Tech

Teri mkb

Uploaded by

mckvie25
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 32
of pyramid as 4, for which the pyramid structure will look like: R he pyramid is 36. Hence, 36 is returned as the output V Neants ae Branham $$$ $$$ * 0 or ko dovrmpteat 77 | Question | EL rerwattaer | MVAIT 7 Commpter java | 1 beport ge Now to Attempt? 2 impart | 2 What ts XP 411 Wead only region start | 4 clans Uneenatnes ee Te satin pack weal a8 # Arniiew weeente Bn anteater vane XA hor . aot tinge int pos aM pA a BH XY Ble i oet thes repeat th * 11 eas onky ree pees Sep anetties bot Jenene 2 oahu 1 e-waste Rt Ace aay aus Mhygergy a attired Bot uk tegde tee te ctalatiny i Sse ee tnesy Ligses ay cavenplactinng oene frais ” ’ NT NS ath SV dy 2 vanitewiehaa 47 sing re to ZT 22, and ZI AS a means of fevning Bruce's mental ability, Andrew now presents Broce with the values 21,22. and 25 ‘Cyr task ts to help Bruce find ing the ong mal integer 1D Use Custom Input ¢ stl svatiry Le halngh AY #8 RODD 1 ane entogamm = © ‘Qualifying Score There «sa competition ina school The cutett to take part this competition n having a qualifying score of 35 marks or more There are M subjects Haught in a clas Marks obtained in each subject anv semesters | and 2 are qrven i the form of am array S¥ and $2 respectively. The qualifying score #4 calculatect in the following way © Step 1 Subtract marks abtamed in i® aubject m Semester 1 from marks obtained an i" subject en Seoesipe 2. S2 + STHL where = O12 © Step 2 Add the maiks. cf upto P subjects with the mavimum scores obtained after subtraction in Step 1. This wall gree a studtents quaktying score, The ain #8 to get a score equal to or greater than 35 Ut the quatying score is greater than or equal to 34 then the students 1s Qualihed to appear in the competition, else they are Disqualified Your tack 1s to hd and retum a string value; representing the result that 1s Qualified or Disqualified followed by the score achieved (separated by a space) Attempted O72 ' JAYANT > Compiler 2 deport gaa te.e 2 Amport java util. a 4/4 Read only region % class Usertalntode ee 7 . Public String d * AJ Read ont cy a) Write ea it three newb a ? oo} @ intelliSenye has loaied CD Use Custom input 1 csiunbiy code whee dialing) MQ +1 (800) 28 Note WAIT Comper: Java = <.cmes rot om 7 z eth . c © /f mead only Poglon stare — | 5 Clans Ueermaincode Input Specification « Input © An integer value, representing the number . publle int #inaatine inpunz : An intege ing the umb ead only ree input : An inte nat the th * write code he new Unipg Ovipst Specification Example 1 inputt : imputz inpuss, ( ) @ : uy | findX(cls, input1, input2, input3): x1 etal i) tf 2 es Oty iw 1) sf 2 (input3 >is ae ent a) ((x3 & (1 << i)) I= @): cnt += (1 << i) fanaa Expected return type i # Read only region end w rite code here: a= inputa n= len(a) s-0 for 1 in range(2°*(n-3)): ans = @ ss = a[0] for J dn range(n-t)e if{i>>§) ansreint(ss) ss» afjel} else: sst~ aljel] if foane2: anceaint(ss) Seeans f nest: return strCa) else: | return ste(s) © The length of sing S is ciwoys ever. CO Use Met! Online Assesement © ayNeed Help? = (Please aid country 2021-2031 ¥ ms 5 “code while dialing: Here in this « perform the ss v trne f naney way: - pra {eof type 1. we convert ® The second of tye 1 we convert » wie! Otani vert awl string Obtained after dertorming jal Henté, CERMER is ee eee cee creep meee nee eee Fal Pesve-iiar nacelles alia Geneniacionantel es . Meer ri’ iri inputs : (1.2.1) | Output = BADC Explanation: Herein thes example. on the string “ACD” we can Perform the sequence of operations on the following * The t ation mw oltype 1, we convert ' | “ABCD te “DECA™ i (@ The second operation is of type 2. we convert ) DECA* to “CADE third Operation is of type 1. we convert “CADE” ta “BADC™. Therefore the final string obtained after performing all the operations 1s BADC™. hein? Cortact us (Plesse r rode while dialing rhe Sample cases BE ie | ae er | eee he sre eu sea G same ul is) (result) res = input1 n = input2 Fleer ale] he} (Cs arr[i] AQ res = typel(res) arr[i] : ae e997 4 [Ga -) D) La 3 << 1. Hands on Programm + o Qualifying Score There ws a competition inaschcol The cut-off to take part in thin competion mn having @ qualtying score of 15 marks of more. There are N subjects taught ina class Marks obtamed in each gubpect wnvvemesters Vand 2 are qweninthe form of an aray $0 and $2 respectively The qualifying wore es calculated i the following wiry © Step 1 Subtract marks obtamed ini sulyect in Semester 1 from marks obtained ina!” subject in Semester 2 be, $2[i] - S1fu), 8 where ie O12 w ® Step 2 Add the marks, cf upto P subjects weth the macinum stores, obtined after subtraction in Step 1. This will quae a student's quakfeng score. The air i to get.a score equal to or greater than 35 If the qualifying score rs qreater than or equal to 25 then the students 1s Qualitied to appear in Lhe competition, ele they are Diquathed Your tavk is to fm and return asteng value, representing the result that + Qualified or Disqualified follawed by the score achieved separated by a space, ant Pm at Sentlan Mest) Cake Acuotinent 2) 712097 yu Si Fees ated Fr Zs = ‘Anvemwpted af? Note lavAt? + Compiler java 4 * comer 10 1 eB he tg 1 Aster eee 2 import ” jowa.etil.*y © Heeege tt Ha aH nee verve “ © rt reek datiret 4 // Read only region store Shane Usertaincode iv Input Specification input | An integer value, representing the mumber 21 . publie Lit finge( lat tegen : An enieger ¥ evening the number . input Bead only regi ntege 1) rien enge hat ne ni Uneupp ‘Output Specification: Example 1 inputt input? inputs (cls, input1, input2, input3, input4): eC ie eera oc o8| eres ule (res[:input2))} (res{ :input2})} Question | (1 Revisit Later How to Attempt? Solve the Lquation Give an iiteset ND your Lack 6 fo find andl return the number of vets of 1 porutive yeadc thet satnty the following equation: wethecrabebora N integers a Mote: ab and ¢ arn penitiwe intenpers, are thea wuss can the the arr Input Specification: “Jnput : An integer value N. Output Specification: Return an integer value, representing the mumber of sets of three polfive integers that satisty the equation given above. Example 1: input 6 ‘Output : 1 Explanation: for N — 6, there is only one set of 3 integers that satisfies the equation a? + b? « ab + be + ca = N tester tn? Pantact vee (area PYTHON3 7 Comysiter Python 344 i deport math 2 Read only region start 3 clase Userttaingodefobject 4 Gclassmethod > Gef solveequation(els, input): © o 7 inputa : int a 9 Expteted return type : int # Read only region end Flite code here ent~o for 4 in (2 Ant (math sqrt (nput1)) 61): for J in range(2, int (math. sqrt (Amput 19) 61): ce for kin ranged, int (math. sart (input if peje rok e tye i: contest 1 return ont 38 co < wi2 i > a f _— ~ (._Attmemgted: 272 Pal Ee : : PYTHONS ~ — Compiter Python 3.11 > G6 ¢ ' one aropen a eames ot - 3 Expected return type : int te ane u | ® teed only region end 12 f Write code here uo count=? “uv for 1 in range(1, tar ({nputt®*d.5)e1): wey | for J in range(t, tnt (inputie*a 5)et)> ev | for k in eange(1,ist(dnputieee. 5)el): Iv AF 198 2ef* loess leol*fofmtee*toeteputh: is counte=} 15 | return count 2 é © Use: Custom tneut 1ON3 7 Compiler: Python 3.14 L 2 # Read only region start 3 class UserMainCode (object): 4 @classmethod 5 def laststring(cls, input1); & nie 7 input ; string 8 9 Expécted return type : string 18 Buin ji 1 # Read only region end 12 # Write code here B fregat hi!) 14 for i in inputa: as freq[il=freq.get(i,o)+1 16 maxi=float('-inf') ans="" for k,v in freq. items(): if vomaxi: ei f 4 @coding_news L Tae) select product_id, code,name, unit_price from product order by unti_price desc limit 1; Overton Bite iane Ket been Soe How tbat Nemo ae erent |e macne? prea n gome e Ste sehen eas eee na erro pat dims tar © re tome Steere ene te o nerctene tent sereemer ar te potenet ome Bini tenet © renee tte? © nents Tne? MYSQL 8.0 - 1 SELECT * From train_details tbl 2 Where TRAIN_FROM IN 3 (select station_id from train_stations tbl where station_name lite 4 0 tradn_to 1 s as station_{d from train stations tbl where station_nane Ilke 6 Sey testy vi he database schema by clicking the View Schema | he query window on the right-hand side of the seraen, call SELECT code as Category, COUNT(*) AS products FROM product GROUP BY code [elena 4 a al uth S@7- Data Cl PACE EL Rael emi T Ty (dl Alats) @ Mercer 2 Database Query Ques... ¥ oe ow Question 1 QD Revisit tater How to Attempt? Write an SQL query to display. The last name of 29 Instructor WHO is the colle, Whose fast name ts ‘Bette and are IN the same Your output Should ©ontain 4 Column yn, the Delo, Order “Mentioned * View Schema tab A the ty 9 select o.last_name from instructor o Join department e on o.dept_id= e.dept_id where e.dept_id= (select dept_id LCMV Cece) g where last_name = 'Bette’) and o.last_name<> ‘Bette’ Order by o.last_name;

You might also like