Are You Smarter than EINSTEIN (Weekly Question Series)

 

 

Ques. Added on 23 May, 2008

Question 01.

 

Write a query to delete the redundant / repeated values from Emp table.

 

For Example:

 

Emp Table

 

Emp ID

Emp Name
1 Anil
2 Chetan
3 Sunil
3 Sunil
1 Anil
4 Neha
5 Abhishek
6 Akanksha

 

After the successful execution of query the resultant table would be

 

Emp ID

Emp Name
1 Anil
2 Chetan
3 Sunil
4 Neha
5 Abhishek
6 Akanksha

 

NOTE: Above table is for reference only.

» send this link to a friend

Ques. Added on 13 May, 2008

Question 02.

 

  • There is a table ‘test‘ with columns (‘id’ number, ‘value’ varchar(15))
  • It has many-to-many relationship between columns .(both the columns can have redundant data)
  • The column ID has a numeric Data.
  • Write a Query to find out all those values in the column "VALUES" that are common to all the distinct value in column "ID"

 

For Example:

 

 

Result : ‘X and Z’ would be the values which are common in all three distinct IDs(1,2,3).

 

NOTE: We have got lots of responses, given below is the most common mistake. Reason being that we don't know the Number of IDs in Column "ID"

 

  • select distinct a.value from test a, test b, test c where (a.id <> b.id and a.id <> c.id and b.id <> c.id) and (a.value = b.value and a.value = c.value)

 

» send this link to a friend

 

Ques. Added on 6 May, 2008

Question 03.

 

 

  • There is a Singly linked list L.
  • We have Pointer P to the node C of the list.
  • We don't have any other pointer to linked list.
  • There is pointer P1 to the node D

 

Now the challenge is to insert the node D before the node C of linked list.

 

NOTE: Don't consider that we have the head pointer to the linked list.

 

» send this link to a friend

 

 

If you have more question like this Please send them to us at einstein@kleward.com or

Click here to submit your Question

 

 Send this page to your friend

 

 

 

 

 

 

Best features to meet
challenging cases

 Read More

 

 

We are looking for expert in My Faces and Rich Faces Application Development

 Read More