Salesforce Interview Question
Software Engineer / DevelopersCountry: United States
Interview Type: Written Test
ya?
The core data structure of Btrfs — the copy-on-write B-tree — was originally proposed by IBM researcher Ohad Rodeh at a presentation at USENIX 2007. Chris Mason, an engineer working on ReiserFS for SUSE at the time, joined Oracle later that year and began work on a new file system based on these B-trees
Can anyone comment as to how the remote programming assignment went? Can you use your own environment? Do they watch you for the whole 2-hours? Thanks!
2 hour Online Coding Test - They gave a sample frame code having 4 methods -> Makefriends(), removeFriends(), getDirectFriends(), getIndirectFriends(). Have to implement these methods. Also create unit testcases to check conditions.
Have to build on the frame sample code they provide and send back the zip implementation in 90 mins. Then they will call back to discuss the logic.
i just took the same test at salesforce. the interviewer calls you ahead talks to you for 10 mins or so, makes sure you understand the problem statement correctly..
after that, you can use the editor of your choice to implement the solution.. and when you are done, just email the program/project to the interviewer.
Did you receive the same question with this? It seems this question is about implementing a kind of shell rather than file system, doesn't it?
Writing a b-tree implementation may take more than 2 hours ..
Would it be OK to write a list- based implementation of the shell or should it be B-Tree .
c# does not have a good library APi for B-Tree or balanced trees.
2 hour Online Coding Test -
They gave a sample frame code having 4 methods -> Makefriends(), removeFriends(), getDirectFriends(), getIndirectFriends(). Have to implement these methods. Also create unit testcases to check conditions.
Have to build on the frame sample code they provide and send back the zip implementation in 90 mins. Then they will call back to discuss the logic.
This will require N+ tree to represent Directory
public class Node {
public string nodeName { get; set; }
List<Nodes> ChildNodes {get; set; }
public FileType fileType {get; set;}
public Stream dataFile { get; set; }
// constr
Node(string nodename, List<Node> nodes, FileType fileType, Stream filestream)
{
...
}
}
enum FileType {
text,
data,
folder,
...
}
ICommand {
void Execute(string[] args);
}
public class CommandFactory {
public ICommand GetCommand(Directory dir, string cmd, params string[] args)
{
Validate(cmd ) // validate command
switch(cmd)
{
case "ls" :
return LsCommand( ... );
break;
case "cd" :
return CdCommand(...);
break;
default :
throw error;
break;
}
}
}
main (args ){
// create directory
Node rootDir = new Node();
ICommand cmd = CommandFactory( rootDir, cmd, args);
cmd.Execute();
}
LsCommand {
// constructor
LSCommand( ... , .. .., _ ) {}
void Execute( ,... , ... , ... )
{
/// ls command execution
go over each node and print all names of nodes
// if -l
print only with filetype Directory
}
}
- KunalP February 29, 2016