Monday, February 6, 2017

C# Study Guide: Expanded (~70 pages)


C# and Stuff Study Guide!

I made a study guide for keeping up to date, for students / beginners, and for those who want a guide to brush up on topics for interviews. As a long time med student.. I like to know there is somewhat of a limitation to "everything" you need to know as a foundation in order to be ready for almost any job. I tried to make this guide exactly that. Of course, you will need additional skills / libraries.. but this is the basic core and I would assume if you knew all (*by know, I mean understand AND be able to implement AND explain well during an interview) of this you could get a job and succeed. This is most up to date as of February 2017.. as tech goes, things will change slightly over time and new things will be added that will not be on this sheet. I made a similar post before when this guide was around 20-30 pages and it has since grown.

Keep in mind: I am a C# web developer. I included heavy C# (~60% of the guide), design patterns / lower level JIT compiler / garbage collection / boxing / unboxing type info (~20% of the guide). I have JavaScript and SQL info on here (~10% of the guide). I have random general stuff you just should know which is the last bit. I did not cover algorithms, data structures, or C++.. I honestly haven't needed it for a web development career. I did not cover Java, WPF, desktop/mobile application type things.

One more note: Interviews vary A LOT. This guide would have been immensely helpful for my first 4 jobs. If I had known all of this, I would have aced them all with maybe one or two things missed.. if that. This guide was not the least bit helpful for my current position at Microsoft which aimed thinking questions that you cannot find online that were tailored to my experience and my resume. You should always know everything on your resume, be able to explain it, and be able to explain why a technology was used (versus a competing one plus why it suits your companies needs well). You should also be able to answer any questions about how to implement new features into your working environment, understand why/how things are done now, and how they could be done better.

My approximately all-inclusive study guide is hosted on my Google Docs (it's a .docx file) because it is too large to share on a blog post:
C# and Stuff Study Guide!

Favorite (no-tricks all logic) puzzles

None of these are puzzles I made up, these are puzzles that are relatively well known and easily found on the Internet. I don't like puzzles with gotcha tricks-- such as har har I gotcha, you read the question too fast. These are some solid logic puzzles.

  1. Water bucket 3L, 5L
    You have a 3 and a 5 litre water container, each container has no markings except for that which gives you it's total volume. You also have a running tap. You must use the containers and the tap in such away as to exactly measure out 4 litres of water. How is this done? Can you generalise the form of your answer?
    Answer Here

  2. Chicken fox corn
    A man has to get a fox, a chicken, and a sack of corn across a river. He has a rowboat, and it can only carry him and one other thing. If the fox and the chicken are left together, the fox will eat the chicken. If the chicken and the corn are left together, the chicken will eat the corn. How does the man do it?
    Answer Here

  3. Light bulb puzzle
    Suppose that you are standing in a hallway next to 3 light switches, which are all off. There is another room down the hallway, where there are 3 incandescent light bulbs – each light bulb is operated by one of the switches in the hallway. Because the light bulbs are in another room, you can not see them since you are standing in the hallway. How would you figure out which switch operates which light bulb, if you can only go the room with the light bulbs one time, and only one time?
    Answer Here

  4. Light bulb puzzle
    You have two ropes and a lighter. Each rope has the following property: If you light one end of the rope, it will take one hour to burn to the other end. They don't necessarily burn at a uniform rate. How can you measure a period of 45 minutes?
    Answer Here

  5. Light bulb puzzle
    You have two ropes and a lighter. Each rope has the following property: If you light one end of the rope, it will take one hour to burn to the other end. They don't necessarily burn at a uniform rate. How can you measure a period of 45 minutes?
    Answer Here

  6. Counterfeit coin weighingThere are eight identical-looking coins; one of these coins is counterfeit and is known to be lighter than the genuine coins. What is the minimum number of weighings needed to identify the fake coin with a two-pan balance scale without weights?
    Answer Here

  7. Prisoners hats puzzle According to the story, four prisoners are arrested for a crime, but the jail is full and the jailer has nowhere to put them. He eventually comes up with the solution of giving them a puzzle so if they succeed they can go free but if they fail they are executed. The jailer seats three of the men into a line. The fourth man is put behind a screen (or in a separate room). He gives all four men party hats. The jailer explains that there are two black hats and two white hats, that each prisoner is wearing one of the hats, and that each of the prisoners see only the hats in front of him but neither on himself nor behind him. The fourth man behind the screen can't see or be seen by any other prisoner. No communication among the prisoners is allowed. If any prisoner can figure out what color hat he has on his own head with 100% certainty (without guessing) and tell the jailer, all four prisoners go free. If any prisoner suggests an incorrect answer, all four prisoners are executed. The puzzle is to find how the prisoners can escape, regardless of how the jailer distributes the hats.
    Answer Here

  8. Bridge crossing efficiency puzzle Adam, Bob, Clair and Dave are out walking: They come to rickety old wooden bridge. The bridge is weak and only able to carry the weight of two of them at a time. Because they are in a rush and the light is fading they must cross in the minimum time possible and must carry a torch (flashlight,) on each crossing. They only have one torch and it can't be thrown. Because of their different fitness levels and some minor injuries they can all cross at different speeds. Adam can cross in 1 minute, Bob in 2 minutes, Clair in 5 minutes and Dave in 10 minutes. Adam, the brains of the group thinks for a moment and declares that the crossing can be completed in 17 minutes. There is no trick. How is this done?
    Answer Here

  9. Dragon and Knight puzzle Lets consider a dragon and knight live on an island. That island has seven poisoned wells, which is numbered 1 to 7. If you drink from a well, you can only save yourself by drinking from a higher numbered well. The Well whose is number 7 is located at the top of a high that mountain, so only the dragon can reach it. One day they decide that the island isn't big enough for the two of them, and they have a duel. Each of them brings a glass of water to the duel, they exchange glasses, and drink. After the duel, the knight lives and the dragon dies. Why did the knight live? Why did the dragon die?
    Answer Here

  10. Quarters puzzle There are twenty-six coins lying on a table in a totally dark room. Ten are heads and sixteen are tails. In the dark you cannot feel or see if a coin is heads up or tails up but you may move them or turn any of them over. Separate the coins into two groups so that each group has the same number of coins heads up as the other group. (No tricks are involved.)
    Answer Here

Unit Tests Moq: Verify Number Times Called

The format for the number of times a moq method is called:

// Arrange
someSystem.Setup(x => x.MyMethod(It.IsAny(), It.IsAny())).Returns(Task.CompletedTask);              

//Act             
IList newAlerts = em.ReplaceAlerts(alerts, mockedSystem.Object);              

// Assert
someSystem.Verify(x => x.MyMethod(It.IsAny(), It.IsAny()), Times.Once);