Q.1 Sort a link list of 0's, 1's and 2's. Or something similar.

Q.2 Find the second smallest number to a given number in a tree.

Q.3

Q.2 Find the second smallest number to a given number in a tree.

Q.3

Q.1 Sort a link list of 0's, 1's and 2's. Or something similar.

Q.2 Find the second smallest number to a given number in a tree.

Q.3

Q.2 Find the second smallest number to a given number in a tree.

Q.3

Labels:
Algorithms,
Amazon,
Aptitude,
career,
Chennai,
Collections,
Core Java,
Delhi,
interview,
J2EE,
java,
job

Q. Find median of two sorted arrays?

Labels:
Algorithms,
Belzabar,
career,
Collections,
Core Java,
Delhi,
Dwarka,
interview,
IT,
J2EE,
java,
job

Q.1 How to use Comparator with collection?

Q.2 What is a serializable object? How to use it? When is it used? Is it used over networks?

Q.3 What are immutable objects?

Q.4 What is the big deal with java 1.5?

Q.5 If HashTable was always there, why come up with a HashMap?

Q.6 SQL query to get the second largest element in a table?

Q.2 What is a serializable object? How to use it? When is it used? Is it used over networks?

Q.3 What are immutable objects?

Q.4 What is the big deal with java 1.5?

Q.5 If HashTable was always there, why come up with a HashMap?

Q.6 SQL query to get the second largest element in a table?

Lots of questions about enums and static imports.

How to intialize Locale.

How to intialize Locale.

Section 1

Q.1 WAP to print the sum of characters in a String. Assuming that A=1, B=2, C=3.....So DAD will be 4+1+4=9.

Q.2 Make a HashMap for the class Student.

class Student

{

String name;

Date dateOfBirth;

Integer fees;

}

Q.3 Given a series :

GGG

RRR

BBB

Convert it into:

GRB

GRB

GRB

Q.4 Given an array of positive, negative and zero's. Arrange the array such that all negative numbers are on the left, zeroes in the centre and positive numbers in the right.

Section - 2

Q.1 Create a database(tables) for the given relationship. Do not draw ER diagrams.

A group may have many challenges. A challenge can have many users. A user can have many challenges.

Q.1 WAP to print the sum of characters in a String. Assuming that A=1, B=2, C=3.....So DAD will be 4+1+4=9.

Q.2 Make a HashMap for the class Student.

class Student

{

String name;

Date dateOfBirth;

Integer fees;

}

Q.3 Given a series :

GGG

RRR

BBB

Convert it into:

GRB

GRB

GRB

Q.4 Given an array of positive, negative and zero's. Arrange the array such that all negative numbers are on the left, zeroes in the centre and positive numbers in the right.

Section - 2

Q.1 Create a database(tables) for the given relationship. Do not draw ER diagrams.

A group may have many challenges. A challenge can have many users. A user can have many challenges.

Labels:
Algorithms,
career,
Collections,
Database,
Delhi,
interview,
IT,
J2EE,
java,
job,
Noida,
Noida Extension

Sonata

Q.1 Tell me about your project?

Q.2 Design patterns (structural, behavioural)?

Ans. Business delegate and MVC are incorrect answers.

Hint# Related to JavaEE

Q.3 Best sorting technique?

Q.4 Space and time complexity of merge sort?

Q.4 Where does log (n) comes in merge sort?

Q.5 Why is public satic void main(String args[]) so?

Q.6 What if we change pulic to private or protected?

Q.7 Why is main static?

Q.8 Could the return type of main be int?

Q.9 Scope of beans?

Ans. Singleton, prototype, global, etc.

Q.10 How to define singelton bean without sring framwork?

Q.11 Can we have setter and constructor injection?

Q.12 What is inversion of control, Spring ?

Q.13 Can we have two items.xml files in a project?

Q.14 Can we have two spring.xml files in a project?

Q.15 What is the tag by which we create a relationship between two id's/components in an items.xml files?

Q.14 How many extensions are there in hybris? How many have you worked upon?

