Hyderabad, , India
Android, C Plus Plus, HTML
0 टिप्पणी करें | 54 लोगो ने देखा है | 02 अप्रैल 13  | Srinivasarao Mahanti
One of Logical Interview Question
A good Employee is defined who has all the following properties 1. Employee must be married. 2. Employee has at least 2 children 3. His Middle Name Start with ldquoKrdquo and Ends With ldquoErdquo. 4. His Last Name has at least 4 characters, and starts with ldquoArdquo 5. In His childrens have at least one name ldquoRajardquo. Write a method boolean isGoodEmployee boolean isMarried, int noOfChild , String middleName , String lastName , String childNames Answer import java.io. class Employ boolean isMarried int noOfChild String middleName String lastName String childNames boolean isGoodEmployee boolean isMarried, int noOfChild , String middleName , String lastName , String childNames this.isMarriedisMarried this.noOfChildnoOfChild this.middleNamemiddleName this.lastNamelastName this.childNameschildNames int mlengthmiddleName.length int mlmlength-1 int lnLengthlastName.length int count0,name0 int childlnchildNames.length ifisMarriedtrue //return true else System.out.printlnquotHe is not Marriedquot if noOfChildlt2 //return true else System.out.printlnquotnot about childrenquot //System.out.printlnml //System.out.printlnmiddleName.charAtml //System.out.printlnmiddleName.charAt0 ifmiddleName.charAt039k39 ifmiddleName.charAtml39e39 // return true else System.out.printlnquotName not in COrrect formatequot iflnLengthgt4 forint i0iiflastName.charAti39a39 countcount1 //System.out.printlncount ifcountgt2 else System.out.printlnquotLast Name not in Correct formquot //System.out.printlnchildNames0 //System.out.printlnchildln forint i0i ifchildNamesi.equalsquotRajaquot namename1 ifnamegt1 //return true else System.out.printlnquotNO One Children is RAJAquot System.out.printlnquot Good Employeequot return true public static void mainString args String mNamequotkiranewquot String lNamequotMaadhuquot boolean marriedtrue String childNquotRajaquot,quotLathaquot int noChild2 Employ emnew Employ em.isGoodEmployeemarried,noChild,mName,lName,childN

    • इस ब्लॉग के लिए सामाजिक शेयर

पोर्फोलिओ और ब्लॉग
Srinivasarao Mahanti विभिन्न कंपनियों का अनुसरण करता है, ये कंपनियां और नियोक्ता Srinivasarao के फिर से शुरू देख सकते हैं
सबसे अच्छा नौकरी के अवसर पाने के लिए अपना फिर से शुरू करें अपलोड करें

मुफ्त रजिस्टर करें!