Microsoft Interview Question for Software Engineer in Tests






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

Using connection points and containers.

- ashishkaila@hotmail.com November 21, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Two software development teams had a meeting and the records of events created there are more possible events, these events are,

gather requirements represented by 'G',
Merge requirements represented by 'Y',
redesign requirements represented by 'R',
solve represents by 'S'.

G, Y, R represented as (employee-name)(timesevent-name)
S represented as (employee-name)(timesevent-name)(second-employe-name)
Time is represented in minutes from the start of the meeting, meetings is divided into 2 half 45min each that can be representation of time
The first is reqular time which is represented as a single integer, which is time for ex: 45
Second is additional time, which is represented as (time+extra-time)for ex: 45+2.

- suresh August 27, 2020 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

class Result {
static class Score{
int actualTime;
String timeString;
String teamName;
String playerName;
String substituteName;
char eventType;
boolean isFirstHalf;
public Score(int actualTime, String timeString, String teamName,String playerName,String substituteName,char eventType, boolean isFirstHalf){
this.actualTime = actualTime;
this.timeString = timeString;
this.teamName = teamName;
this.playerName = playerName;
this.substituteName = substituteName;
this.eventType = eventType;
this.isFirstHalf = isFirstHalf;
}
public String toString(){
return actualTime + " " + timeString + " " + teamName + " " + playerName +" " + substituteName + " "+ eventType +
" " + isFirstHalf;
}
public String getOutputString(){
return this.teamName +" " + this.playerName + " " + this.timeString + " " + this.eventType + " " + this.substituteName;
}
}
static Map<Character, Integer> map = new HashMap<>();
public static List<String> getEventsOrder(String team1, String team2, List<String> events1, List<String> events2) {
map.put('G', 1);
map.put('Y', 2);
map.put('R', 3);
map.put('S', 4);
List<Score> scores = new ArrayList<>();
for(String e1: events1){
Score score = parseString(e1, team1);
scores.add(score);
System.out.println(score);
}
for(String e2: events2){
Score score = parseString(e2, team2);
scores.add(score);
System.out.println(score);
}
Collections.sort(scores, new Comparator<Score>(){
public int compare(Score s1, Score s2){
if(s1.isFirstHalf== true && s2.isFirstHalf==false){
return -1;
}
if(s1.isFirstHalf== false && s2.isFirstHalf==true){
return 1;
}
if(s1.actualTime != s2.actualTime)
return s1.actualTime - s2.actualTime;
if(map.get(s1.eventType)!= map.get(s2.eventType)){
return map.get(s1.eventType)- map.get(s2.eventType);
}
if(!s1.teamName.equals(s2.teamName))
return s1.teamName.compareTo(s2.teamName);
return s1.playerName.compareTo(s2.playerName);
}
});
List<String> answer = new ArrayList<>();
for(Score score: scores){
answer.add(score.getOutputString().trim());
}
return answer;

}
public static Score parseString(String str, String team){
String[] words = str.split(" ");
int time = getTimeIndex(words);
char event = words[time+1].charAt(0);
String player = "";
for(int i=0;i<time;i++){
player = player + " " + words[i];
}
player = player.trim();
String sub = "";
if(event=='S'){
for(int i =time+2;i<words.length;i++){
sub += words[i] + " ";
}
sub = sub.trim();
}
int actualTime =0;
boolean isFirstHalf = false;
if(words[time].contains("+")){
String timeSplit[] = words[time].split("\\+");
actualTime += Integer.parseInt(timeSplit[0]);
if(actualTime <= 45){
isFirstHalf = true;
}
actualTime += Integer.parseInt(timeSplit[1]);
}else{
actualTime += Integer.parseInt(words[time]);
if(actualTime <= 45){
isFirstHalf = true;
}
}
Score score = new Score(actualTime, words[time], team, player, sub, event, isFirstHalf);
return score;
}
public static int getTimeIndex(String[] words){
for(int i =0;i<words.length;i++){
if(words[i].charAt(0)>='0' && words[i].charAt(0)<='9'){
return i;
}
}
return -1;
}


}

- Anonymous February 18, 2024 | Flag Reply


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