PLEASE NOTE: Do not publicly post your answers on this Gist, please forward them to your recruiting contact instead ;-)
Each voter can vote in zero or more referenda. Each referendum has one or more questions, and each question is a yes/no vote. Write the simplest normalized schema to describe this in generic SQL statements or as an entity-relationship diagram. Point out where the indexes would be if you want to quickly know the results of a given referendum question, but you never expect to query a single voter's voting record. In what way does the nature of the application affect your design judgment about privacy, and what effect would that have on normalization considerations?
You've getting ready to submit a pull request to the coolapp repo. You branch contains two commits: M, followed by N. The lineage is this:
main: X --> Y --> Z (HEAD commit is Z)
\
your-branch: M --> N (HEAD commit is N)
You want to contribute the code back to the official coolapp repo, but you realize there is a really dumb typo in one of your source code comments (not commit messages) in commit M. You'd still like to submit the pull request as two commits M' and N', where M' is the fixed version of M, and N' is the same exact diff as N. How do you rewrite git history to make this happen? Is N' the same hash as N? Why or why not?
Write a sample application that does the following:
- Creates a SignalR hub that exposes at least one server method with complex data types in its signature
- Establishes a connection to the SignalR hub to one or more clients and sending a complex object
complexObj
to all of the clients at once. From the clients’ point of view, how is the receipt of the object handled? - Invokes a named method
clientMethod(complexObj)
on a single connected client
You need to write a server that can handle hundreds or even thousands of chat conversations simultaneously. You have chosen to model this with Conversation
objects, each of which contains a list of ConversationLog
(timestamp + participant name + message) objects. Each Conversation
can be updated concurrently by the multiple participants in that conversation by adding new ConversationLog
entries to the Conversation
.
Write .NET code that accomplishes the following:
- Defines the data classes
Conversation
andConversationLog
that hold the conversation data. TheConversation
object must be able to receive newConversationLog
entries without blocking. The order of new conversation log entries is important! - Defines a third class, whose name is not specified, that houses the list of all
Conversation
objects. This class should allowConversations
to be added or removed from it in a thread-safe manner.
A UsersList
component should display a list of users. Once we click on one user, a profile information needs to be displayed, however there's a bug and the profile information is not shown correctly.
a) Identify the cause of the profile issue and describe how it could be corrected.
b) Where is the best place in the UsersList
component to call getAllUsers
?
import React from 'react';
import { getUserDetails, getAllUsers } from './requests';
class UsersList extends React.Component {
constructor(props) {
//...
}
//...
handleUserSelection = (userId) => {
this.setState({userId});
getUserDetails(this.state.userId, this.handleUserDetailsResponse);
}
//...
render() {
return (
<div>
{/* ... */}
</div>
);
}
}
The class below contains information about users assigned to operators.
a) Identify 2 bugs in the Operators
class.
b) How would you implement the getNumberOfUsersPerOperator
method?
export default class Operators {
constructor() {
this.operatorsInfo = {};
this.addUserToOperator = this.addUserToOperator.bind(this);
}
//...
addUserToOperator(userId, operatorId) {
operatorsInfo[operatorId] = [...operatorsInfo[operatorId], userId];
}
getNumberOfUsersPerOperator() {
//...
}
}