Huawei Campus Interview Experience and Technical Q&A: Java, MySQL, Redis, Design Patterns, and Networking Fundamentals
This article combines a Huawei campus recruitment overview—including interview timeline, salary grades, and interview process—with extensive technical Q&A covering Java vs C differences, Java features, OOP concepts, common design patterns, Redis and MySQL comparisons, MySQL transaction properties, B‑Tree indexes, list deduplication, stack implementations, and the low‑level workings of the ping command.
Huawei Campus Recruitment Overview
Huawei starts its offline campus recruitment in October; candidates who pass the interview enter a pool and typically receive an offer in December, often accompanied by HR "warm‑up" calls encouraging them not to accept other offers.
Salary levels for 2022 campus hires are roughly:
Level 13: 19‑21k (14‑16 months)
Level 14: 22‑25k (14‑16 months)
Level 15: 26‑31k (14‑16 months)
Technical interview consists of three technical rounds plus one HR round, preceded by an online coding test (usually algorithmic, passing score 150).
Technical Q&A
C vs Java
Language type : C is procedural, Java is object‑oriented.
Compilation : C compiles to native code; Java compiles to bytecode executed by the JVM.
Memory management : C uses malloc / free; Java has automatic garbage collection.
Error handling : C uses return codes or errno; Java uses exceptions.
Data types : C has basic types and pointers; Java has rich object types but no pointer exposure.
Use cases : C for low‑level system control; Java for cross‑platform large‑scale applications.
Java Features
Platform independence (write once, run anywhere via JVM).
Pure object‑oriented programming with inheritance, polymorphism, abstraction, encapsulation.
Automatic memory management through garbage collection.
OOP Core Concepts
Encapsulation : hide internal state, expose behavior via methods.
Inheritance : reuse parent class members, build class hierarchies.
Polymorphism : same interface, different implementations (overloading & overriding).
Design Patterns Familiar to Spring Users
Factory, Proxy, Singleton, Template Method, Wrapper, Observer, Adapter.
Redis vs MySQL
Redis is an in‑memory NoSQL key‑value store; MySQL is a relational DB.
Redis offers ultra‑fast reads/writes, suitable for caching, distributed locks, leaderboards, counters, and lightweight message queues.
MySQL provides ACID transactions, complex queries, and persistent storage.
Typical usage: cache hot data in Redis, store durable data in MySQL; combine with read‑write separation, pipelining, connection pools, and sharding for performance.
Ensuring Cache Consistency
Common strategy: write‑through (update DB then delete cache) or read‑through (populate cache on miss). For stronger consistency, employ retry mechanisms, message queues, or binlog subscription (e.g., Canal) to delete stale cache entries.
MySQL Transaction Properties (ACID)
Atomicity – guaranteed by undo log.
Consistency – ensured by combination of atomicity, isolation, and durability.
Isolation – provided by MVCC or locks.
Durability – persisted via redo log.
B+Tree Index in InnoDB
InnoDB uses a B+Tree where leaf nodes store the actual rows (clustered index). A sample SELECT * FROM product WHERE id = 5; traverses three levels, resulting in three I/O operations.
SQL Transaction Example
START TRANSACTION;
INSERT INTO table1 (col1, col2) VALUES (value1, value2);
INSERT INTO table2 (col1, col2) VALUES (value3, value4);
COMMIT;Java List Deduplication
Three common approaches:
Convert to Set and back.
Use Java 8 Stream distinct().
Use LinkedHashSet to preserve order.
import java.util.*;
public class ListDeduplication {
public static void main(String[] args) {
List<String> list = new ArrayList<>(Arrays.asList("apple","banana","apple","orange","banana"));
Set<String> set = new HashSet<>(list);
List<String> dedup = new ArrayList<>(set);
System.out.println(dedup);
}
}Stack Implementations in Java
Array‑based stack:
class ArrayStack {
private int maxSize;
private int[] stackArray;
private int top;
public ArrayStack(int size) { maxSize = size; stackArray = new int[maxSize]; top = -1; }
public void push(int value) { if (top == maxSize-1) throw new RuntimeException("Stack is full"); stackArray[++top] = value; }
public int pop() { if (isEmpty()) throw new RuntimeException("Stack is empty"); return stackArray[top--]; }
public int peek() { if (isEmpty()) throw new RuntimeException("Stack is empty"); return stackArray[top]; }
public boolean isEmpty() { return top == -1; }
public int size() { return top + 1; }
}Linked‑list‑based stack and usage of built‑in java.util.Stack are also shown.
Ping Command Low‑Level Process
Ping creates an ICMP Echo Request (type 8) with a sequence number and timestamp, wraps it in an IP packet (protocol 1), then in an Ethernet frame. The target replies with an Echo Reply (type 0). The sender measures RTT by subtracting the original timestamp.
When the destination MAC is unknown, ARP is used to resolve it. The process repeats for each ping, and loss of replies indicates unreachable hosts.
Other Interview Topics
Internship experiences and product understanding.
General discussion prompts.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
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.
