Java Interview Questions for ZYCUS

ZYCUS Interview Questions :


Q.1> list all bad coding practices in the following code snippet

try{
for(int i=0;oldCode.size();i++){
String insertIntoMappingtbl="insert into schemaptbl '' + " values(?,?,?,?,?,?)";
pstmtMappingTbl=con.prepareStatement(insertIntoMap pingTbl ); 
pstmtMappingTbl.setObject(1,oldCode.get(i));
pstmtMappingTbl.setObject(2,oldId.get(i));
pstmtMappingTbl.setObject(3,newCode.get(i));
pstmtMappingTbl.setObject(4,newId.get(i));
pstmtMappingTbl.setObject(5,sub.get(i));
pstmtMappingTbl.setObject(6,subid.get(i));
pstmtMappingTbl.executeQuery();
}
}
catch(Exception e){}
finally{return success;}
Q.2>
You attempt to query the database with this command
SELECT name,salary FROM employee
WHERE salary={SELECT salary FROM employee Where Lastname = 'Wagner' or dept no =233)
choose most appropriate option from following:
A.sub queries are not allowed in the where clause 
B.logical aparatous are not allowed in where clause .
c.a multiple row sub query used with asingle row comparision operator.
D. A single row query is used with a multiple row comparisin operator.

Q3.>
If atable T1 has single column c1 with data base (a,a,b,b,b,c)
write aquery that out put as follows 

c1 count (c1)
.......................
b 3
a 2

BELOW Q SHOULD BE SOLVED USING SIMPLE PROGRAMING CONSTRUCTS.

Q4>Write a function that takes an integer array as an input And finds the largest number in the array. 

Q5> Write a funcytion that takes an integer array as an input and findes the second largest largest number in the array. you can use only one loop .You cannt sort the array.

Q. 6>
Give two integer arrays A & B.A has n elements and B has ' n-1 ' elements . A has all the elements that are there in B. But B has one missing element. Write a function that takes arrays , A & B as imnput and finds the missing element in most optised manner .
Q7>

Write a programm to delete a node from Linked list . You cannot use any of the Existing collection classes available in JAVA . you have to create ur own Linked List .

Q 8 >

U have an array of +ve integers arranged in the descending order . Write a functionb thast take an integer & an integer array as an integer and returns the position of the given integer in the array , if the integer is not present in the array it should return -1 . the serching technique that u use should be very efficient both in terms of time & memory.

Q 9>
If u were to create following components , what API will u expose ? U can use class/block diagram to expose internals of component .
. Chart component that can render various types of charts , such as pie , bar , line 
...spell checker component 

Q 10>
draw class / object diagram of one of the following 
.... ATM
.....RailwayReservation



Please share your faced interview questions by faqs@javastuff.inwhich can help job seekers as well as java learners.


Enter your email address to get our daily JOBS & INTERVIEW FAQ's Straight to your Inbox.

Make sure to activate your subscription by clicking on the activation link sent to your email