views:

69

answers:

2

Hi all expert,

Pls give me the solutions for this two problem, which i was asked recently in interview.

Prob1: Suppose I have application with 10 admin, so they can change the data anytime their having own userid and password. For example, one user retrieve one data from database table, while retrieving it value was 2, after retrieving he didn't update the update button, then he went for breaks for 10 minits. In between other admin change the original database table with value 3, 4, 5 and Finally 10 value by the 10th admin. Now the current value in table 10. But when he comes from breaks and click on the update button value 2 will be saved, which is not at all expected value..it should be 10. How to approach to this problem????

Prob2: Suppose one user forget to logout his application while he was leaving for the day. And after 10 minits while he reached his house, due to urgency again he wants to open that application from his home computer. If he tries to login to the application in that period what will happen????(Session timeout was 30 Mints). If its a problem how to overcome this????

Pls give me the solutions......pls...pls

Thanks, Sumit

+1  A: 

The first problem is to do with dealing with database concurrency, see this blog post for a good explanation.

Two isn't really a problem, as he will simply login from his home computer and create a new session. Most web apps support multiple same user sessions. If that's not the behaviour you want, you have to do some work. Not if that is the desired behaviour.

Wim Hollebrandse
+1  A: 

Prob_1: Unless there is a lock-in approach to editing the data (the data is locked when you read it and untill you're done no-one can edit, in that case the other admins wouldn't have been able to edit while our guy was on his coffee-break) when the guy comes back and updates the values (assuming that all the values currently on screen will be overridden when click update on this app) there's no reason why the value you're talking about should not be 2.

Nevertheless, said so I suspect that:

  1. my answer doesn't make any sense - I am trying to interpret your question to my best but there's good chances smt is getting lost in translation.
  2. the interviewers wanted you to say something about the session timeout which expires during the coffee-break

Prob_2: this is a standard problem of web-apps. In asp.net there's plenty of ways of checking if a given user is already logged in leveraging global.asax. Here's a tutorial with all the answers - knock yourself out :)

JohnIdol