Q.1 Tell me about your project?

Q.2 Design patterns (structural, behavioural)?

Ans. Business delegate and MVC are incorrect answers.

Hint# Related to JavaEE

Q.3 Best sorting technique?

Q.4 Space and time complexity of merge sort?

Q.4 Where does log (n) comes in merge sort?

Q.5 Why is public satic void main(String args[]) so?

Q.6 What if we change pulic to private or protected?

Q.7 Why is main static?

Q.8 Could the return type of main be int?

Q.9 Scope of beans?

Ans. Singleton, prototype, global, etc.

Q.10 How to define singelton bean without sring framwork?

Q.11 Can we have setter and constructor injection?

Q.12 What is inversion of control, Spring ?

Q.13 Can we have two items.xml files in a project?

Q.14 Can we have two spring.xml files in a project?

Q.15 What is the tag by which we create a relationship between two id's/components in an items.xml files?

Q.14 How many extensions are there in hybris? How many have you worked upon?

15 question. 45 minutes.

Objective questions. However, there is no strict marking scheme. Any guess made will be questioned in interview.

First perform 5 races to find the top 5.

Then perform a race to find the fastest horse.

Now discard the original buckets of 2nd, 3rd, 4th and 5th horse from the 6th race as they can never give top three fastest horses and we already have the fastest horses from these pool. Also, discard the 4th and 5th horse of 6th race.

So, we are left with four horses from the pool of winner of 6th race and the second and third of 6th race i.e. total of 6 horses.

Now either the 2nd and 3rd of 6th race are the 2nd and third fastest or the 2nd or 3rd of the winner of 6th race are the 2nd and 3rd fastest.

So, discard the 4th and 5th of the original bucket of winner of 6th race.

Now, we are letf with only four horses. 2nd and 3rd of 6th race and 2nd and 3rd of the original bucket of winner of 6th race.

Perform a race of these four horses and get the second and third.

This edge can be in any one of 8 positions. Similarly, the top edge can occupy any one of 8 positions for a 1 x 1 square. So the total number of 1 x 1 squares = 8 x 8 = 64. For a 2 x 2 square the lefthand edge can occupy 7 positions and the top edge 7 positions, giving 7 x 7 = 49 squares of size 2 x 2. Continuing in this way we get squares of size 3 x 3, 4 x 4 and so on. We can summarize the results as follows: Size Of square Number of squares --------------- ----------------- 1 x 1 8^2 = 64 2 x 2 7^2 = 49 3 x 3 6^2 = 36 4 x 4 5^2 = 25 5 x 5 4^2 = 16 6 x 6 3^2 = 9 7 x 7 2^2 = 4 8 x 8 1^2 = 1 --------------- Total = 204 There is a formula for the sum of squares of the integers 1^2 + 2^2 + 3^2 + ... + n^2 n(n+1)(2n+1) Sum = ------------ 6 In our case, with n = 8, this formula gives 8 x 9 x 17/6 = 204. As an extension to this problem, you might want to calculate the number of rectangles that can be drawn on a chessboard. There are 9 vertical lines and 9 horizontal lines. To form a rectangle you must choose 2 of the 9 vertical lines, and 2 of the 9 horizontal lines. Each of these can be done in 9C2 ways = 36 ways. So the number of rectangles is given by 36^2 = 1296.

6, 15, 35, 77, 143, ___

6 = 2*3

15 = 3*5

35 = 5*7

77 = 7 *11

The pattern is that the terms are products of two prime numbers and where one of the prime numbers increases to the next one in the following term Hence:

11*13 = 143

13*17 = 221 etc

We wish to find the number of zeros at the end of 1000! = 1000*999*998*997*....*4*3*2*1

We examine the factors of 1000! to see which can be used to produce multiples of 10.

For 1000!, each multiple of 5 - taken together with some even number - contributes a multiple of 10. Each multiple of 25 - taken together with some multiple of 4 - contributes two multiples of 10. Each multiple of 125 - taken together with some multiple of 8 - contributes three multiples of 10.

