Python & Java Basics for Job Interviews
Core Programming Concepts (Common to Python & Java)
- Variables & Data Types: int, float, char (Java), str (Python), boolean.
- Operators: Arithmetic (+, -, *, /), Logical (&&, ||, !), Comparison (==, !=, >, <).
- Control Flow: if, else, elif (Python) / else if (Java), switch (Java).
- Loops: for, while, break, continue.
- Functions/Methods: Function definitions, parameters, return values.
- Data Structures: Arrays/Lists, Sets, Dictionaries/Maps, Stacks, Queues.
- OOP Principles: Class, Object, Inheritance, Encapsulation, Polymorphism, Abstraction.
- Exception Handling: try-except (Python), try-catch-finally (Java).
- File I/O Basics: Reading/writing text files.
- Recursion: Function calling itself with base and recursive cases.
Python-Specific Topics
- Dynamically Typed: Variable type inferred automatically.
- Indentation-based syntax: No curly braces.
- List Comprehensions: [x for x in range(5) if x % 2 == 0]
- Built-in Functions: map(), filter(), zip(), enumerate(), len(), type().
- Lambda Functions: Anonymous functions e.g. lambda x: x + 1
- Modules/Packages: import math, from datetime import datetime
- Decorators: Functions modifying other functions. E.g. @staticmethod
- Pythonic Idioms: for i in list, with open() as f, try/except blocks
- Common Libraries: collections, math, datetime, os, itertools
Java-Specific Topics
- Statically Typed: Variables must be declared with type.
- Main Method Structure:
public static void main(String[] args) {
System.out.println("Hello");
}
- Access Modifiers: public, private, protected.
- Constructors: ClassName() and parameterized constructors.
- Abstract Class vs Interface:
- Abstract: Partial implementation.
Python & Java Basics for Job Interviews
- Interface: Full abstraction.
- Packages/Imports: package mypkg; import java.util.*;
- Collections Framework: ArrayList, LinkedList, HashMap, HashSet.
- String Handling: StringBuilder, StringBuffer for mutable strings.
- Multithreading: Thread class and Runnable interface.
- Garbage Collection: Automatic, System.gc() as a request.
Interview-Focused Concepts
- Time & Space Complexity: Big O notation.
- Common Algorithms:
- Sorting: Bubble, Selection, Insertion, Merge, Quick.
- Searching: Linear, Binary Search.
- Data Structures: Linked List, Stack (LIFO), Queue (FIFO).
- OOP in Real World: Encapsulating logic in classes, code reuse via inheritance.
- Design Patterns (Java): Singleton, Factory, Observer, Strategy.
- Common Libraries to Know:
- Python: math, random, datetime, re
- Java: java.util.*, java.io.*, java.lang.*
- Clean Code Practices:
- Naming conventions
- Avoiding hard-coded values
- Using comments appropriately
- Error Handling Examples:
- Python: try: ... except ZeroDivisionError: ...
- Java: try { ... } catch (Exception e) { ... }