注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
本帖最后由 kuailezhish 于 2020-9-18 09:37 编辑
前两天刚参加完Indeed Karat的电面,确实问的大多数都是地里面经的题目,楼主也来分享一下面试准备的题,希望能够帮助到大家,以及楼主新人很多帖子看不了,请大家大米支持下哈!
流程:
* Self-Introduction (~ 1 min)
* Q & A (~ 10 min) (choose 2 fields, about 3 problems in every field)
* Coding (2 ~ 3 problems) with time and space complexity analysis
Q & A 环节: (楼主投的是后端工程师,给的这些领域,地里有小伙伴说可能还有其他的类型?)
1. Web application
Building user interfaces for web services and sites
2. Production issues
Diagnosing problems with production services
3. System internals
How computers manage and allocate resources like CPU and memory
4.OOP
Best practices for building classes and systems of classes
5.Testing
Validating code and related concerns
五选二,楼主之前准备的是System internals和OOP,总体上就是根据自己的准备知识,尽量说就可以了。
贴一下楼主尽可能整理的问题和答案(不一定很准确,大家参考着自己习惯的知识上靠吧),希望能够帮助大家:
System Internals:
1 Graph(CPU usage, RAM usage), 大概就是随着time,CPU资源消耗不变, increase; How to detect; What could cause that; How to resolve?
maybe memory leak, try to find
2 Memory Leak, how to solve?
Memory Leak: some objects are referenced, but not used
Symptoms of a Memory leak: Works fast at first, but slows over time; OutOfMemoryError after runing; There are occasionally crashes in the applications.
Why
1. Memory Leak Through static Fields
2. Through Unclosed Resources
3. Improper equals() and hashCode() Implementations
Handle:
1. Enable Profiling: Java profilers are tools that monitor and diagnose the memory leaks through the application.
2. Verbose Garbage Collection: enable verbose garbage collection to track detailed trace of GC
3. use tools like Eclipse to show warnings and errors whenever it encounters obvious cases of memory leaks
4. use benchmarks to measure and analyze the Java code's performance after changed code.
5. Code Reviews
3 Connection Pool Timeout
4 Thread Exhausion
5 How do you know if you can handle 1k requests per second (now it's 1 request per second)
6 操作系统中进程和线程的区别。
Both processes and threads are independent sequences of execution. The typical difference is that threads (of the same process) run in a shared memory space, while processes run in separate memory spaces.
Each process provides the resources needed to execute a program. Each process is started with a single thread, often called the primary thread, but can create additional threads from any of its threads.
A thread is an entity within a process that can be scheduled for execution.
7 What is garbage collection
Once an object is no longer referenced and therefore is not reachable by the application code, the garbage collector removes it and reclaims the unused memory.
8 stack vs heap
9 How to communicate between threads? How to communicate between processes?
10 What is the difference between garbage collection and 传统的内存管理方法?
11 给一个场景不太适合使用garbage collection模型去管理内存
Object-oriented design:
1. 简单描述下composition 跟inheritance 以及他们的区别。
Inheritance is an "is-a" relationship. Composition is a "has-a" relationship.
Composition and Inheritance both provide code reusability by relating class.
Inheritance derives one class from another one class, composition can have an instance of another class as a field.
2.What is dependency injection(DI)? 对管理软件有什么好处?
3.Polymorphism
The word polymorphism means having many forms. It describes the concept that different classes can be used with the same interface.
Advantages: It helps the programmer to reuse the codes
Disadvantages: Polymorphism reduces the readability of the program and runtime polymorphism can lead to the performance issue as machine needs to decide which method or variable to invoke
4.what is the most important object oriented programming principle for complex system
Four basic concept:
Abstraction: shows only the necessary details to the client of an object
Encapsulation: process of enclosing one or more items within a physical or logical package
Inheritance: allows us to define a class in terms of another class
Polymorphism: an instance of something in various forms
The five principles are as follows:
* S – Single Responsibility Principle (SRP): “A class should have one, and only one, reason to change.”
* O – Open Closed Principle (OCP): “You should be able to extend a classes behavior, without modifying.”
* L – Liskov Substitution Principle (LSP): “Derived classes must be substitutable for their base classes.”
* I – Interface Segregation Principle (ISP): “Clients should not be forced to depend upon interfaces that they don't use.”
* D – Dependency Inversion Principle (DIP): “Depend on abstraction, not on concretions.”
5.如果向Collection framework里面加入一个新的class. 你打算加上哪些文档?
6.公司实现了一个数据结构,你觉得documentation里头要写啥比较好,随便讲
7.undo/redo , which data structure is good for this?
stack
8.What is the main difference between overloading and overriding?
Overloading is static Binding, whereas Overriding is dynamic Binding. Overloading is nothing but the same method with different arguments, and it may or may not return the equal value in the same class itself.
Overriding is the same method names with the same arguments and return types associated with the class and its child class.
9. What is Static Binding and Dynamic Binding?
Binding is nothing but the association of a name with the class. Static Binding is a binding in which name can be associated with the class during compilation time, and it is also called as early Binding.
Dynamic Binding is a binding in which name can be associated with the class during execution time, and it is also called as Late Binding.
10.When would you use composition and inheritance over the other, what are some of the tradeoffs?
编程题:
楼主面的是Calculator,大家可以参考地里的面经资料寻找答案,或者自己练一下
1) 给一个String只有数字,+和-,比如43+2-2,返回计算结果
2) 第一题的follow up,这次加了括号,比如(33-3)+((8-3)-(3-88)),返回计算结果 (LT 224)
3) 第二题的follow up,这次String里会有variable,比如(apple-4)+orange-(banana+3),然后给一个map,{{banana: 4}, {apple : 9}},不是所有的variable都有值,这个例子就会返回5+orange-7。
最后祝大家面试顺利哈!
|