We can count each multiple of 5 in 1000! once. Then we can count each multiple of 25 in 1000! once in order to altogether count each multiple of 25 twice. Then we can count each multiple of 125 in 1000! once in order to altogether count each multiple of 125 thrice.

There are 1000/5 = 200 multiples of 5 in 1000!

There are 1000/25 = 40 multiples of 25 in 1000!

There are 1000/125 = 8 multiples of 125 in 1000!

Adding them together, we have 200+40+8 = **248 zeros** at the end of 1000!.

1: Englishman 1 calls the guy who knows french, and tells his secret

2: Englishman 2 calls the guy who knows french, and tells his secret

3, 4: The guy who knows french calls two of the Frenchmen and collects their secrets

5: The guy who knows french calls the last Frenchman and collects his secret (thus gaining all the secrets) and tells the Frenchman all the secrets he knows (so the Frenchman has all the secrets).

6-7: the Frenchman calls his fellow Frenchmen and discloses all the secrets

8-9: The guy who knows french calls his fellow Englishmen and discloses all the secrets.

I) First give a discount of x% on p. Then add a tax of y% on the result.

II) First add a tax of y% on p. Then provide a discount of x% on the result.

X 1 X

2 3 4

5 6 7

X 8 X

X 7 X

3 1 4

5 8 6

X 2 X

I had accidentally solved it thinking they are asking about rook not knight (and marked 8 as my answer). Corrected my mistake and gave this design.

k k k

k k

k k k

and so on i.e. putting knights after leaving a block which gives us 64/2 = 32 knights.

Explaining the entire history of StringBuffer and StringBuilder did not cut any ice. Saying that since all the primitive types and there corresponfing wrapper classes are immutable as well so String was made immutable to give it a primitive like 'look and feel', was not much correct as well. Later, he explained that if it were not immutable how would you create a pool of String. It had something to do with saving heap space and getting it thread-safe.

Explained that serializable is used to bring objects in a persistance state so that they maybe written in a file. You can serialize by implementing the Serializable interface. Using toString() will simply return a String <Class Name>@<hashcode>, so there must be another mechanism.

Can't believe it started from something as innocent as Set.

Q.11 What are the conditions/ restrictions on overriding a method?

Me. The child class must have the access specifier that is less restricitve or same as parent method. Example if parent class has its method specified as protected, then the child class can make it either public or protected.

Him. Why is that? Why not more restrictive?

Me. After thinking the hell out of my brain. When you override a method you make a refernce of parent type. Initialize it with the object of child type and then call an overridden method using that reference. Now, if it were more restricitive. Then calling the overridden method would result in an exception.

Him. During runtime or compile time?

Me. During runtime. That's when overriding comes into play.

Q.12 You work on Spring. Right?

Me. Aye. I do.

Him. All that controller and servlets. Okki. So if you define a global variable,which acts as a counter in your servlet and 50 requests are made to that servlet then what will be value of that counter at the end of all the requests. All requests are coming simultaneously.

Me. That vaiable is static. Ain't it!!

Him. Does that even matter?

Me. Yeah. Coz the servlet will make multiple threads.

Him. But the object will still be the same. Isn't it. The container creates one object for a servlet and then that servlet can have many threads sharing the same variable space.

Me. Then we can't say what will be the final value as it is not thread safe.

Him. What can we do to make it thread safe?

Me. Put it into synchronized block.

Him. Any other method?

Me. No idea.

Him. Actually there is a keyword atomic which puts the variable in locations which are thread safe.

Q.13 Anything you wanna ask me ?

Me. What is unicommerce?

Him. ITs a company founded around 1.5 years ago. We provide services for inventory management and eommerce.

Thanx.

Now comes the final nail in my coffin.

Soooooooooooooo, we will contact you later.

I know. I have heard it many times.

Labels:
Aptitude,
career,
Delhi,
interview,
J2EE,
java,
job,
Servlet,
Spring,
Threading,
unicommerce

Subscribe to:
Posts (Atom)