Interview Question


Country: United States




Comment hidden because of low score. Click to expand.
1
of 1 vote

Use 3 entities:
0. Candidate
1. Voter
2.Poll

Polling table will have VoterFK, CandidateFK & PollDate among other fields.
VoterFK, CandidateFK & PollDate must be a non-nullable fields
The composite key (VoterFK, PollDate) should be UNIQUE

Better yet, Candidate and Voter tables can be merged to form a Student table with a 'type' field that distinguishes a voter from a candidate contesting in an election. The 'type' field also provides the flexibility for a student to switch roles between a voter and a candidate at different points of time.

- Murali Mohan July 19, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

But if we merge "Voter" and "Candidate" table into a single "Student" table then we can not achieve that one user can vote for one person standing for one post only.

So the best solution is to make 3 tables as above. {Candidate, Voter, Poll}

- Nabeel Asif September 05, 2013 | Flag


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More