placement questions 2013-2014
Post on 09-Oct-2015
50 Views
Preview:
DESCRIPTION
TRANSCRIPT
-
SonyIndiaSoftwareCentrePrivatelimitedWrittenExampattern???????ImpetusTechnologiesWrittenExam????
sigmoidquestionpaperQ1.Writeaprogramtoreversethewordsinastring 5points
Forexample:
Input:mynameishello
Output:helloisnamemy
Note:
WriteOnlytheFunctions&returntheoutput.
Donotwritemainorinput/outputhandlers.
Q2.Youvegotsomeoneworkingforyouforsevendaysandagoldbartopaythem.Youmustpaytheworkerfortheirworkattheendofeveryday.Ifyouareonlyallowedtomaketwobreaksinthegoldbar,howdoyoupayyourworker?(Assumingequalamountofworkisdoneduringeachdaythusrequiringequalamount(1/7goldbrick)ofpayforeachday)
5points
Q3a.Writethecodetoevaluateifagivenstringisapalindrome. 5
points
Input:abcd
Output:0
Input:aba
-
Output1
Input:a
Output1
Note:
WriteOnlytheFunctions&returntheoutput.Donotwritemainorinput/outputhandlers.
Q3b. Write the code to find the minimum number of characters to beappended to a word to make it a palindrome20 pointsExample:
Input:abba
Output:0
Input:abb
Output:1
Note:
WriteOnlytheFunctions&returntheoutput.Donotwritemainorinput/outputhandlers.
Q4.Writethecodetofindcharacterwithsecondhighestfrequencyinagivenstring 10
points
Forex:
Input:aaabbc
Output:b
Input:abcdddcaa
Output:c
Note:
-
WriteOnlytheFunctions&returntheoutput.Donotwritemainorinput/outputhandlers.
Q5.Createthedatastructureforabinarysearchtree.Writeafunctiontoevaluateifagiven
binarytreeisavalidbinarysearchtree. 20points
Note:
WriteOnlytheFunctions&returntheoutput.Donotwritemainorinput/outputhandlers.
Q6a.Functiontoevaluateamathematicalexpressionthathasonlyintegers,operators(+,*)and
numbers. 15points
Input:1*2+3
Output:6
Note:
WriteOnlytheFunctions&returntheoutput.Donotwritemainorinput/outputhandlers.
Q6b.ExtendthefunctionfromQ6toevaluateamathematicalexpressionthathasbrackets,
integers,operators(+,*)andnumbers. 20points
Input:(1+2)*3
Output:9
Note:
WriteOnlytheFunctions&returntheoutput.Donotwritemainorinput/outputhandlers.
-
HascapitaldynamicsgivenofferlettersatanyIITafterGD&interviewortheygavejustanassignment(likeatIITD)?
IITDORIITBGUYSPLZUPDATEINFORMATICAINTERVIEWQUESTIONSASAPANYIDEAABOUTRILANDITSTESTORINTERVIEW?samequestionasnitwarangal
guwahati guys30apti.questionsand60Technicalchemicalmultiplechoicequestionsin60minutes.Youwillhavetocleartheaptituderoundtobeconsideredfortheinterviewselection.
capillary questions plz??Codinground:Sudokupuzzle.Tocheckwhetheritiscorrectornot.
SaavnWritten
Guys plzz share eBay interview questions asap ???
-
ERICSSONQuestionPaperanyidea??5sectionsforeachquestion+1or1,75bits60minsenglish15reasoning15quant15technical15programing15thereisseparatepapersforECEandCSE
whattypeoftechnicalques???
MoojicQuestionPaperanyidea??Theyhavechangedtheprocess!!
NetApp,Symantecheldanywhere???????PlzupdatethequestionsAnyhpwrittentestquestions??hfORACLE
AnyupdateonTEXASINSTRUMENTSwrittentest???ItsonAnalogDesignPLEASEupdateSYOPSYSquestions.
-
VmwareInterviewfeedback?please..VMWareinterviewIITKGPAskedOSquestions1.Communicationb/wthreads2.HeapmemoryrelatedJavaques1.Annotation2.Methodoverloading3.inheritanceDatastructure:1.Commonancestorstotwogivennodesoftree2.findtop5elementsof1000element3.Queueusingstack4.mergesort5.LongestincreasingsubsequenceDynamicProgramming6.Frequencycountofallwordspresentinfile7.Zigzagtraversaloftree
QuesaboutmyprojectAnyUpdateaboutCISCOwrittentest?AnyUpdatefromiitmRegarding
WrittenTEST?pleasefciscoIITG:Easytestconductedbycocubestotalof60questionsin60min..Cutofwasaround50523sections...1.English2.mathematicalabilities3.Quant
SamsungInterviewQuestionsPleaseReplyhere
LinkedIninterviewfeedback@IITMadras
-
1.Designquestion.WhatinterestingandusefulfeaturewouldyouaddtoLinkedInwebsite,whichisnotyetpresentinthewebsite.
2.ConvertRomannumberstringtointegers.Convertdecimalintegerstoromannumberstrings.
3.Computeallmultiplesofanumber.4.Paintthehousessuchthatneighbouringhousesdonothavesamecolorpaints.Each
painthasanassociatedcost.Paintallhousessuchthatcostisminimum.5.ComputenumberofBSTsthatcanbeformedwith1tonkeys.6.Givenanarrayofintegers,computeanotherarraywhichcontainsproductofall
elementsexceptithelementfrominputarray,withoutusingdivisionoperation.7.Implementhashtables.8.Givenastreamofcharacters(streamisincreasingcharbychar),checkifnewly
formed10characterwordispresentinalreadyparsed/scannedstream.Printsuchrepeatingstreamslexicographicallyattheend.
9.Questionsonproject,internships.
GuysPleaseupdatequestionsformIITRoorkee??Pleasepleasepleaseplease..
ABCOAdvisoryBoard
90minutespenandpapertest
2codingquestions1)Nexthighernumberwithsamenumberofsetbitshttp://www.geeksforgeeks.org/nexthighernumberwithsamenumberofsetbits/2)printbinarytreefromtoptodownandbottomupmanner(Verticalzigzag).mcqs,basedonsimplemathematics,algos,os,networks.
25questions+1programmingquestion
Questiontype:12objectivetype,restofthequestionsdidn'thaveanyoptions!Hadtowritetheanswerinthespaceprovided.
-
LotsofCconceptstested."Giveoutputofprogram"typequestions.
IITKharagpur:Q1.PROGRAMMINGQUESTIONGivenanumberasastring/integerarray,writeafunctiontofindthenumberofcontiguoussubsequencesofthearraywhichrecursivelyaddupto9.
http://locklessinc.com/articles/binary_search/eg:4189=>mustreturn3asthereare3subsequences={18,189,9}Recursiveaddition:18=>1+8=>9189=>1+8+9=>18=>1+8=>99
Mainlogic:allnumberswhichrecursivelyaddupto9willbedivisibleby9.Thenfindsumofallpossiblecontiguoussequencesandcheck%9.O(n^2)Therecanbebettersolutions.ThisiswhatIcouldget.
Q2.AnelementisaLeaderifitisgreaterthanalltheelementstotherightofit.Howmanyiterationsneedtobedonetodeterminealltheleaderelementsinanarray.
Ans:O(n)
Q3.Normalcodeofbinarysearchgiven.Thiscodecausearithmeticoverflowincertaincases.Rectifythatlinewithafix.cap
Answer:Issuehappensinthisline:m=(low+high)/2
Fix:
-
m=low+(highlow)/2AlthoughnotcompletelyForknowledgereferthis:Q4.Inthefollowingsequencea,b,b,c,c,c,d,d,d,d,....Findthe288thelement.
Ans:x
Q5.A2darrayofsizenxnisgivenwiththefollowingproperty:allrowsandcolumnsareinascendingsortedorder.
Tofindagivenelementkinthearray,thisprocedureisgiven:
1. Startattoprightelement2. Forcurrentelemente
1. ife=k1. returntrue
2. ifk
-
elseif(x==0.1f)printf("ELSEIF")
elseprintf("ELSE")
}Whatistheoutputofthefollowingprogram?
Ans:ELSEIF
Q7.
intaintmain(){
intb....
}intc
Whichofthevariableshaslongestscope?Ans:a
Someotherbasicquestionsonlinkedlistsandnumberofswapsinbubblesortetc.
5questionsonSQLmoderatedifficultylevelconceptstested:Join,outerjoin,groupby
SELECT....WHEREXLIKE'%ABC%'
Note:'%NUT%'matcheswith'SCREW_NUT'i.e.%canalsotakeemptystring.
-
4questionsonpassagecomprehension.(notenglishcompreshension:D)Thegivenpassageintroducedbasicformulaeonlinearregressionandstuff.Mean,slope,interceptetc.Thentheformulaewheretobeusedtofindsolutionforsomebasicquestions.Iinitiallyskippedthissection.ButwhenIdidgettime,Icamebackandfoundthatatleast2qnsinthissectionwhereveryeasy.Justbasicmeanandadditionandstuff.Justusethegivenformulaeandsolve.Pleasedotakeyourcalculatorswithyou!:)
CompanyMcAfee:McAfee@IITB:
PenpapertestisconductedbyeLitmus.Total4sectionswith20questionsineachsection.Quant,Reasoning,VerbalandTechnical.(Veryirritatingtest).negativemarksafteryour25%wronganswerspersection.Technicaldidnothaveanynegativemarking.Technicalwassimplequestions.(23questionsaboutJAVAinheritance.)
CompanyFlexTrade:@IITBPattern???Code:1.Writeafunctionthatreturnsauniquecharacterfromanarrayofcharactersifpresent2.Writeafunctiontoreversealinkedlist
-
3.WriteafunctiontoreturnallpossiblewaysthatasequenceofpositivenumberssumstoN
DOESMorganStanleyfilteringtosecondroundbasedonround1??No,everyonehastogivebothrounds
CompanyMorganStanley2 papers: (very long)Update weight matrices based on feedback, drop a packet which seen by allusers.
Paper1:quant+DS+OS(3sections):sectionalcutoffPaper2:C/C++/Java(nocoding)
CompanyIntuit@IITM:(Somefunnygroupactivitywasconducted)Fivequestionsoncoding(penandpapertest):1)Writeaprogramtoguessanumbercorrectlybetween09999.(Theywerenotclearaboutthequestion.ThesystemreturnsjustYesorNO).Noinfoaboutthenumberbeinggreater/lesserwastold.2)Somepuzzledontremember(120wirecablepuzzle)3)Dynamicprogramming(TocountthenumberofpossiblepathsinMXNgrid)4)Toconvertanumberinwords.(123,456,67)isonehundredandtwentythreemillion,fourhundredandfiftysixthousandandsixtyseven5)Therearesomeonemillionhashtags.Uneedtoreturnthetop3hashtagswhichoccurfrequently
pleasepostthequestionsaskedandpatternofthepaper...anyIIT?????CompanyPOCKETGEMS@IITKGPthereweretwoquestionsfor50minutes.bothofthemwerebasedondynamicapproach.firstquestionwassameasgiveninthislink.
-
http://www.careercup.com/question?id=15928678
AlthoughsomequestionsofCISCOareupdatedbutcansomeoneupdateexactformatandnumberofquestionsalongwithquestionsifoneremembers?
PleasesharesomeCISCOQUESTIONSIITMGUYSCompanyCISCO:Itsanobjectivetestwith20inaptitudeand30frommicroelectronicsandbasicCSEnosubjectivecodingquestions
Wasthebelowpatternsameforeverybranch(CSEandElectronicsboth)?Yes
Ifsomeoneremembersexactquestions,pleaseupdate.ButasfarasIremember,thereweretwoaptitudequestionsonaverages,threeonordering(AcancomebeforeB),oneheightsanddistances(pythagorean)onedirections,
If423ismultipliedbyxandansweris45569,and55arewrongdigits,findtherightproduct.Answerplease?????????35
Whatisanumberthatleavesremainder3whendividedby5,6,7,8but0whendividedby91683
Q.agoatistiedtoacornerofusquare,with7mrope.findtheareaofgrazing?Someonepleaseupdatetechpart.
-
addressofRST6in8085
noofbinarytreespossiblewithnnodes?catalanno
whyisAvalanchediodepreferredtoPIndiodelOnequestiononflipflopminimumnumberofNANDgatesrequiredinY=A+AB+ABCIsit2??????????
Q:WhatisZenerdiode?
CompanyCapitalDynamics@IITKGP:(1)whethertwostringsareanagramofeachotherornotirrespectiveofanythingyoudo,surely1testcasewillfailgodknowswhy:P(whatiftwostringsaresame?(2)oudo,surely1testcasewillfailagaingodknowswhy:Phowmanytotal1saretherefrom0ton(nwillbeinput).e.g.outputwillbe6forn=13(1,10,11,12,13sototalsix1sarethere)herealsoirrespectiveofy.(3)exactlysameasthebelowlink:http://www.geeksforgeeks.org/findthesmallestpositivenumbermissingfromanunsortedarray/Inputarrayforques(3)willbeoftypecharWerethereonly3questionsandwhatwasthepatternanddurationofthetest?
CompanyLinkedin@IITKgp:Time:2hrs.@6am:10/11/13(6AM?Really?Yes:))
1)Therearen(frominput)stepsandgivenanotherinputxi.e.youcanclimb1,2,3.xstepsatatime.Howmanyofwayscanyoureachthetopstair.Forexample,givenn=3,x=4youcango1,1,1or1,2or2,1or0,3etc.So,itsshouldbe4.//AnswersStarelationndardRecurrenceF(n,x)=F(n1,x)+F(n2,x)........................+F(nx,x)
-
.DynamicProg.isapplicableCheckboundaryconditioncarefully.
2)Givenaundirectedgraph,findthediameterofthegraph.(Peoplemessedupwithinput!)http://people.hofstra.edu/geotrans/eng/methods/diameter.htmlDiameter:pathbetween2nodeshavingmaximumlength.`````Thediameter ofagraphisthemaximumeccentricityofanyvertexinthegraph.Thatis, itis
thegreatestdistancebetweenanypairofverticesor,alternatively, .Tofindthediameterofagraph,firstfindtheshortestpathbetweeneachpairofvertices.Thegreatestlengthamongallthesepathsisthediameterofthegraph.
ItsaO(V^3)solution.Doesthequestionsaidthatitwasageneralundirectedgraphorageneraltree??????
Pleasementioninputsizeconstraintsandwhatwastheinputformat??createallnonoverlappingintervalswithrangeandvaluefield3)Givenarangeansdasignature4bitintegerlikethis[21,30,1101b].Here,therangeis[21,30]andthefourbitintegeris13(1101b).Now,Givenarangeandasignature4bitintegerlikethis[1,10,4]and[2,5,3]=[1,2,4],[2,5,4bitwiseor3],[5,10,3].Soon..!(kindlyexplainwhatweneedtocodeandresult?,seemsquestionisnotcomplete)
-
1,65,98,11
forabovequestionyouhadto.OverlappingintervalscanbeobtainedfromtakingbitwiseORoperationofoverlappingsequences.hopeitexplainsthisquestionIguessinitiallyyouhadtoaoofintervalsasinputthenthensequentiallyreadneweachintervalinanewline
Whatisthesignificanceofsignatureifitwasjustaboutfindingnonoverlappingintervals?Whyfindingoverlappedsignature?
forparticularintervalinputwillbeinthisformat1610(Allvalueswillbeindecimal,firsttwofieldsindicateRangeand3rdfieldindicatessequenceorvalue)Anyonehassolutionofthis??????(Solution:sortallendpointsofintervalandprintconsecutivepointsasnewnonoverlappingintervalswithcomputedsignificance)IITDelhi,Madras:sameasabove
@IITK3codingquestionsInterviewstreetplatform2hours
Question1GivenNfindthenumberoftriplets(a,b,c)ofintegerssuchthata^2+b^2+c^2=NN
-
Giventwocontainershavingnandmgallonsinitiallyfindtheminimumnumberofstepsrequiredtocorrectlymeasurelgallons.
Onlyallowedoperations:emptyacontainerfillacontainercompletelytransfercontentsofoneintoothercompletelyortilltheother
containerfillsup.outputminimumnumberofstepstogetlgallons.output1ifcan'tbedone.Ans:usebfs
Question3GivenN2dimensionalrectanglesintheformofoppositecornersfindthetotal
areacoveredbytherectangles.Sidesofrectanglesareparalleltotheaxes.Morethan2rectanglescanoverlap
eachother.Theycanalsooverlapcompletely.
Companyinmobi@IITD:
Therewereabout20MCQs(30minutes)tobedoneafterthecodingsection.MCQsweretotallynonsense.Canbedonein10mins.
Forcodingsection60mins.
1.Inalinewherewordsareseparatedbyspaces,,andcapitalizefirstletterofthereversedword.Otherlettersofthewordshouldbeinsmall.Input:howareyou?Output:WohEra?uoy
2.Thesecondquestionreducedtofindingmaximumweightmatchinginabipartitegraph.Notmanypeoplewouldhavedonethis(maybenone).
3.Thereare2setsofcountries.Onesetwilldonateclothes(somethingofthissort)andanother
-
setwillacceptclothes.Acountrycanbeinonly1ofthesets.Theamountofclothesdonatedisalsogiven.Theproblemistomaximizethisamountofclothes.Condition:OnetoOnerelationshipmustbetherebetweencountriesindifferentsets.TestCasesarelikethis:{4,4,5,{1,3,7},{1,2,6},{2,1,5},{3,4,6},{4,2,4}}{r1,r2,tc,{c1,c2,a},....}r1=no.ofcountriesinset1r2=no.ofcountriesinset2tc=no.oftestcasesfollowedbythatno.oftestcases{c1,c2,a}=c1countryisgivingaamountofclothestoc2country.Maximizethetotalamountdonated,followingtheconditionthatonecountrycandonatetoonlyonecountryandonecountrycanacceptfromonlyonecountry.
IITRCodingQuestions
1.SameasinIITD2.0/1KnapsackProblem.Weightwasreplacedbytime.
CompanyGoldmanSachs@IITK
SolutionspleaseGoldmansachwrittenconductedatIITKanpuron6nov2013Therewas2testoneismultiplechoiceobjectiveof75minandotherissubjectiveof90minTherearesomequestionsTest1:thereare25questionssomeofthemare
-
whichofthesearenotthedegree3sequenceofasimplegraph(solvebyHavellHakimi)
ifprobofoccurringheadispthenfindtheprobthathhhhcomesbeforethhh ans(p^4B)from
https://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CC4QFjAA&url=http%3A%2F%2Fwww.math.wisc.edu%2F~kiselev%2FHW04sol.doc&ei=Hwx_UqHVEM2prAf2yIDABA&usg=AFQjCNHMocAZgNWwKInvWxM0b5itlAn7A&sig2=5uaxXgXvueGdhPzQPFKTA&bvm=bv.56146854,d.bmk&cad=rja
asquareofunitlengthhascenterat0,0andedgeparalleltoaxisfindtheexpectedvaluemax(X,Y)herex,yisapointinthesquare
asquareofunitlengthhascenterat0,0andedgeparalleltoaxisfindtheexpectedvaluemax(X,Y)herex,yisapointinthesquare
solution:XandYareindependentanddistributeduniformlyin[a,b],thenexpectationofmax(X,Y)=E[max(X,Y)]=(2*b^2a*ba^2)/(3(ba))inourproblma=1/2andb=1/2soaftercalculatingwegetE[max(X,Y)=1/6
ALTERNATESOLUTIONfor{(x,y)|x
-
Anshttp://math.stackexchange.com/questions/43696/howtofindtheballs Sarahas6flowerpots,eachhavingauniqueflower.Potsarearrangedinarow.
Sararearrangethesequenceeachdaybutnottwopotsshouldbearrangedadjacenttoeachotherwhichwerealreadyadjacenttoeachotherinpreviousarrangements.Howmanydaysshecandothisorhowmanysucharrangementsispossible?ans3B|
Anshttp://math.stackexchange.com/questions/560726/flowerpotpuzzle
Inoneislandthereare3colorsofchameleon,10blue,15greenand14red(ithinkthesearethenumbers).whentwodifferentcolorschameleonmeettogether,theyconvertintothethirdcolor.minimumno.ofmeetingrequiredtoconvertallchameleonintosamecolor?ans14B|http://gurmeet.net/puzzles/chameleons/
Ithinkitisnotpossiblebecauseanystepchangesthedifferencebetweenthenumberofchameleonsofanypairofcolorsby3or0.sincenoneofthesedifferencesareinitiallyamultipleof3thereforenosequenceofmeetingscanleadtoaconditionwhereallchameleonshavethesamecolor.cebetweenthenumberofchameleonsofanypairofcolorsby3or0.sincenoneofthesedifferencesareinitiallyamultipleof3thereforenosequenceofmeetingscanleadtoaconditionwhereallchameleonshavethesamecoCorrectmeifimwrong.
whatswronginthisfirst10meetingbetweenblueandredwillgive25green(35greenandnot25)and4red.then2redand2greenwillmeettogive2blue.thenfinally2redand2bluewillgive25green.14meetings
Themistakehereisthat2redand2greenwillgive4bluenot2blueandfirstiterationwillgive35greennot25.
solution:reference:http://tierneylab.blogs.nytimes.com/2009/09/21/mondaypuzzledarwinsspiritrestoresparity/
-
1.Letussaythatthenumberofred,greenandblueeggsarer,bandg.Thesenumberscanbeevenorodd.Sincetherearethreeofthemtwomusthavethesameparity,thatis,atleastwehaveapairofoddnumbersorapairofevennumbers.Theaverageoftwooddortwoevennumbersisawholenumber.2.Denotethenumberofred,blueandgreenchameleonsr,bandgrespectively.Thecriteriontoknowiftheagivensetofchameleonscanallchangetoonecoloristhefollowing:agiventerrariumcannotbeunicoloredifr+b+gisamultipleof3,andr+2bisnotdivisibleby3.Statedasthisitseemsasymmetricalinr,gandb,butinfactisnot(simplearithmetic).1414Inthefollowingwedenotetheremainderofthedivisionby3likethisa=b(3)meansthattheremainderofthedivisonofaby3isb.Forexample,5=2(3),meansthattheremainderofthedivisionof5by3is2.Tounderstandwhythecriterionistrue,wehavetoconsiderseveralcases.Sincetheremainderofthedivisionofanynumberby3canbe0,1or2,weanalyzeonecaseatatime.Onecrucialobservationis:theremainderofthedivisionofr+2bby3isnotchangedaftermeetingsbetweenchameleons.Thisissoforthefollowingreason:denotethepossiblemeetingby(rb),(rg)and(bg).Then:after(rb):(r,b,g)>(r1,b1,g+2),thenr+2b>r1+2b2=r+2b3=r+2b(3)after(rg):(r,b,g)>(r1,b+2,g1),thenr+2b>r1+2b+4=r+2b+3=r+2b(3)after(bg):(r,b,g)>(r+2,b1,g1),thenr+2b>r+2+2b2=r+2b=r+2b(3)Thereforetheremainderafterdivisionby3(whichwewillcallittrinityforobviousreasons)isinvariant.Now,letusseecasebycase.Eachcaseinr+2b=a(3),a=0,1,2,hastobesplitinsubcasesfortheremaindersofthesumr+b+g.Forexample,forthecaser+2b=1(3)wehavetostudyr+b+g=0,1,2(3).Thiscoversallpossibilities.a)r+2b=0(3).Inthiscaseunicoloringmayhappen.Toseehow,supposer(0,br,g+2r).Nowwedothefollowingtango:ablueandagreenchameleonmeet,thenwehavetwomeetingsbetweenredandbluechameleons,whichimpliesthat:(0,br,g+2r)>(2,br1,g+2r1)>(0,br3,g+2r+3).Wecanrepeatntimesuntilbr3n=0,leaving(0,0,r+b+g)(recallthatbrisdivisibleby3).So,unicoloringmayhappen.
-
b)r+2b=1(3)b1)r+b+g=0(3)Ifwemanagetounicolorthechameleons,thenwemusthave(r,b,g)>(n,0,0)or(0,n,0)or(0,0,n),andeachcasehasr+2b=0(3),whichisacontradiction,sincethetrinityisinvariantandinitiallyitwas1.Sounicoloringcannothappen.b2)r+b+g=1(3)Sincer+2b=1(3)andr+b+g=1(3)wehaver+2bb+g=1(3)>gb=0(3).Butaccordingtoa),unicoloringmayhappen.(thisisso,becausegb=0(3)impliesb+2g=0(3),whichisthesameascasea)).b3)r+b+g=2(3)Inthiscaser+b+g+r+2b=1+2(3)>g+2r=0(3).Again,bycasea),unicoloringmayhappen.c)r+2b=2(3)c1)r+b+g=0(3)Bythesameargumentinb1),unicoloringisnotpossible.c2)r+b+g=1(3)Thenr+2b+r+b+g=2+1(3)>g+2r=0(3),andbya)unicoloringmayhappen.c3)r+b+g=2(3)Thenr+2b+r+b+g=2+2(3)>g+2r=0(3),andbya)unicoloringmayhappen.Conclusion:toavoidunicoloringweneedtohaver+b+g=0(3)andr+2b=1or2(3).
whatistheminimumno.ofcomparisonsrequiredtofindthesecondlargestno.inanarrayofsizeN
(N+ceil(logN)2)(repeated???))answer(http://stackoverflow.com/questions/3628718/findthe2ndlargestele
mentinanarraywithminimumofcomparisom)
test2:SubjectiveQuestions
1.Ifanetworkhasamaximumpacketdatasizeof128bytes,amaximumpackettimetoliveof30secondsandan8bitsequencenumber,whatisthemaximumdatarateperconnectionforthisnetwork?
-
2.designanalgotofindtheno.ofancestorsofagivennodewithi)O(m)memory,ii)unlimitedmemorysize.whatismhere?isitthenumberofnodes?
3.inanundirectedgraph2peopleplayagamethatifonechoseanyvertexthensecondmustchooseitsadjacentvertexprovethat2willwinonlyifthereisperfectmatchingotherwise1winsalways.
Solution:3.1.18westbooksolutionmanualforgraphtheory
4.Proveordisprovethatthenoofedgesineulerianbipartitegrapharealwayseven.solution:
http://answers.yahoo.com/question/index?qid=20130227220918AAoWQvp
Everyvertexhasevendegree.Wecancounttheedgesbysummingthedegreesoftheverticesinonepartitesetthiscountseveryedgeexactlyonce.Sincethesummandsarealleven,thetotalisalsoeven.
5.inbinarynowecanfindthattheno.isevenoroddonlybycheckingits1stdigitisitcanbedonewithotherbaseandwhy?solution:disproveasfor(10)inbase3=3.Herefirstdigit0isevenbutthenumberisodd.
IITBombayandIITKGPandIITGuwahatiandIITDelhiObjective75mins
-
1.Whatistheminimumnumberofcomparisonsneededtofindthemaximumandtheminimumnumbersfromanarrayof100numbers?ans:148
2.Findthetotalnumberofsolutionsofequationxyz=72.ans:6072=2^3*3^2soans=5C3*4C3(Wrong)
Plscheckthisanswer72=2^3*3^2Nowif
x=2^x1.3^x2y=2^y1.3^y2z=2^z1.3^z2xyz=2^{x1+y1+z1}.3^{x2+y2+z2}Numberofpositiveintegralsolnsofx1+y1+z1=3is(3+31)C3=10Numberofpositiveintegralsolnsofx2+y2+z2=2is(3+21)C2=6
Thereforetotalnumberofpositiveintegralsolnsis10*6=60.Nowconsideringthenegativeintegralsolns.Finalanswerispositiveforthefollowingfoursigncombinationsofx,yandz{+++,+,+,+}Overallnumberofintegralsolutionsis4*60=240.
3.Findthetotalnumberofsolutionsofequationxyz=510510wherex2y+y2z+z2x=xy2
+yz2+zx2Answer:3
510510=2x3x5x7x11x13x17x2y+y2z+z2x=xy2+yz2+zx2
soonfactorization(xy)(yz)(zx)=0,twooutofthreemustbeequal,noneofprimefactorishavingpowertwo.Soonlysolutionwillbe(1,1,510510)andpermutations.
-
4.Aphotonstartsmovinginrandomdirectionfromthecentreofsquareofsize3.LetssayitfirstcolloidstotheglasswallAB.WhatistheexpecteddistancetravelledbyphotonbeforehittingthewallABagain?Answer68(not100%sure)
5.Ifadiceisthrowntillthesumofthenumberappearingontopfaceofdiceexceedsorequalto100.Whatisthemostlikelysum?Ans:100
6.OnequestionwasrelatedtogrammarE>T+E|TE|TT>F*T|F/T|FF>aSomethinglikethis.Andafewstatementsweregivenlike1.Thegrammarisambiguous2.Thegrammarisleftassociative3.Rightassociative4.*and/getprecedenceover+and....blablablah.Anditwasaskedtofindwhichofthestatementsarecorrect.1,2and3,Only1and2,Only2and3,...somethinglikethat.
7)Timecomplexityofinversionoperationans:O(NlonN)
8)Eggdroppuzzle100floors2eggs.minimumnumberoffloorsans:14
9)Thevalueofrforwhichareaoftrianglewithtwotangentsandchordofcontactismaximum.circle(x1)^2+(y2)^2=r^2.Tangentsaredrawnfrom(7,10)ans:Sqrt(50)
10) .Findthevalueofa.limn
1 +2 +...+na a a (n+1) [(na+1)+(na+2)...+(na+n)] a1 =
160
answer:a=17/2dividenumeratoranddenominatorby1/n^(a+1)andcauchytheorem
-
11)A3x3matrixMisgivenwhereM[i,j]=1ifthereisadirectflightfromairportitoairportj0otherwise.If1,0,1areeigenvaluesofthismatrixandM[2,3]=1,findthenumberofwaysinwhichairport2canbeconnectedtoaiport3in3hops.
12)Findval1(78).
intval1(intn){
if(n==0)return0if(n==1)return1return2+6*val2(n1)+val1(n2)
}intval2(intn){
if(n==0)return0if(n==1)return1returnval2(n2)+4*n
}ans:78^3
13.primalityofn^4+4^n,forn>=2.answer:compositen=even,composite(obvious)n:oddn^4+4^n=n^4+4^n+2.2^n.n^22^(n+1).n^2(thistermisperfectsquare)use(a+b)^2c^2=(a+b+c)(a+bc)socomposite.F14.Determiningwhetherx^y+y^xis>=or
-
15Anumberisstoredinitsbinaryforminalinkedlistinreverseorder.Forexample,if4or(100)2isstoredas0>0>1.Findthetimecomplexityofupdatingthevariablexstoredasabovedatastructureifitisupdatedtofloorof(x/8)intermsofn,wherenisthesizeofthelinkedlist.
Subjective90mins,butthequestionsweresodifficultthatjuntafrommyhallstartedleavinginjust5mins
1.a)TwosetsX={x1,x2,...xn}andY={y1,y2,...yn}suchthatx1
n
i=1i zi 2
b)Asacorollary,forasequenceofpositivenumbers{ak},provethat
>=n
i=1
akk2
n
i=1
1k
2.BettingontheWorldSeries.Youareabrokeryourjobistoaccommodateyourclientswisheswithoutplacinganyofyourpersonalcapitalatrisk.Yourclientwishestoplaceaneven$1,000betontheoutcomeoftheWorldSeries,whichisabaseballcontestdecidedinfavorofwhicheveroftwoteamsrstwins4games.Thatis,theclientdepositshis$1,000withyouinadvanceoftheseries.Attheendoftheserieshemustreceivefromyoueither$2,000ifhisteamwins,ornothingifhisteamloses.Nomarketexistsforbetsontheentireworldseries.However,youcanplaceevenbets,inanyamount,oneachgameindividually.Whatisyourstrategyforplacingbetsontheindividualgamesinordertoachievethecumulativeresultdemandedbyyourclient?Ans:
-
3.ProveordisprovethatEuleriansimplegraphwithevenverticescontainsevennumberofedges.Answer:Nottrue(thereisacounterexample)
-
4.Twothreadst1andt2printcan2and4respectively.Writethecodefort1,t2usingstandardlockingmechanismsuchthatfollowingserieswillbeprinted:422442244.5.GCDofithtojthelementsofarray.TherewillbeO(n)numberofsuchqueries.6.Npointsarerandomlyandindependentlymarkedonaunitcircle.Thecircleiscutatthepoints.Findtheexpectedlengthofthearccontainingthepoint(1,0).(answer=2*Pi/N)(Idoubtthisanswerisincorrect)(Thisiscorrect:P)(noitsnot)*ifyouassumethateachcutpoint,xi~U(0,2pi)oncircumference,theansweris4pi/n+1*ifyouusesymmetry,sayingdoesntmatterwhichpointwechooseforthearc,its2pi/n(incorrect,youneedmoreinsightofrandomvariables:P)http://www.math.northwestern.edu/~mlerma/problem_solving/putnam/trainingprobability
*4pi/n+1iscorrectExplanation:ThinkproblemasN+1randompoint(include1,0),becauseifyoufixonepointandtakeNrandompoint,isequivalenttotakeN+1randompoint(becausethereisnosenseofabsolutedistance).Nowarccontaining1,0willbeformedfromtwoadjacentarchavingmeanlength2pi/n+1(allthearcshavingequalmeanof2pi/n+1).someanlength=2pi/n+1+2pi/n+1=4pi/n+1...
7.Inaclassof9students,eachstudentsendsagiftto3otherstudents.Isitpossiblethatallthestudentsgetgiftbackfromeachstudenttowhomtheysentthegift.Answer:Nohttp://cse.iitkgp.ac.in/~agupta/graph/SolH1.pdf14Problem7
8.Thereare4resourcesofthesametypeandtherearethreeprocesseseachofwhichneedatmosttworesourcestocomplete.Isthisadeadlocksituation?Why/Whynot?ans:Deadlockfree
9.Thereare2threads.Oneprints4andanotherprints2.Giveasynchronizationmechanismsuchthatthefollowingisprinted.42244224
-
10.Youaregivenanarrayofnumbers.Youhavetofindthegcdofarangeofnumbersinthearray.Youwillbegiventhestartandendindexiandjbetweenwhichthegcdidtobefound.Ans.UsesegmenttreeSimilartohttp://www.geeksforgeeks.org/segmenttreeset1sumofgivenrange/
IITG:Paper1:75mins.MCQ.onlyoneanswercorrectPaper2:90mins.Subjective
Subjectivequestions.1.SomeAcquireLockquestion.Dontremember.2.9students.Eachstudentsendscardsto3otherstudents.Willeachstudentrecievecardsfromteh3studentshehasgivencards?why?3.forEuleriangraphProveordisprove:thatifverticesareeventhentherewillbeevennumberofedges.4.Fourresources.3processes.Aprocesscantakeatmosttworesources.willtherebeadeadlock?Why?5.SomeMatrixquestion.Dontremember.someoneupdateifheremembersthequestion.6.classa{
public:
~a(){
printf("destroy")}
}vectorv1=newvectorvector*v2=newvector
-
Whosedestructorfunctionwillbecalled?(a)v1(b)v2(c)v1andv2.(d)none
7.ThereisshortestpathbetweenAandB.LetitbeP.NowalinkisbrokenbetweenAandBalongthisshortestpathP.letthepointofbreakingbeuandv.Now2optionsexist:(a)TofollowthepathPuptouandthenfollowanothershortestpathtov.andthencontinuetheshorterpathP.LetthetimerequiredforthisbeT1.(b)TofindanewshortestpathbetweenAandBandnotusingpathP.LetthetimerequiredforthisbeT2.
Proveordisprove:T1=summation_of(XiZi)^2
9.Printtehsequence:4,4,2,4,4,2,2,4....withthehelpofpropersynchronizationbetweentwothreadst1andt2.
10.voidprintarray(inta[],intsize){
if(size==0){
//dontprintanything}elseif(size==1)
{//printoneelement
}
-
else{
//printalltenelementsofarray}
}
andcorrespondingassemblycodewasgiven.(Youcantusegreaterthanoperatorforcomparisonbecausesuchanoperaorwasnotgiveninassemblycode.onlycomparefunctionwasgiven.).Whatistehprobleminabovecodewithrespecttopipelinignwhenitisgiventhatmostoftheinstrudctionhaveasizegreaterthanone.Writesuchacodeandwritethecorrespondingassemblycode.
8.ThereisavariableiwhichismadebyclassA.Makevariableinsuchawaythatitisallocatedonheap.Makeafunctionforintilizationandtrasnferringofownership.whenthebariableisdeletedanexplicitfunctionshouldbeamdeforthat.9.Asquare(madeofmirror)givenofsidelength:3cm.AphotonhitapointAbystartingfromthecenterofthesquare.whatisexpecteddistanceitcoversbeforehittingatpointAagain.(a)[2,4)(b)(4,6],
10.Acircleofradiusoneisgiven.Nchordsaremadeincircle.findexpectedlengthofchordofcirclecontainingpoint(1,0).
11.gcd(a,b,c)=gcd(a,gcd(b,c))gcd(a)=aAnarraycontainingnelementswithkbitofeachnumber.givenarrayis[a1,a2,...an].q(=O(n))queriescomewhichspecifyiandjforwhichwehavetotakeoutgcdof[ai,a(i+1),....aj].Makeanalgorithmtoanalyseruntimecomplexityandmemoryrequired.
-
CompanyAdobe:
http://www.iitplacementpapers.com/2012/09/blogpost.html
IITDelhi:(samepapergotrepeated)IITRoorkee:SameasaboveIITGuwahati:SameasIITDelhi.(timelimit2hrs)IITMadras:SamePaperIITKanpur:SamePaper
CompanyAmazon@IITG:AmazoncodingquestionsatIITGuwahati
AmazonMCQs1)Huffmancodefora,b,c,d,e2)Initially5numbersstoredinmaxheap.levelordergiven.2newnumberinserted.findnewlevelorder.3)IfP(a)=1,P(b)=1/2andP(c)=1/3anda,b,careindependent,findP(a/b)P(b/c)P(c/a).thisquestionwasrepeated.4)3menplayingagamewithcoin,whoevergetsfirstheadwins.findtheprobabilityofwinningof3rdguy.5)onecodewasthereontree.Itwasfindingtheheightoftree.6)2questionsonrecursion.cvf7)11playersteam.ageofcaptain=26andwicketkeeper=29given.avgageofteam=avgageofteamwithoutcaptainandwicketkeeper+1,findtheavgageofteam8)Arrangingtimecomplexities.9)ininsertionsortifweusebinarysearchinsteadofinternalloop,whatwouldbethetimecomplexity.PleaseWriteanswerifsomebodyknowaboutitComplexitywontimprovebecausestillnswapswillberequired.Explanation:
-
Canwebringdownthecomplexityofinsertionsortto(NlogN)?Observethatthecardsinlefthandarealwayssorted.Can'tweusebinarysearchtoefficientlylocatefinalpositionofcurrentinsertingcardinO(logN)time?Perfectly,yes.But,weca*n'tbringdownthecomplexitytoO(NlogN).Becauseofthefact,evenafterfindingfinalpositionofcurrentinsertingcard,weneedtomovedownthosecardsthatarebiggerthanpresentcardtoonesteppasttheircurrentposition,inordertomakeroomforpresentinsertingcard.
CompanyAmazon@IITKCodingquestions1)Checkifgiventwostringsareanagrams(ignorespacesanddontconsidercasesensitivecases)2)givenarrayofstsesensitivecases)2)givenarrayofstringsofdatesindd/mm/yyyyform,writeaprogramtosortthemringsofdatesindd/mm/yyyyform,writeaprogramtosortthem
Onlythealgowasrequiredorcodewasalsoasked??Alsotheinputwasa2Dcharacterarrayorwasitarrayofstrings(Itwasarrayofstrings.).Thesearecodingquestionsandimplementationisrequired
CompanyAmazon@IITD:Marking+1/0.251.oneProbabity,onereasoning,onejava,onenetworkquestionsubnetmaskquestion.2.TOCquestion(a+b*)and(a+b)*samelanguageorsubset.1)findinaarraydifferentnumberofpairswithdifferencek.Arrayhasuniqueelements.2)Secondquestionswassameashttp://www.geeksforgeeks.org/forums/topic/directicodinground2/onlystorywaschanged,testcasesweresame.
IITMadras:,sameinIIfTRoorkee
ForMCQsgothroughlast5yearsGATEpaperscoding:1.Listalltherepeatedcharacterslexicographicallyinastring(ifa&Aarethere,thatalso
-
countsasarepetition.2.printthe90degreerotationofamatrix.
IITGuwahati:Findtheminimumdistancebetween2numbers.http://www.geeksforgeeks.org/findtheminimumdistancebetweentwonumbers/Sumof3linkedlists.fortwolistucansee.http://www.geeksforgeeks.org/addtwonumbersrepresentedbylinkedlists/
IITBombay20MCQs:aptitude,datastructures,os,C1Coinchangeproblem:Givenasumanddenominationsofcoins,findminimumnumberofcoinsrequiredtomakethesum.2.Findanagrampairsinanarrayofstrings.Checkshouldbecaseinsensitive.
IITHyd:1.Firstnonrepetitivecharacterinstring.2.Nexthighernumberwithsamedigits.http://stackoverflow.com/questions/2553522/interviewquestioncheckifonestringisarotationofotherstring
IITKgp
90mintest
20MCQs.Basics,coveredevrythngfromOS,DBMS,Netwoking,C,OOP&DS.
2codes:1.Leftviewofbinarytreehttp://www.geeksforgeeks.org/printleftviewbinarytree/
2.Givennpoints,find3nearestpointsfromeachInput:
-
n(noofpoints)thennlineseachcontainingid,x,y
Output:nlineseachcontainingidof3nearestpoints
(Theoutputforthesampletestcasewaswrong,andsonooconesanswermatched.ComplainedaboutitLetsc:))
TheAmazonguysaidtheywouldcheckthesolutionmanually.
CodingroundAmazon:
Givenasquarematrixofsizencontainingpositiveintegers.Findthegreatestsubmatrix(squareorotherwise)whichissortedbothrowwiseandcolumnwiseinincreasingorder.Amatrixissortedrowwise,ifalltheelementsinanyrowaresortedinincreasingorder.Andsimilarly,amatrixissortedcolumnwise,ifalltheelementsinanycolumnaresortedinincreasingorder.Greatestsubmatrixisdefinedasthesubmatrixcontainingthemaximumnumberofelements.
eg
2538314684367951364226431
-
hasthegreatestsubmatrixas
14683679
CompanyCisco@IITB:
IITB09Nov20Apti+30TechnicalMCQs(1hr)QuestionsonDigitalLogic,1quesonZenerdiode1Questiononnetworking,1Questiononnptransistor
Youhavefourballstworedandtwowhitewhichyouneedtokeepintotwoboxes.Outofthesetwoboxes,yourwifewillrandomlypick(oneboxandthen)oneball.Ifshepicksaredball,youwinaprize.Withbestpossiblestrategy,whatistheprobabilitywithwhichyouwillwintheprize?ans5/6(Pleaseexplain,Iamgetting4/6)
Twostraightforwardquestionsonvenndiagram.Acylinderofheight105cmhasacircumferenceof20cm.Astringmakesexactly7completeturnsroundthecylinderwhileitstwoendstouchthecylinderstopandbottom.Howlongisthestring?
Q.Whichofthetopologyhavetodowithmultipleconnectednodeswithasinglephysicalline?a.starb.bus
@nitw::sameasabove+following...
resetlowerbitusing8085instructionAnsANI0F///itsawz[///fvtnif0refer8085instructionsimpledigitalquestions(referKmaps)23questions
-
prefix/postfixSimplein8085ALEsignalistothedemultiplexeaddressanddata.45questions1simpledbmsquerytimedivisionmultiplexing/carriersignal/nyquestrate56questionsfromdisareaAcomputersystemhas6tapedrives,withnprocesscompetingforthem.Eachprocessmayneedthreet.Themaximumvalueofnforwhichthesystemisguaranteedtobedeadlockfreeis
A.1B.2(ANS)C.3D.4
englishreading+simpleApt.
ISTHEREANEGATIVEMARKINGINTHEPAPER?>NOpostsomequestionswhichuremember.plzsharesomequestionsortopicsfrommemoryandplzsharesomequestionofcandds.
CompanyCitrix@IITM:
1.Findanumberoccurringmorethann/2timesinagivensequenceinlineartimeandconstantspace.
-
2.Coinchangeproblem.Findminimumnumberofcoinsneededtoformasumofngivenmrepeatablecoins.
IITB21stoct...
MCQ:1.mostlyfromComputernetworks,OperatingSystemandOOPs(C++).3programmingquestions1.goldbach'sconjecture2.stringrotationhttp://stackoverflow.com/questions/2553522/interviewquestioncheckifonestringisarotationofotrstring
3.Givenpreandinordertraversalprintpostordertraversalofthebinarytree.Alsoreporterrorifforagivencombination(preorder,inorder),atreecannotbeformed.
P1Goldbachsconjecturestatesthateveryevenintegergreaterthan2canbeexpressedasthesumoftwoprimes.GivenanN(2
-
P2Onecanconstructauniquebinarytree,giventaskittooutputthepostordertraversalforthetree,givenpreorderandinordertraversalforthattree.Input:Eachinputtestcasewillconsistsof3lines.firstlinegivesthenumberofnodesinthetree.secondlinegivesitspreordertraversalwitheachnodeseperatedbyawhitespace.thirdlinegivesitsinordertraversalwitheachnodeseparatedbyawhitespace.OutputForeachinputtestcase,outputshouldcontainasinglelinewhichisthepostordertraversalfortreewitheachnodeseparatedbyasinglewhitespace.Ifnobinarytreecanbeformedwithgiveninput,thenprint"NO"withoutthequotes.
P3GiventwostringsS1&S2,S2isrotatedversionofS1,ifS2canbegoS1withoutchatbytakingthelastncharactersofS1andattachingittobeginningofngingcharacterorder.(S1isrotatedbyntogetS2.)Notethatcomparisonmustbecasesensitive.
Forexample:
TRIXCIisrotationofCITRIXby4characters(m=4)andIXCITRisrotationofCITRIXby2characters(m=2).Input:EachlineconsistsoftwostringsS1andS2seperatedbyasinglespace.S1andS2consistonlyofazAZ.Eachstringcanbeupto10,000characterslong.
Output:ifS2isrotatedversionofS1.ThenoutputthevaluenbywhichS2isrotated,IfS2isnotarotationofS1,thenoutput1.FmiConstraintsEachinputtestcasewillcontainTlinesofinputwhereeachlinecontains2stringS1andS2separatedbyspace.
- 1
-
Itwasapenandpaperwrittentest,time75min
34sectionsofmcqquestionswith6/7questionsineachsection(vemarkingisthere):sectionswere:Algo(fromgate),Aptitude(oneabout5couplehandshakeproblem),SQL(oneaboutcascadingdelete),SQLinjectionandafewwebtechnologyrelatedquestion
Twocodingquestions:1.onewasaboutpruningthelargestBSTsegmentexpandingfromtherootofgivenbinarytree.
forexample:f1/\23
heretheanswerwouldbe
1\3ITSNOTFINDINGLARGESTBSTSUBTREEINABINARYTREE
2.Twotimesweregiven
intnoOfClicks(char*clockTime,char*currentTime)inHH:MMformat.Therearetwobuttonstomatchtheclocktimewithcurrenttime.Onetoincreasehoursandanothertoincreaseminutes.
-
HHcountisfrom0023andagaingoesto00ifitisincreasedfrom23.sameisforminutes0059.minutebuttonisworkingfinebuthourbuttonisfaulty.Whenyoupresshourbutton,itincreasesbothhourandminuteby1.Youneedtocountandreturntheminimumnoofbuttonpresstomatchtheclocktimewithcurrenttime.Ex:clocktime03:12currtime04:15noofclicks:3whenhrbuttonispressed,04:13minutebuttonpressedtwice,04:15
CompanyChronous@IITKGP
sameasDelhi4sections:Algo/DS,quant,DBMS/SQL,programmingcodingquestionswerediff1:Youaregivenanarraynxnwithwhiteandblackpixels.Findthelargestsubsquarehavingblackpixelsonitsboundaries.2:Youaregivendictionarycontainingmillionwords.Formasquarematrixofletterssuchthateachrowandcolumnformsawordavailableindictionary.Writeanalgorithmtoobtainlargestsizeofsuchmatrix.
Chronus@IITMCoding:Giventwowords,saysource,target.Alsogivenadictionaryofwords.Findminimumpossibletransformations(insert/delete/replace)ofsourcetotargetsuchthateachtransformationformsavalidwordindictionary.Printallthewordsduringtransformationfromsourcetotarget.foreg.cattobed.cat>bat>bet>bed.
-
PLEASEPOSTTHECODINGQUESTIONS@IITKGP
CompanyDirectiIITDelhi:
Question1YouweregivenaBinaryTree(notnecessarilyaBinarySearchTree)toplaywith,sayT.ThadsomespecialpropertiesEachinternalnodeinThadexactly2childrenEachinternalnodeinTwasrepresentedbyanuppercaseEnglishalphabet(AZ).EachleafnodeinTwasrepresentedbyalowercaseEnglishalphabet(az)YouweretoldrememberTaslongasyoucould.Hence,youmemorisedthestringformedbytraversingTinpostorder.Youusedsomethingsimilartothepseudocodebelow
toPostOrderString(node)ifnodeisleafreturnnode.valueelseT=""T=T+toPostOrderString(node.left)T=T+toPostOrderString(node.right)T=T+node.valuereturnT
Now,timehascometousethatstringagain.TheEyehascontactedyou.Yes,thesecretorganisationmentionedin"Nowyouseeme"(don'ttellanyonetheyarereal!!)
Yourememberthestringyoumemorisedbackthen.YoumustreconstructthebinarytreeT.YouarealsogivenastringA.AllthecharactersofAareuppercaseEnglishalphabets.LetusassumethatThasLleaves.Then,therewillbeexactlyLpathsfromtheroottotheleaves1uniquepathtoeachleaf.
YouhavetotellTheEyethenumberofpathsoutofL,onwhich,Aexistsasasubsequence.
-
LookattheexplanationfortheSampleCase1forclarity.
YouhavetoimplementthemethodexplorePathsinthecode.explorePathsispassedthefollowingparameters,respectively
N,thenumberofnodesinTS,thestringrepresentationofthepostordertraversalofT.Ofcourse,thelengthofSwillbeequaltoN.K,thelengthofthestringAA,thestringyoumustfindinthepathsfromtherootofT,totheleavesinT.
IITRoorkee1.GivenN,OwhereN=No.ofdigitsthatcanbedisplayedoncalculatorandO=No.ofmultiplicationtobeperformed.Thenumbersusedforthemultiplicationcanbefrom{2,3,...8,9}2
-
N=5X[]={0,2,3,5,7}Y[]={3,0,0,0,3}functionshouldreturn7incasethesquarecan'tbeformedoranyothererrorreturn1
Directi(IITGUWAHATI):Twocodingquestions.Therewere11testcasestopassforeachquestion.Q.1.RepeatedfromIITRoorkeeQ1.Q.2.ThequestionwasverybigwithastoryofIPLteamselection.Thesummaryofthestoryis:RoyalChallengerneedstoformateamofXplayers.EachoftheYfansofRoyalChallengercanselectXplayersoftheirpreference.Theteammanagementhaveacriteriathat,atleastoneplayerhavetobeintheteamfromeachofthefanspreferences.So,findtheminimumnumberofplayersthatcansatisfyeachofthefanspreferences.Forerroneousconditionsreturn1.
Example:
numberOfPlayers=5numberOfFans=3fanspreferences={100000010000010}output=3
numberOfPlayers=4numberOfFans=3fanspreferences={10000100
-
0101}output=2Givenfunctionsignature:intfindminimum(intnumberOfPlayers,intnumberOfFans,char**fanspreferences){}http://www.careercup.com/question?id=5734638857224192
Directi(IITKGP)Q.1.RepeatedfromIITDelhiQ1.
Q2Youaregivenastringthatconsistsofdigits.Thestringcontainsnotonlydigits,butmatchedroundbracketsaswell.Examplesofsuchstringsare
"1234(56)" "03(5(68(42)7))"
Notethattheroundbracketswillalwaysbematched,meaning Thenumberofopeningandclosingbracketsisexactlyequal Therewillbenoprefixthatcontainsmoreclosingbracke
"1234(56)""03(5(68(42)7))"Notethattheroundbracketswillalwaysbematched,meaningThenumberofopeningandclosingbracketsisexactlyequalTherewillbenoprefixthatcontainsmoreclosingbracketsthanopeningbracketsInthisstring,theopeningbracketisalwaysprecededbyadigit.Now,yougothroughseveraliterationstogetridoftheroundbrackets.TheiterationproceedsasIfthestringcontainsroundbrackets,pickupanymatchedpairofroundbracketsthatyoufindRepeattheentireexpressionwithintheroundbrackets,exatsthanopeningbrackets
-
Inthisstring,theopeningbracketisalwaysprecededbyadigit.Now,yougothroughseveraliterationstogetridoftheroundbrackets.Theiterationproceedsas
Ifthestringcontainsroundbrackets,pickupanymatchedpairofroundbracketsthatyoufind
Repeattheentireexpressionwithintheroundbrackets,exactlyasmanytimesas,thedigitthatimmediatelyprecedestheopeningbracketinthematchedpair
Notethatthestringaftereliminatingalltheroundbracketswillalwaysbethesamenomatterinwhatordertheroundbracketsarepickedforexpansion.Forexample,considerthestring"42(30(1)4(21()))8"
Wefirstpickup"(30(1)4(21()))"andrepeattheexpressioninsidethebrackets2times. Wedoit2times,becausethedigit2immediatelyprecedesthisbracketedexpressionin
thestring.Thestringnowbecomes"430(1)4(21())30(1)4(21())8"
Wenowpick"(1)"andrepeatit0times,since0isthedigitthatimmediatelyprecedesit. Repeating0timeseffectivelymeansthatweignoretheexpression. Wecandothisforboththe"0(1)"substringsofthestrings.
Thestringnowbecomes"434(21())34(21())8" Next,welookat"1()".Sincethebracketcontainsnothing,werepeattheemptystring
exactly1times. Thisalsoeffectivelymeansthatweignoretheexpression.
Thestringnowbecomes"434(2)34(2)8" Wecannowexpand"4(2)"to"2222"inboththeinstancesabovetogetthefinalstring
"432222322228". Thisstringhasthelength12.
ImplementthemethodstringLengthinthegiventemplate.Theparameterstothemethodare S,thestringthatmustbeexpanded.
Yourmethodmustreturnthelengthofthestringafterexpandingtheexpression.Donottrytoactuallyfindtheexpandedstringsincethisstringmightbetoobigtofitintomemory.Onlycalculatethelengthandreturnit.Youmayassumethattheanswerisalwayslessthan109.Notethatitispossiblethatthelengthoftheexpressionintheendis0.Youcanassumethattheinputstringalwaysisalwaysvalidaccordingtothespecificationabove.
-
SampleTestCase1"42(30(1)4(21()))8"Answerasdescribedaboveis12SampleTestCase2"1(1(1(30(9(12345678)))))"Answeris1.Theexpandedstringis"3"Constraints
1LengthofS1000 Theresultwillbelessthan109. AnyalgorithmofcomplexityO(N2)orbettershouldpass.
Note:BecarefulwhenreturningastringinC.Declare"charstr[]"globallyandreturn"str".Localchararraysaredeallocatedafteramethodlevel2callendsandwillproduceSegmentationFaults!
IITKanpurQ1.Givenabinarytreewherevalueofeachinternalnodeis1andleafnodeis0.Everyinternalnodehasexactlytwochildren.Nowgivenlevelordertraversalofthistreereturnpostordertraversalofthesametree.
Q2.sameasIITKgpq2.(actuallyithinkitisIITRq2)butinplaceofrectangletheywantedasquare(justsomeadditionaltestcases)
Q3.Givenamatrixwith1and0asentries.Findtheperimeterofsquareswhichencloseallthe1s.Allthe1sarecontiguousi.e.therearenoisolated1s.Forinstance010001110010000heretheanswerwillbe12.
Q4.givenastringoftheformAB2C3andanintk.ExpandthestringasABABC3thenABABCABABCABABC.Thenwhatisthekthelement.Youdntactuallyhavetoexpanditasitwillviolatedthememoryconstraints.Youjusthavetofindthekthelement.
-
IITB1.Question1fromIITR2.Givena2Darraycontainingdots(.)andhashes(#),findtheperimeterofareacoveredbyhashes.Ex.Perimeterofareacoveredbyasinglehashis4.Thatofacoupleofadjacenthashes(##)is6.Forthefollowinginput,theanswershouldbe15..##..#..###.
CompanyEBay:IITDelhi:Shortlistingwasdonebeforewrittenexam.MostprobablythecriterionwasB.Techinstitute(likeNITs).Thewrittentesthad2sectionswitheachhavingaseparatecutoff.1stsection:30mins,7aptiquestions.Tough.2ndsection:30mins,10technicalquestions.Highlevelofobjectorientedconceptsandgoodlevelofjava(mostoftheppldidntknowthatmuchjava).
(pleaseupdatethequestionsalsothanks)IITB:Sameasabove:PHowwasshortlistingdone??couldntgettheabovewrittenreason???Shortlistingwasdonebasedontheundergradcollege.Andthereisnolisttheyadhereto.Itsuptotheirwhimsandfancies.Wasquitesilly.IITM:Samepuzzlesimilartohttp://www.suhelbanerjee.com/2010/02/puzzlehighlyrecommendedone.html
IITKgpsameasabove:)FirstquestioninaptitudesectionwasLRtype.
-
2ndSection:1.PredictoutputofaJavacode.SomethingrelatedtoassertfunctioninJava.2.OnequestiononworkingsetmodelfromOS.
IITGuwahati1.Aptitudetest:7questions30minutesQ1.i.Hegavefivesetsofruleseachspecifyingtherelationfromwhichyouhavetoafillatable.ii.InthetablethecolumnswereFather,Mother,Child,LastName,Location.iii.Thecolumn(father)isfilledforyou,Youhavetofilltheremainentriesusingtherelationsspecifiedabove.Ex:MarysMotherisntaSmith(LastName).Michellefoundherdaughteratacradle.AliandhiswifeLabirdidntfindtheirchildatrollercoasteretc.Q2.Givenanamountfortwoobjectsandsomeprocedureofsellingtheobjectsyouhavetofindtheirvalues.Q3.Userstartsmovingfromapointinsomedirectionandfinallyyouhavetosayhispositionwithrespecttothefirstone.Q4.Someencodingrule.likeCCQWiswrittenasDDRYwhatwillbethecodeofHIJKQ5.Findthemissingnumberinatable.Q6,Q7.GivenapiechartandyouhavetocalculatethepercentageofSwithrespecttoP..onsimilarlines.
2.MCQsbasedonJava,C++,Networks,OS.:10questions30minutes.
Thenwehavehad3roundsofinterviewsfortheshortlistedstudents.Theyjustseehowenthusiasticyouare.Whatyouexpectfromebay.Howyoucanhelpebay.Whatdoyouwanttodoinebay.Yourinterestsandwhatyoudidthese4years.
AnAdvice:GothroughyourCVthoroughly.YoushouldbeabletodescribeeveryprojectyouhavementionedintheCVinaneatmanner.FinallyIwouldsaywhentheinterviewerasksAnyQuestions?.Pleasedoaskfewquestionsrelatedtoebay.Thismakestheinterviewertofeel
-
thatthisguyisreallyinterestedinebay.
BestLuck!!
CompanyEpic:
IITDelhi:Round1:1.5hrMCQtestwith3sections:epic1.questionin102min2.Mathsection14question(Simple)3.Newprogramminglanguage(20questions)
CANANYONEPLEASEPOSTSOMEQUESTIONSFROMTHE3rdSECTION^QuestionsrelatedtoMIISprogramminglanguage.Basicconceptsweredefinedinthequestions,andthensimplethingswereasked.3rdsectionsomefunctionisgivenwithitsdefinitionandsomeexpressionisgivenasargumentinthatfunctionthentheyaskwhatistheoutput.e.g.PIECEfunctionisgiven.
IITRoorkee(MIISprogramminglanguage)thesearebaseduponthedefinitionsgivena)NumericConstants(integers)b)StringConstantsc)VariableswhichcantakebothbothNumericandStringConstantswithoutanytypedeclarationd)TheConcatenationoperatoronVariablese)TheLogicalOperatorsmin(&),max(!),negation(),greaterthan(>),lessthan(
-
g)andsomemixoftheseoperatorstogether.likeconcatenateand()onthesevariablesandaskingwhatwillthosevaluesbecomeh)PIECEfunctionthatwillworklike$PC(abc,cde,fgh,2)willprintcdeas,isDELIMITERand2ispostionholder.similarextensionofthis
Round2:Thiswasanonlineroundwhereyouhavetojustwritecode(properlydocumented).NoCompilationandcoderunning.2hrroundwithfourquestions.Allcandidatesweregivendifferentquestions,whichcanbefoundoncareercup.combyfindingresultsforEpicSystems.Justhavealookthroughthesequestions.
Edit(29thOct2013):
Didthecodingroundincludecompilationandtesting?No(IITK)
secondround(Codingoneoftheset)1.Defineanumbertobe'valid'ifallitsdigitareinincreasingorderstartingfromunit'splace.Nowgivenanumberk,findallpossiblekdigit'valid'number.2.Giventwowordsthatare anagramofeachother.Swaponeword(onlyadjacentswappingoflettersallowed)toreachtotheotherword.Example,http://www.wordsmith.org/anagram/3.AnumberXissaidtobe'seed'ofnumberYifmultiplyingXbyitsdigitequatestoY.Forexample,123isaseedof738coz123*1*2*3=738.Nowgivenanumberfindallits'seed'.Solution???http://pastebin.com/MeqzY9Bp
1.Likeinnormalphoneifwepress2singletimeitisAandpressittwotimesitisBthreetimesitisC,sameforothernumberkeys,*meansspace.Yoraregivenonebignumberlike337444222*7777999777783367777wehavetoprintEPICSYSTEMS
2.Numbersatisfysomepropertywehavetofindwhethergivennumberfollowsthatproperty.3.Input{1,7,6,3,5,8,3}
-
Requiredsum:16Output:24
Sincehereindexstartsat1andwehavetoprintallcontiguousindexeswhoselocationvaluesaddsupequaltogivensum.here24indexvaluesumis7+6+3=16.
Theysaidthatfollowinglinkwasveryhelpfulinparticular:thttp://placementpapers.org/category/placementpapers/epicsystems/
IITRoorkeeThesewereEasybuttimeisimportant
1.Apersonhascheckingamountis50000$andcash500$.hebought2tvseach$1995ofwhichhepaid1/15inchequeand1/10incash(Assumerestamountnotpaid).ThenwhatischeckingamountleftandwhatiscashamountleftAns:49734,1012.apple40centsbanana60centsgrapefruit80centsthenpear=?centsAns:40(2vowels)3.16476481121pickoddoneout??ans:474.Whatistheamountoftimebefore5:00pmnow,ifbefore30minutesthetimeafter3:00pmis4timesthatofbefore5:00pmans:66min(how???)5.Amothcan(climb5inchesanddropbacks4incheseachtime)in1min.howmuchtimewillittaketoreachthetopof60.5inchbar.ans:58(how???Theanswerassumesthatthemothtook1minuteforfallalso.Soitwillreach56inchesin112minutes.Nextminuteitcango5butweneedonly4.5,whichwilltake0.9m.So112.9m)6.Sequence47134997fillthemissingelement.ans:257.?????
CompanyEpicIITKGPCodinground:
SomeMCQsrelatedtoAptitude:
-
1)Bankaccountquestion2)Bankaccountquestion3)yearlysalaryisgivenforaworker.ayear=52weeks5workers5weeksalaryisgivensohowmuchsalaryremained?4)Firstpersonat1(5office/min)andsecondpersonat106(10office/min)andtheirrespectiveSpeedgivensowheretheywillmeet?36officenumber5)1fora1$.customersaysIwant600thentakethese3$.whatwillcustomerbuy?dontrememberanswerforthis6)Agoatjumps3feetupandslips2feetinoneminute.sohowmanyminshewilltaketoreachtogoupatapoleofheight70.5?heredatachangesforsomepeople7)2.5humanscut2.5treesin2.5daysthen,5humanwillcuthowmanytreesin10days?20trees
(Timeisacrucialfactor.Youllgetmorethanenoughtime.Butfinishitasearlyaspossible)1.Youaregivenastring.Gibberizeitseligiblecharactersundertheconstraints:
eligiblecharactersare:a,A,e,E,i,I,o,O,u,U similarlyyouwillhaveonegibberizedcharactercorrespondstoeacheligiblecharacter. youcanassumeonefunctionisgiventogibberizethesecharacters atmost4eligiblecharactersfromtherearofthestringcanbegibberized exemptfirst3eligiblecharactersofthestringfromanygibberization
2.GivenanNxNgridofalphabets.Youneedtosearchonewordinthatgrid.Wordcanbepresentinanyrow(inreverseordertoo),anycolumn(inreverseordertoo)oranydiagonalcontiguouslySolution:http://pastebin.com/4ptu8VFi
3.Youneedtolabelfilesfromnumber1toN.Nwillbetakenfrominput.Onekeyisbroken.Inputthebrokenkeytoo.Printlargestpossiblelabelausercanprint.e.g.N=1232andthebrokenkeyis3thenlargestpossiblelabelwillbe1229.
-
4.PrintallpossiblevalidpasswordsofN(takeNasinput)lettersundertheconstraints: lettersineachpasswordwillbeenglishalphabetsandinascendingorderonly.e.g.ably
isvalidpasswordof4digitbutableisnot. letterscanbeinSMALLorCAPS.e.g.aBlyisalsovalid
5.Printallanagramsofastringsuchthatuppercaselettersandlettersotherthanalphabetspositionisfixed.http://pastebin.com/Emqdn0h9IITB:Almostsamequestionsasabove.
CompanyFlipkart:@IITM
20MCQ,2codingquestionsSomeMCQsare:1.howmanybitsarerequiredtorepresentmacaddress2.lastnonzerodigitin(551)!3.minimumnumberofnodesinacompletebinarysearchtree4.howmanywaysagarlandofatleast2roses,3lilies,1lotus..flst5flowerscanbeformed?5.whichdatastructureisusedforefficientsequentialinsertionandsearching?6.wehavetostorethelikesinfacebooksothatthepeoplewholikedthisareshowedinsortedorder(alphabetically).Whichdatastructurecanbeused?7.digitalsignatureincryptographyis(a.symmetricb.asymmetricc.both(a&b)d.advanced),SomeRDBMSqsUnixcommands,NetworkqsCoding:1.Findthebotttomviewofabinarytree.SecondQuestionidontremember,plzupdateifanyoneremembered.google
CompanyGoogle:IITG,IITM,IITR,IITB,IITKGP,IITKMCQ20questionsfrompreviousyearpaperalreadyposted.
-
Link:https://www.dropbox.com/s/v3eyb56v8kbqu1z/Google.pdf(previouspaper)
Codingquestion:
Inalanguage,thereareonly4charactersh,i,r,e.andwehavetowriteafunctionwhichtakesastringasinputandreturnswhetherthegiveninputstringisavalidwordornot.Similartothisone:ohttp://community.topcoder.com/stat?c=problem_statement&pm=12778&rd=15705
Defineofvalidword:1.Agivenwordisavalidwordifitisoftheformhninrnenwheren>=1.2.Validwordshasconcate nationpropertyi.e.ifw1andw2arevalidwordsw1w2isalsoavalidword.
IITDcodingques:http://www.spoj.com/problems/BOOKS1/insteadofgivingthecompletepartitionofsequence,onlyfindingtheminimumnoofpagesassignedwasasked.
CompanyInformatica:
IITD:Round1(40minutes):35MCQsmostofthemfromGATE2011and2012.TopicswereCN,OS,DBMS,OOP
Round2(75minutes)Subjective:Wehavetogiveexplanationsofanswers,writesomecode(compilerwasnotprovidedwriteonlycodeintext).Nottoomuchcodingwasrequiredbutthoroughunderstandingofcomputersciencewasproperlytested.
-
IITR:MCQsameasIITD.secondround:1.swaptwostring.2.fork()question.3.Redwhitetree(prunemaxrednode)withconstraintthatanodecanbewhiteifitsallchildrensarewhite.4.efficientfibbonacci(dynamicalgo)recursive.5.acodeisgivenyouneedtofindouthowmanybytememoryallocatetostackandheap.float*adouble**bchar*s=informaticaint*p=newint[10]
IITG:Round1:35MCQin40mins..90%ofquestionsarefromGate2011andGate2012paper.Cutoffforthisroundwashigh(closeto30).Round2:15Subjectivequestionsin75mins.someofthequestionsweretocheckerrorsandissueswiththegivencode.
ex:HowmanytimesHelloWorldisprintedinthebelowcode:intmain(){
for(inti=0i0)
breakprintf(\nHelloWorld)
}Somesimplefindoutput,errorsandissueswiththecodequestionsandwealsohavetogivecorrectexplanationsfortheoutputquestionstogetcredit.ItsdifficulttosolveallquestionsinRound2becausewehavetoexplainalotoneveryquestion.
-
Forround2:(Total15question)
Alltheabovementionedquestionswerethereplusfollowingquestionswerealsothere:
1Adirectedgraphwasgiven.Youhavetowritethecodetocopythegraphifitcontainscycle.2.Youwillbegivenadescriptiveproblem,itwasverylong.Youhavetowritesolutionfortheproblem.3.RemainingquestionswereCoutputquestions.a.)char*string1=Something1char*string2=Something2
youhavetowriteacodetoswapthestrings.(Meansafterswappingiftheyprintthestrings,theresultshouldbetheswappedresult.)UsevoidswapString(char**str1,char**str2)
b.)Codewasgiventocopythestring.Youneedtotelltheerrorsinthecode.Andwritethecorrectcodewithexplanationsinthespaceprovided.
voidcopyString(char*dest,char*src){intidest=(char*)malloc(strlen(src))for(i=0i
-
explanation.
voidmain(){inti,tempfor(i=0i0)breakprintf(Helloworld.)}}
d.)Outputofthecode:
#include#include
#defineVALUE120#defineVALUE244
intf(int*x,inti){int*yy=(int*)malloc(sizeof(int))*y=*x+VALUE2
switch(i){case0:
*x=*y+1break
case1:
-
*x=*ybreak
case2://somethingbreak
}return(*y)}intmain(){int*x,i,jx=(int*)malloc(sizeof(int))*x=VA
LUE1
i=f(x,0)j=f(x,1)
printf(i=%dj=%dx=%d\n,i,y,*x)return0}
IITBombay:Round1:35MCQsin45minutes.MostofthemwerefromGATE2011and2012andothersfromolderGATEpapers.
Round2:Shortlistedstudentswereallowedtowriteasubjectiveexam.OneoptionoutofC/C++andJavahadtobechosenpriortostartofthetest.15questionsinC/C++withalltheabovementionedquestionspresent.Wehadtofindoutputorlogicalerrorsinprograminmostquestionswithfewonwritingcode/pseudocode.Afewmorewhichwereaskedwere:
-
a)intmain(){staticinti=6if(i){
main()printf(%d,i+1)
}}
b)char*p=(char*)0int*q=(int*)0float*r=(float*)0double*s=(double*)0char*a=p+1int*b=q+1float*c=r+1double*d=s+1printf(%d%d%d%d,a,b,c,d)
c)intmain(){
int*diptr,*iptr,idiptr=iptr=(int*)malloc(4*sizeof(int))
for(i=0i
-
diptr+=sizeof(diptr)}
}
d)Belowfunctiongives1869onsomecompilerswhilegivesillegalaccesserroronothers.Reasonforthisbehaviour.structA{int*pA(intx){
p=(int*)malloc(sizeof(int))*p=x
}~A(){
free(p)}}
f(){
Ayod=indep}Aindep(1947)intmain(){
f()Adob(1869)cout
-
(inheritence,polymorphism),Objectsequality,Initializationofarrays,Compilationerrorsidentification,Runtimeerroridentification[compiletimeerrors|RuntimeExceptions],InnerClasses,Threads.Tip:Ifyouareverygoodatsmallsmallaspectsofjava,thenonlyoptforjavaotherwiseitwillbeverydifficulttopredicttheanswerandtowriteproperexplanationforthat.
microsoft::
1.48bitarchitecture,whatissizeofvirtualaddressspace?2^48bytes2.1rabbitcouple.Couplewillstartproducingothercoupleonlywhentheirageisonemonth.Initiallyinfirstmonthonecoupleisthere.howmanycoupleswillbeattheendofyear.Hintfibonacciseries3.Somecppcodes.andaskedoutput.(i.e.VirtualFunctions)4.Ccodesandoutput.5.Findbugsingivencode.6.ComplexityofBFSifadjacencylistisgiven.7.WhatisusedinDemandpaginga)sequentialsearchb)binarysearch.Answerplease..8.Ifpointertofunctionisdeclaredthehowtocallthatfunction.
CodingRound(60min)2questionsSameasIITbombay
CodingRound(60min)2questionsSameasIITbombay
1)checkistwowordsareanagrams.2)printlast10linesofgiv
IITBombay15MCQ(30min)
-
1.Inatreeeverynodehas2childrenor0children.ifthereare'n'nodeswith2childrenthenhowmanywith0children?ans:n+1n+1.IITKanpur
15MCQ(30min)SameasIITBombayquestionssomemore1.48bitarchitecture,whatissizeofvirtualaddressspace?2.1rabbitcouple.Couplewillstartproducingothercoupleonlywhentheirageisonemonth.Initiallyinfirstmonthonecoupleisthere.howmanycoupleswillbeattheendofyear.Hintfibonacciseries233http://www.maths.surrey.ac.uk/hostedsites/R.Knott/Fibonacci/fibrab.html#rab
3.Somecppcodes.andaskedoutput.(i.e.VirtualFunctions)4.Ccodesandoutput.5.Findbugsingivencode.6.ComplexityofBFSifadjacencylistisgiven.7.WhatisusedinDemandpaging
a)sequentialsearchb)binarysearch.Answerplease..8.Ifpointertofunctioni2.Ifweaddaconstantweighttoeachedgeinagraphwilltheshortestpathbetweenanytwoverticeschange?Ans:(Mayormaynotchange)//*thiswillbeDepends,notNO,consideragraphwhoseonepathfromAtoBhas4edgesof1andotherpathwith2and3,nowadd1toalledges..nowshortestpathbecomes2and3*3.howmany'0'in100!?ans:24(100/5+20/5+)4.Forrecursivefibonacci,whatisitscomplexity?ans:O(2pown)5.i=2,printf("%d%d",++i,++i)ans:44/*sequencepointconceptinCcomesintopicturehere*/(dependsonthecompiler??)(itdependsonthecompiler,giving43here(where?))6.intc[]={2,3,4,5,6},int*p=c,int*q=c,(1)for(i=1to5){printf("%d",*c)q++}(2)for(i=1to5){printf("%d",*p)p++}
- ans:2222223456(itshouldbecontinuousbecauseno\nisthere.)Manyquestionswereofthekind:givetheoutputoffollowingC/C++code7.x=4|3
-
Ccfoo(c)}output:b13.WhatisthedatastructurethathasO(logn)complexityonaveragingfortheoperations:search,insert,delete.ANS:AVLTreecorrect?14.Findtheoutput:#includeintfun(intnum){
while(num>0){num=num*fun(num1)
}returnnum
}voidmain(){
x=fun(8)printf(%d,x)
}ans:0
15.Findtheoutput:intfun(intnum){if(num
-
2codingquestions1hourCodingquestions:
1.Givena2Dmatrix.Eachcellwasfilledwithaspecificcolordenotedbysinglecharactereg.forblueB.Ifonepositionisclicked(x,y),colourpresentatthatpositionwouldbedeleted.Ifthesamecolourispresentinneighbourhood(up/down/left/right)thenitwouldalsobedeleted.Afterdeletionblankspaceswillbereplacedbythevaluepresentinthecellabovethat.Incasenovaluepresentabovethecellthenblankentrywillbereplacedby0.Inputx:1y:1BGBBGGBBBOutputB00B0BBBB
WHATSHOULDBEOUTPUTOFTHIS?????BGBBBGGBGGBBBGGBstartfrom1,1
B00BB0BBG0BBBGGB
-
2.Givenalinkedlistswapthealternativenodes(assumelisthaveevennumberofnodes.)Input:11>12>13>14Output:12>11>14>13
Retest:1.Given2strings,checkiftheyareanagramsofeachother.
2.Deleteeverynthnodeinalinkedlist.Whatdoesthisquestionmean,cansomeonepleasegiveanexample.LettheLLbe,1>2>3>4>5andn=2,thenresultantlistwillbe:1>3>5
IITKgp15MCQ.MostlywereaskingC/C++output(SomequestionswererepeatedfromIITBpaperabove).Someexamplesare:unsignedinti=1severaltypesofconstructorforaclass(e.g.copyconstructor)b)Virtualfunctionsandcallingthosefunctionsamongclasses
unsignedinta=1unsignedintb=~1intz=a*bprintf(%d,z)Ans:2
-
rabbitfibonacciseries.plzgivereasoning.Ans:233
intn=1000,c=5do{n/=c}while(c)printf(%d,n)Ans:Arithmeticerror(divideby0)
classA{public:A(){cout
-
use*inoperationwereferobjectonlyjustbytheirnameinCBR
intfun(intnum){intval=num
- inta[MAX][MAX]for(i=0i
-
StructMove{intp //Playernumberintx //xandyposinthetictactoiintystructMove*next}Thesamplefunctiontowriteis:
voidplayGame(structMove*move,intN)Q.2.Givenanarrayifinapositionleta[i][j]=1thenprintallitsrowandcolumn1.Youshouldnotconsideraposition1afteryoumadeit1inyourpastcomputation.sample(input):(i)00100 (ii)1000000 01output:(i)11111 (ii)1100100 11
CompanyMorganStanley:
CompanyNVidia:IITBombay@IITB:,1hr>Approxhowmanyquestionsineachsection..?atleastonthewholehowmanyquestions?
Howmanyquestionsineachsection?Ifpossiblepleasepostfewmorequestions..4sectionswithsectionalcutoff:
-
Section(1):.Coutputquestionspointerarithmetic,preincrement,postincrement,unionQx=25if(!!x)
printf(%d,!x)elseprintf(x)
.Q.enuma{A,B=2,C}print(enum)
a.023b.123c.022
Q.intx=0while(x>10){
x}printf(x)
section(2).Datastructuresmostquestionswereveryeasy.Ionlyremember:Q.section(3).OS:Q.A.4frames.HowmanypagepagereferencestringwasgivenfaultswithLRU.Q.Whichofthefollowingdoesntneedsynchronizationwithmultiplethreads:a.accessingaglobalvariableb.accessingafilec.modifyingavariableonstackQ.WhatisMemorymappedI/Owith4options
section(4).Aptitude:difficultylevelwasmoderate`
-
CompanyOracle:
IITGuwahati:Mostquestionsfrompreviousplacementquestionsandtherewerenewonesaswell(Thosewhorememberquestionsindividuallycanaddthem)
IITBombay
Q1:Whenstackusedforparameterpassing,Whatistheprotection?ans??0
Q2:O/Poffollowincodemain(){inti=10i=!i>14printf(%d,i)}Answerwas0
Q3:HwOOSachivessystembehaviour?
Q4:WhichisnotaOOADmethod?4optionsweregivendatadrivenbehaviordrivenusecasedriventhelifecyclestages
-
thedegreeofformalism
Q5:worsecasetimetosearchinsortedLL?ans:O(n)
Q6:Syntaxofpurevirtualfunctionforabstractclass(c++)?ans:virtualvoidf()=0
Q7:Timecomplexitytoinsertinstack(implementedthroughLL)?ans:O(1)
Q8:TimecomplexityofQuicksort?ans:avgcase:O(nlogn)worstcase:O(n^2)
Q9.ManyquestionsfromAVLtrees:givenBST,converttoAVLtree,preordering,postordering
Q10.SomepeoplealsogotquestionsonRedBlacktrees.InsertionanddeletionQ11.Questionsofdoublestackimplementedonanarraywhichstartsfromendsofarrays
AnyupdatesfromcompletedIITguys??
IITKGPandIITR:Mostlyfrompreviousyearpapersanditwasonline!!!
-
WrittenTest:20MCQquestions.VerybasicofCanddatastructurelikepostordertraversalisleft,right,root.
IITD:Iftwothreadsareincrementingavariable100timeseachwithoutsynchronization,whatwouldbethepossibleminandmaximumvalueWrittenTest:20questionsExtremelyhopelessMCQs.Verybasicones.
IITB:20MCQsmostlybasedonC,alsohaddatastructures(tree,linkedlist,queue)andOS.
IITKgpsameasIITM/IITDCouldyoupostquestionsorlinkfromwherequestionshadbeentaken??
1qonfree(ptr)1onrealloc()1codeondoublylinkedlist..choosethecorrectoutput1onwhichisshortestpathalgo.....optionswerkrushkal,dijktras,andtwootherrandomoptionsonequestiononsizeofptrs....
23questionspointertofunctionsoneoninordertraversal
CompanySymantec:SymantecQuestionsomebody?
-
CompanyWalmart:WalmartOnlineTestQuestionIITRoorkeeMCQ:1.SqlQueryisgivenoverasmalldatabaseandweneedtofindoutnaturaljoin.2.Ans:min:2,Max:200
Doubt:Ithinkminshouldbe=100,kindlyclarify?seeherehttp://www.careercup.com/question?id=18315663.ANS:itshouldbe2only.supposefirstthreadreads0andsecondthreadsdoes99increments.i.e99.nowfirstthreadwrites1over99andsecondthreadnowread1,nowfirstthreadincrement100timesandthensecondthreadincrement1andwrites2.http://www.careercup.com/question?id=18315663
3.acprogramweneedtofindoutcomplexityofcode.4.Indijkstraifusedaryheapthencomplexity?5.supportandconfidenceforatransaction.supportandconfidenceforatransaction6.giveMatrixM1:10x100M2:100x20M3:20x5M4:5x80findminimummultiplicationrequired:(gate2011question)
Ans:190007.ExpectationquestionR=liswhat?(gate2011question)ANs:R>=0
8.givenf(x)=forx=0,1,..,5andxisthenumberofcakessoldbyabakerononeday.the
-
profitis$1.00/cakeandlossis$0.40/cakethenwhatisthenumberofcakesheshallbake?note:cakescannotbestoredfornextday
9.linklisthavingaloopthansomeconstraintisgivenonitweneedtofindoutwhichistrue.(easyone)10.DontRemember.
11.Walmartsecondcodingquestion:wehavestreamofpalindromeinincreasingorderlike:{1,2,3,4,5,6,7,8,9,11,22,33,....101,111,121,131...212,222,232,.....}andtheyareformingandigitnumberlike:number=12345678911223344.....101111121131..(allpalindromeinincreasingorder)thenwehavetofindthekthdigitofthenumber.12.Engineersat@WalmartLabshavedecidedtocallanyinteger(+ve,veor0)thatisdivisiblebyatleastoneofthesingledigitprimes(2,3,5,7)asWalprimes.Thus21,30,0,5,14etcareWalprimes,while121,1,143etc.arenotWalprimes.
Now,considerandigitintegerd1d2d3..dn.Betweenany2consecutivedigitsyoucanplaceeithera(+)sign,a()signornothing.So,thereare3(n1)differentexpressionsthatcanbeformedfromit.SomeoftheexpressionssoformedmayevaluatetoaWalprime.Forexample,considerthe6digitinteger123456:1+2345+6=236,whichisaWalprime,but123+456=71,whichisnotaWalprime.Yourtaskistowriteaprogramtofindtheno.ofexpressions(outofthepossible3^(n1)expressions)thatevaluatetoaWalprime,foragiveninput.Notethatleadingzeroesarevalid.Forexample,iftheinputis1202004,itcanbesplitas12+02004etc.Also,theinputitselfcancontainleadingzeroes.Inputformat:(Readfromstdin)
-
Thefirstlineofinputcontainsasingleinteger'T'denotingtheno.oftestcases.Eachofthefollowing'T'linescontainasinglestring's'(oflength'n')denotinganinputforwhichyouneedtofindtheno.ofvalidexpressionsevaluatingtoaWalprime.Outputformat:(Writetostdout)Outputexactly'T'integers(oneperline),wheretheithlinedenotestheno.ofvalidexpressionsthatevaluatetoaWalprimefortheithinputstring.Sincetheoutputcanbelarge,printallthequantitiesmodulo1000000007.Sampletestcase:Input:201112345Output:664Explanation:Forthefirsttestcase,s="011".Thereare3^2=9validexpressionsthatcanbeformedfromthisstring,namely{0+11,011,0+1+1,0+11,01+1,011,01+1,011,011}.Outofthese9expressions,onlythefollowing6ofthemevaluatetoaWalprime:{0+1+1,0+11,01+1,011,01+1,011}.Constraints:Thereare3datasets.Forthefirstdataset(5points)1Fortheseconddataset(10points)1Forthethirddataset(15points)
-
1ComapnyWalmartOnlineTestQuestionIITKharagpur10MCQ2coding
1.Cubetobepaintedwith6differentcolourson6faces..howmanypossiblecubes?ifonrotating1configuration,wegetanother,thenthatisnottobeconsidered.Ans:30?(5!/4)
2.(777^333333^777)whatisthedigitatonesplace(LSB)intheresultingno.Ans:0?(7^333%10=33^777%10=3)
3.nelementsunsortedarray(theirvaluesareinrange0tok1)..minimumtimetocalculatemedian
4.linkedlistwithlastnodepointingtooneofthepreviousnodes(cycle)..howmuchtimerequiredtodetectthecycleandmakethelastnodepointtoNULL(i.etoremovethecycle)
5.O(n)complexityisrequiredtocalculaten/4thsortedelementofanunsortedarrayquicksortpivotelementischosentobethat.whatisworsttimecomplexityofquicksort
6.Infinitelylargenoofelementsinabarytree.bisgiven.Uneedtosearchforanelementatfinitedepth.possiblemethodsBFS,DFS,iterativedeepeningdepth1stsearch(IDDFS).Dnsomestatementsgivenabouttheircomplexities.This1wasamultiplecorrectquestion.
7.narraystobesortedbymergesort.time?
******whataboutQ8,9,10?Pleaseupdatethem*******
11.Pilesofcoinsaregiven(ex.5piles:9,0,5,1,5)total20coins..Theminimumno.ofmovesrequiredsothatallpileshaveequalnoofcoins(4,4,4,4,4)(ansforthisis9moves)Rules:onecoincanbemovedtoonlyadjacentpiles..i.e.jthpilecoincanbemovedtoj1orj+1iftheyexist
- Level1:n
-
Findthemin.no.ofmovestoconvertagivenstringintoallHs.eg:HHTH=>flip3rdposition=>HHHHHTTT=>(flipprefix)=>THHH=>HHHH
IITDelhionlinetestoninterviewstreet.9singleoptionobjective,1multipleoptionobjective,2codingquestions.
Coding1.CodeChefLinktothisproblem.
Coding2.Inputisagainarrayofintegers(canbenegativealso),andtwonumbersLandR(L
-
2codingquestions
1)Nexthighernumberwithsamenumberofsetbits
http://www.geeksforgeeks.org/nexthighernumberwithsamenumberofsetbits/
2)printbinarytreefromtoptodownandbottomupmanner(Verticalzigzag).
mcqs,basedonsimplemathematics,algos,os,networks.
CompanyYahoo:
CompanyCitiCorp:(NITW)
Thecodingistobedoneononlinecompilerwehavetorunalltestcasesalso.(Amcat)generalaptiquestions(simpleonly)logicalreasoning
Programmingquestions(80min)2questionswereaskedtoeachcandidatesomeare:
youaregivenastringanduneedtoencryptit
foreg:0123401230120123456
hellodereandwelcome(givenstring)
hfnosdfth....(outputstring)
`
souneedtoaddtheindexofcharactertoitselfAlsoifthecharacteris'z'anduhvtoaddsay3
toitthenitshouldwraparoundandbe'c'Ifitis'Z'thenitshouldbe
'C'http://ideone.com/oVI49q
-
aadjacencymatrixisgivenandhvtofindwhetheritrepresentsGraphorTree?
soln:uhvtofindifcycleexists.
totraversethelinklistandfindifthereisacycleinthatlinklist
######################
totaldurationoftestwas2:30hrsifwhich80minisforcodingquesaptiquestionsareeasy
only..sou'llbeshortlistedonthebasisofcodingquesonly.
Citicorp@IITD:
(Isitpenpaperoronline?)onlinetest
(IsthereanycodingroundoronlyMCQs?)bothbutindifferentsectionsbutinsame
round
1stsectionCprogramming25ques35min.2ndsectionQuants16ques16min.3rdsectionLogicalAptitude15ques14min4thsectionCprogramming2ques60min
differentquestionsetforeachstudent,programmingquestionsarealsodifferent.Noswitchingisallowedbetweenthequestion.
CANANYONEADDPROGRAMMINGQUESTIONSOFCITICORPfromIITD??????
Company:OPERASOLUTIONSIITMadras1.Testiswrittenoneandnotanonlinetest.Itisconductedintwoparts.2.Firstpartconsistsof20MCQs30min.f
-
3.Secondpartconsistsof6subjectivequestions45min.PartI
Q1.Expectednumberoftrialstogeta4or6whenadiceisthrown.Q2.Howmanytimesdoesaminutehandcrossoverthehourhandin24hours?
PartIIQ1.GivenasetX={1,2,3,4,5,6,7,8,9,10}.FindtwononemptydisjointsubsetsAandBsuchthati)AUB=Xii)prod(A)isdivisiblebyprod(B).prod(S)istheproductofalltheelementsofsetS.iii)Thequotientobtainedwhenprod(A)isdividedbyprod(B)isminimum.
Q2.Therewere3knobsforalockA,B,C.Eachcantake8positions.When2oftheknobsareattheircorrectpositions,irrespectiveofthethird,thelockopens.Sothenumberofattemptstogetitrightwillbe8**2=64.Canyoudobetterthanthat?Q3.Thereare3colorsfora9digitlotteryticket.Foracolortobeofthesameclassalldigitsshouldbedifferentfromanotheroneinthatclass.122222222isgreen,all2isred.Predictthecolourof123123123Q4.ProvethatnC7floor(n/7)isdivisibleby7forn>7.Q5.Amanhas2girlfriends.OnelivesinNandanotherinS.Hehastrainsleavinginbothdirectionsin1hourinterval.HewakesaccordingtoaRNGandtakes5minutestoreachstationandfromtheretakeswhichevertraincomesnext.InayearhehasvisitedtheSgfalittleover300times.Howisthispossible?Q6.http://vishnumenon.com/2013/08/13/tocatchapirate/
..someonepleaseelaboratequestioM/sStrandLifeSciences,KarnatakawillbevisitingourcampustoconducttheWrittenTestforBTech/DualDegree/MTechComputerScience&Enggasscheduledbelow:
Date:29thNovember2013Time:12.45p.m.(LatecomerswillnotbeallowedintheHall)Venue:CRCns..idonotrememberexactly
-
IITKgp:exactlysameasmadras.
Company:StrandLifeSciences@IITDDuration:90minutes.Paperpentest.1.[5Marks]Weareperformingsumofindividualdigitsforallnumberfrom1to10,00,000Wehavetofindtheno.of1'sand2'sobtained=NO.sof1and2????
2.OneCoutputquestion[5Marks]3.AgainCquestion,onecodeisgivenwehavetofindhowmanyaandbpairsarepossible.[5Marks]4.OneReasoningquestion[5Marks]5.
whichcoderunsfasterinonearrayisaccessedinrowmajororderandinotherarrayisaccessedincolumnmajororder.[5Marks]
6.Wehavetoderivetheclosedformulaeformaximumno.ofregionsformedfromnlines.[15Marks]7.Checktwostringsareanagramsornot.[15Marks]8.Nqueenproblemcode.[20Marks]9.Nutboltproblemcode.[30Marks]
-
IITBQwritepseudocodeforNqueenproblemQaftermidnight,atwhattime,bothhandsofclockoverlap.QSimulationofunbaisedcoinfrombiasedQpseudocodeforcountingleafnodes.QA
BCwDEFGHIJWhereA,B,C,D,......arenumbers.AssumeanyDSandfindpathfromtopoftriangle(i.e.A)tobottomrowsuchthatyoucanonlymovetonumberinbottomrowtorightorleftofcurrentnodeandsumismaximum.QT(n)=T(n2)+T(n1)+c,findcomplexity.Q4peoplehastocrossabridge,only2pplcancrossthebridgeinasinglepass.1torch,A=1min,B=3min,C=9min,D=11min.Findmintime.
CompanyTimesInternet:Arbit
CompanyHTMedia@IITD:
PROBLEMSTATEMENT:
CalculatorLanguage(CL)supportsassignment,positiveandnegativeintegersandsimplearithmetic.TheallowablecharactersinaCLstatementarethus:
A..Z:Variables0..9:Digits
-
+:Additionoperator:Subtractionoperator*:multiplicationoperator/:integerdivisionoperator=:assignmentoperator():brackets:negativesign
Alloperatorshavethesameprecedenceandarerightassociative,thus1583=15(83)=10.
Asonewouldexpect,bracketswillforcetheexpressionwithinthemtobeevaluatedfirst.Bracketsmaybenestedarbitrarilydeeply.Anexpressionneverhastwooperatorsnexttoeachother(evenifseparatedbyabracket),anassignmentoperatorisalwaysimmediatelyprecededbyavariableandtheleftmostoperatoronalineisalwaysanassignment.Forreadability,spacesmaybefreelyinsertedintoanexpression,exceptbetweenanegativesignandanumber.Anegativesignwillnotappearbeforeavariable.Allvariablesareinitialisedtozero(0)andretaintheirvaluesuntilchangedexplicitly.
Writeaprogramthatwillacceptandevaluateexpressionswritteninthislanguage.Eachexpressionoccupiesonelineandcontainsatleastoneassignmentoperator,andmaybemore.
InputInputwillconsistofaseriesoflines,eachlinecontainingacorrectCLexpression.Nolinewillbelongerthan100characters.Thefilewillbeterminatedbyalineconsistingofasingle#.
Output
Outputwillconsistofaseriesoflines,oneforeachlineoftheinput.Eachlinewillconsistofalistofthefinalvaluesofallvariableswhosevaluechangesasaresultoftheevaluationofthatexpression.Ifmorethanonevariablechangesvalue,theyshouldbelistedinalphabeticalorder,separatedbycommas.Ifavariablechangesvaluemorethanonceinanexpression,onlythe
-
finalvalueisoutput.Avariableissaidtochangevalueifitsvalueaftertheexpressionhasbeenevaluatedisdifferentfromitsvaluebeforetheexpressionwasevaluated.Ifnovariableschangevalue,thenprintthemessage`NoChange'.Followtheformatshownbelowexactly.
Sampleinput
A=B=4C=(D=2)*_2C=D=2*_2F=CDE=D*_10Z=10/3#SampleoutputA=4,B=4C=4,D=2D=4NoChangeE=40Z=3
Onlyonecodewasgivenandapproximately100minutesaregiventosubmitthecodeandallowedprogramminglanguagesareC,Java,Python,Ruby.Nocompilerisprovidedwehavetouseourowncompiler.
CompanyDell@IITD15apti+45tech(75min)singlechoicecorrectOnlinetestandallofushadthesamesequenceofquestions:)andnonegativemarking1.preorderandinorderaregiven.find postorder2.prefixtopostfixexpression
-
3.Shortestremainingtimefirstquestion4.2questionsonpagereplacementstrategy(oneonLRUandotheronoptimal)5.somequesonC6.onequesonprobabilityusingbayestheorem7.grapes74%wateranddrygrapes35%andofgrapesaregiven..howmanydrygrapescanbeprepared??8.villagepopulation2500.65%arewomenofwhich24%areliterate.38%ofvillagersareliterate.find%ofmenwhoareilliterate?9.pipesP1andP2fillstankin6minand9minrespectively.P3canemptyitin3min.StartingwithP1ndP2openedfor3min.ThenP3alsoopened.Howmuchtimetotakeittobeemptied?10.somequesondbms.11.networksalso.12.unixzombieprocess,chmodrecursivelychangepermissions,hardlinkquestion
CompanyCisco@IITD:20apti+30tech(60min)singlechoicecorrectPen&Papertestandallofushadthesamesequenceofquestions:)andnonegativemarkingtechquesinvolvesbothhardwareandsoftware.1.8queensproblemRecursive2.Venndiagramques3.Areaofacircleques
4.Onequesonsemaphore5.DiffbetweenPAMandAM6.JKflipflop7.hammingcode8.Booleanfunction9.SUBBinstructionof808510.RSTof8085
CompanyNECCorporation@IITD 68Personalitybasedquestions.Eachinvolves4optionsandtotickmostandleastin
yourself.Notimelimit.Butaveragetimetocompleteitis20min.Sotrytofinishitwithin
-
20min.
CompanyBrowserStack@IITD:(itwasonlineorpaperpen?????)onlineSection1.Q1parseandprettifyhtmlgivenasinglelineinputinput:hellooutput:
hello
Q2removecommentsfromc/c++WAPtoremovecommentsfromc/c++file(Canthecommentsbeofbothtypes,i.e.,//and/**/?)
Section2.givenaarrayofnumber.numberwithin1ton.Howuwouldsorttheminfollowingsituations.a.alluniqueelementsb.1repeated,1missingc2repeated2missingd.4repeated4missing+
Q3givenaNXNgridnumberofuniquepathsfromlefttoptobottomrightAns.(2n)!/(n!n!)(isitcorrect?)//Yes:its2nChoosen
CompanySAPLabs@IITD:
Onlinetestonmettl.com
-
Time:90minutesNonegativemarking5sections1st:10Aptitudequestion2nd:Analytical15question3rd:Verbal1essayand9otherquestion(Otherasinwhat?Wordmeaningsandstuff?)4th:CSfundamentals10question5th:Coding1questionDifferentquestionsetforeachstudents.Wasthecodingquestiondifficult?moderateWasitDPbasedforthemostofthepeople?No
OneQuestionwasalmostsametoProblem38inDynamicProgramming(Karumanchi)WhatarethequestionsinSAP@IITD?fico,iitkgp(15aptitude,10programming,2generalthinking)*howmanymultiplicationsneededtocomputex^100whenproductoftwonumberscanbesavedintoanothervariableatatime.*howmanynumberswithin200canbelistedsuchthatnotwodistictnumbersarenotdivisablebyoneanother??
Answersplease???
top related