McDonald's Java Backend Interview Experience and Technical Q&A
This article shares a candidate's interview experience at McDonald's China Technology R&D Center, detailing salary expectations, work schedule, and an extensive technical Q&A covering IoC/DI, MyBatis, JVM memory and garbage‑collection algorithms, MySQL storage engines, concurrency, locking, RPC, HTTPS, Docker/Kubernetes commands, and Git workflows, while also including some promotional material.
Hello everyone, I am Xiao Lin.
McDonald's, a Fortune 500 company, also has IT development positions in its China Technology R&D Center, covering client, front‑end, and back‑end development.
The salary for a Java back‑end campus recruitment position is typically 240k–270k CNY per year (e.g., 18k×15 months for a master's graduate in Nanjing, 16k×15 months for another).
Work hours follow a 9‑6‑5 schedule with weekends off. Benefits include a 75% discount on meals, generous annual leave (10 + n days), and other perks.
McDonald's (Second Interview)
Do you understand IoC and DI in your Spring Boot project?
IoC (Inversion of Control) moves object creation and dependency management to an external container, while DI (Dependency Injection) is a concrete way to inject dependencies via constructors, setters, or interfaces.
public class UserService {
private UserDao userDao;
public UserService() {
this.userDao = new UserDao();
}
// other methods
}With IoC, the container injects UserDao into UserService :
public class UserService {
private UserDao userDao;
public UserService(UserDao userDao) {
this.userDao = userDao;
}
// other methods
}DI can be implemented via:
Constructor injection : pass dependencies through the constructor.
public UserService(UserDao userDao) {
this.userDao = userDao;
}Setter injection : provide a setter method.
public void setUserDao(UserDao userDao) {
this.userDao = userDao;
}Interface injection : implement an interface to receive dependencies (rarely used).
Which ORM framework does the project use?
The project uses MyBatis, which offers flexible SQL programming, reduces boilerplate compared to JDBC, supports many databases, integrates well with Spring, and provides powerful mapping tags.
Are you familiar with the JVM and its garbage‑collection algorithms?
Mark‑Sweep : marks reachable objects then sweeps unmarked ones; can cause fragmentation.
Copying : copies live objects to another space to eliminate fragmentation; halves usable memory.
Mark‑Compact : moves live objects to one end and compacts memory.
Generational : separates young and old generations, promoting objects based on age.
Explain the JVM memory layout.
The JVM runtime memory consists of the program counter, Java stack, native method stack, heap (young and old generations), metaspace (method area), runtime constant pool, and direct memory.
Which MySQL storage engines have you used?
InnoDB : default engine, ACID transactions, row‑level locking, foreign keys.
MyISAM : lightweight, read‑optimized, no transaction support.
Memory : stores data in RAM for fast reads, data lost on restart.
What are the advantages of InnoDB?
Full transaction support (ACID).
Row‑level locking for high concurrency.
Crash recovery via redo logs.
How do you ensure thread safety in Java concurrency programming?
Atomicity : use synchronized or atomic classes.
Visibility : use volatile or synchronized blocks.
Ordering : rely on the happens‑before principle.
Difference between optimistic and pessimistic locks?
Optimistic lock : assumes low contention, checks version before update; suitable for read‑heavy scenarios.
Pessimistic lock : acquires a lock before operation; suitable for write‑heavy scenarios like banking.
What is RPC and why is it faster than HTTP?
RPC (Remote Procedure Call) lets a program invoke functions on a remote server as if they were local, abstracting network details. RPC frameworks often use lightweight binary protocols, custom serialization, connection pooling, async calls, and built‑in load balancing, reducing overhead compared to verbose HTTP headers.
How does HTTPS differ from HTTP?
HTTPS encrypts data using SSL/TLS, while HTTP transmits plaintext.
HTTPS adds an extra TLS handshake after TCP three‑way handshake.
Default ports: 443 for HTTPS, 80 for HTTP.
HTTPS requires a digital certificate from a CA.
Typical Docker and Kubernetes commands
Docker:
docker pull nginx:latest
docker build -t my-image:1.0 .
docker rmi my-image:1.0
docker run -d -p 80:80 nginx:latest
docker ps
docker exec -it my-container /bin/bash
Kubernetes:
kubectl apply -f pod-example.yaml
kubectl get pods
kubectl logs pod-name
kubectl exec -it my-pod -- /bin/bash
kubectl delete pod my-pod
kubectl scale deployment my-deployment --replicas=3
Comparison table:
Scenario
Docker Command
Kubernetes Command
Run container/Pod
docker run kubectl create -f pod.yamlCheck status
docker ps kubectl get podsView logs
docker logs kubectl logsEnter terminal
docker exec -it kubectl exec -itStop resource
docker stop kubectl deleteScale
Not applicable
kubectl scaleCommon Git commands
Workflow: git pull → develop → git add . → git commit -m "msg" → git push .
Undo a commit:
git reset --soft HEAD^ # keep changes staged git reset --mixed HEAD^ # keep changes in working directoryUndo a push (force push after reset):
git reset HEAD^
git push origin branch --forcePromotional Section
The article ends with a promotional call‑to‑action encouraging readers to follow the public account, comment for a chance to win books, and includes several unrelated news links and giveaway rules.
IT Services Circle
Delivering cutting-edge internet insights and practical learning resources. We're a passionate and principled IT media platform.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.