biggied88
BAN USERI am an experienced java developer with overall 4 years experience in software development.
- 0of 0 votes
AnswersWrite code to return the numbers of almost prime numbers in a given range. Remember an almost prime number is a number one degree off prime - basically a non-prime number divided by a prime number that equals a prime number.
- biggied88
example: 4/2 = 2 or 26/13 = 2 both numbers are almost prime numbers
given in question: the first 25 prime numbers are - 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97.| Report Duplicate | Flag | PURGE
Denmin Group Software Engineer / Developer Coding - 0of 0 votes
AnswersInterview for mid-level java developer:
- biggied88
problem-solving skills question:
You have a page with a main menu and then submenus. depending on which menu button you press different set of submenus is shown. when the user presses on a submenu button they are sent to that page by a link. You want to setup a breadcrumb in the URL to show where the user has been - pressing the main menu, then the submenu the link for the submenu should display in the URL(example. page1/page2/?link=_...).
Issue: link keeps changing -
The user clicks the menu, the submenu is shown, then they click on a submenu, then they go back to the main menu, then click on the same submenu as before a different link is seen. but it should be the same link since it is the same menu to submenu combination.
how do you solve this issue?
** this was a "feel-out" question. I later found this out it wasn't meant to be a question i was suppose to be able to answer correctly but a question to test an individual's problem solving when on a diffuclt problem| Report Duplicate | Flag | PURGE
IBM Software Engineer / Developer Ideas - 0of 0 votes
AnswersExplain the different types of EJBs
- biggied88| Report Duplicate | Flag | PURGE
IBM Software Engineer / Developer Java - 0of 0 votes
Answersthis was a question for a java developer position:
- biggied88
A web application is running with the following architecture - they have 6 database servers, 4 business servers, with 4 different web servers. Question: why would a web application be running their architecture this way? Can you describe the architecture of your last project| Report Duplicate | Flag | PURGE
Home Depot Software Engineer / Developer Experience - 0of 0 votes
AnswersInterview for a mid-level java developer on one of their product R&D teams:
- biggied88
Can you explain the use of web application frameworks in java development. Discuss, how they work, why they are used, what they have done to revolutionize java development in the last few years. Can you explain the difference between Spring and Struts. Can you explain the similarity between the two.| Report Duplicate | Flag | PURGE
IBM Software Engineer / Developer Java - 0of 0 votes
AnswersHow does the Collections API handle collisions? How does the API handling making the collection "some-what" collision safe?
- biggied88
Explain- which collection does this affect and the best way to deal with it.
Also explain, the most common senario that causes this issue- hint* one is in threading(how can this be caused).| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Java
Basically this is the difference:
JSPs - are used for the view or presentation of the application.
JavaBeans - are used for the logic/business processing in the application.
You can divide up which object does which logic depending on the architecture of the project. i.e. - you can do some java processing in the JSP itself but you can choose to do the same logic in the javabeans.
this is more efficent becuase the main for loop will cycle only 4 times
plus i made a little error in my psuedo code it should be:
Card[] deck;
int rank = 13;
int suite = 4;
String
foreach(0 <= suite){
foreach(0 <=rank){
//in card class add the suite and rank string value
deck[number of cards] = new Card(suite, rank);
}
}
add two jokers
aquila.25,
your correct collisions are caused by dupiclate indexes being made from the same key in the (key, value) pair of the .put() method in the Map collection(which HashMap and HashTable implements). Basically, a collision is the same key different value - same hashcode. In the .put() of the Collections API, java creates an index based on the hashcode() and the key.
This is vulnerable during threading and/or when the Map is getting close to maximum capacity(like for an example there are over 80,000 different indexes(when the Map is getting full it may not pickup the repeated keys))
How threading is vulnerable is becuase you will have the indexes being created concurrently and then when the process is finished the final Map is just combined. Example- you have 1000 records being converted into a HashMap(one record for each key,value pair with the value being the record) and you start a thread to create a new thread every 100 records. if you repeat a key then you will cause a collision. the system will not be able to pick up duplicates due to the threads running concurrently.
You were correct in how to handle this isssue - if you are going to run multi-thread or if the HapshMap.size() is getting close to capacity use chaining or some other technique to afford collisions.
the question is to write psuedo code for creating a deck of cards. most decks have a 52 cards with 13 cards per suite. just add the two joker cards after the deck is created instead of shuffling the deck. If you google for create a deck of cards program you should be able to find many solutions
- biggied88 March 05, 2010HashMap is an subclass of the Map collection - in java. a HashMap uses a hash function to effciently map certian identifiers or keys to associated values. Map and HashMap have a (key, value) pair where the key is the custom index and the value is the object to store. To add an element to the HasHMap you call the method .put(key, value). in the put() method inside the code a hashfunction hashcode the key into an index. to retrieve something from a HashMap you use the method .get(key) to get a single index. HashMaps can contain null values and duplicates. HashMaps are vulnerable to collisions due to the custom indexing and being able to duplicate
java implementation
HashMap<Object>() map1 = new HashMap<Object>();
indexing - database index can speed up a query by hundreds or thosands of times. This data structure(indexes) are created by using one or more columns in the table, providing a basis for both rapid random lookups and efficient access of ordered records. in a rational db an index is a copy of one part of a table. Code to create an index:
CREATE INDEX table_column1 ON table(column1) - this allows the database to very quickly match records from column1.
SQL - structured query language - a database language designed for managing data in a relational database management system RDBMS
Joins - a SQL clause that combines records from two or more tables in a database. An SQL join creates a set that can be saved as a table or used as is.
different types of joins:
INNER- create a set that has a similar set of column values
ex. SELECT * FROM table a, table b INNER JOIN
WHERE a.column1 = b.column2
OUTER - basically the opposite of an INNER JOIN, it will return all/some the records that do not match of the joined tables. outer hoins subdivide further into different types of joins LEFT, RIGHT, FULL
LEFT OUTER- aka left join - returns all the records on the left table and only the records on the right table that match. as for the sql below - all the records in table 1 and only the records that match for table 2
SELECT * FROM table1 a, table2 b LEFT JOIN ON column1
WHERE a.column1 = b.column2
RIGHT OUTER JOIN - aka RIGHT JOIN - is opposite of left join - return all the records from right table and only the records that match on left table
FULL OUTER JOIN - combines the records of both left and right joins and fill in NULLs for the missing records matches on either side. you need to use caution with FULL OUTER JOINs becuase not all database systems support this but they do support UNIONS so you will have to write a left and right join with a union.
Mining Algorithms:
Apriori - an algorithm for association rules - aka association rule mining, given a set of itemsets (for instance, sets of retail transactions, each listing individual items purchased), the algorithm attempts to find subsets which are common to at least a minimum number C of the itemsets. Apriori uses a "bottom up" approach, where frequent subsets are extended one item at a time (a step known as candidate generation), and groups of candidates are tested against the data. The algorithm terminates when no further successful extensions are found.
1. Define a private static attribute in the “single instance” class.
2. Define a public static accessor function in the class.
3. Do “lazy initialization” (creation on first use) in the accessor function.
4. Define all constructors to be protected or private.
5. Clients may only use the accessor function to manipulate the Singleton.
public class Singleton {
private static final Singleton INSTANCE = new Singleton();
// Private constructor prevents instantiation from other classes
private Singleton() {}
public static Singleton getInstance() {
return INSTANCE;
}
}
zaphod is correct about 1.4 to 5 there are more changes like the use of comparator(this is for creating custom sorts). anonymous - i have been in this field for about 3 years now and still feel like a jr. level developer, and thats what i am, it takes 5 to 8 years to really get java coding down to be looked at by sr. level developers as someone that is an expert or at least advanced - someone that they can count on to do more complex work with little asst. plus help train more jr. developers(this is very important if you see yourself moving forwrd - i have seen many developers not make it forward due to their soft skills). I posted these statements so that others will understand what to study for when intervewing. believe it or not, this is a standard question i have been asked by many different companies. This is a test to see, how much of the language you really understand. So studying the difference between the different versions is very improtant becuase one day you will be on a project that is upgrading from one version to the other and you need to know what are the differences.
- biggied88 March 04, 2010its not that ridiculous becuase they want to know if you are keeping up with the new java enchancements. This is what is known as a "feel-out" question - they basically want to know if your studying the language that you are applying for. I am sure this is a standard question for other languagues also - like it this was a .Net role - then they would ask what are some of the newer improvements for .Net
This is a field were there is continous improvements going on
The question is about collisions; not which collection is thread safe. Threading can cause collisions for a specific collection type. So the question is asking: how does threading cause a collision? plus, name another way in a collection could become vulnerable to collisions? which collection type is more vulnerable to collisions? what is a collision? how does the Collection API, deal with making collisions somewhat safe for the specific collection(that is vulnerable to collisions)? Also, i left out, how would you write code to help deal with collisions?
- biggied88 March 03, 2010Spring IOC is Inverson of Control.
Definition of IoC - this is a principle of describing an aspect of some software architecture designs in which the flow of control of a system is inverted in comparison to procedural programming.
Spring IoC - container is where the BeanFactory interface is located. IoC takes the responsibility for making things happen into the framework away from the java code.
Basically, with spring a lot of the navigation, transitions, etc.. are moved into the XML files and the java code is used for the actual code logic. IoC is the mechanism that makes that happen.
Example: you create a backing-bean for a JSP that processes a search. the java code will hold the logic process the search the XML files will hold the logic for the page navigation(if the search is successful/error/non successful what to do) plus they wire the dependencies to other classes - etc...
I knew the answer - i just wanted others to think about it. my answer was:
1. the deconstructor is a C or C++ function for closing the resources - i.e. garbage collection. Java does not use a deconstructor but uses garbage collection to handle closing resources. In java you request- not force or push - this mechanism through calling system.gc().
matching exception in java, is an exception-handling that looks for the nearest exception handler. Example:
- biggied88 March 15, 2010Class Dodge extends Car{
public void someMethod throws Dodge(){
try{
throw new Dodge();
}catch(Car e){
}
public void getSomeMethod(){
try{
this.someMethod();
}catch(Dodge e){
//some code
}catch(Car e){
//some code
}
}
}
}
If you take the Dodge exception catch out of the second method. The Car exception would still be caught becuase it is the base class. This is useful because if you decide to add more exceptions to a method, if they’re all inherited from the same base class then the client programmer’s code will not need changing, assuming they catch the base class, at the very least.
I guess unmatched exceptions are when you do not have a base class or do not implement a catch for the base class.