Skip to content
  • Recent
  • Categories
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Yeti)
  • No Skin
Collapse

FastQA

fastqaF

fastqa

@fastqa
administrators
About
Posts
57
Topics
57
Shares
0
Groups
1
Followers
0
Following
0

Posts

Recent Best Controversial

  • How many different API protocols are there and what are their use cases?
    fastqaF fastqa

    The first 5 are most popular API protocols.

    1. REST: A stateless, resource-based architecture that uses standard HTTP methods like GET, POST, PUT, and DELETE to interact with resources.

    2. GraphQL: A flexible query language for APIs that allows clients to request exactly the data they need, reducing over-fetching or under-fetching.

    3. gRPC: A high-performance RPC framework that uses HTTP/2 and Protocol Buffers for efficient, real-time communication between services.

    4. WebHooks: Event-driven callbacks that allow real-time data to be pushed from one system to another when an event occurs.

    5. WebSockets: A protocol for bidirectional, persistent communication between a client and server, ideal for real-time applications.

    6. SOAP: A protocol for exchanging structured information using XML messages, typically in enterprise-level, secure, and transaction-based services.

    7. JSON-RPC: A simple, lightweight protocol that uses JSON to encode remote procedure calls between client and server.

    8. XML-RPC: A protocol for remote procedure calls using XML messages, offering simplicity but with heavier data formats compared to JSON.

    9. OData: A protocol built on top of REST that allows querying and updating data in a standardized way, commonly used in enterprise environments.

    10. Falcor: A JavaScript framework that simplifies data fetching by allowing clients to query a single endpoint and aggregate data from multiple sources.

    Interview Questions

  • What is difference between copy() and deepcopy() in Python
    fastqaF fastqa

    In Python, copy and deepcopy come from the copy module and are used to duplicate objects.

    The key difference lies in how they handle nested objects.

    1. Shallow Copy (copy.copy())

    Creates a new object but does not recursively copy nested objects (like lists or dicts inside the object).

    If the original object contains mutable objects (lists, dicts, etc.), modifications to those mutables in the copied object will affect the original.

    import copy
    
    original = [1, [2, 3], 4]
    shallow_copy = copy.copy(original)
    
    shallow_copy[1][0] = 99  # Modifies the nested list
    print(original)  # Output: [1, [99, 3], 4]
    

    Explanation: Since copy.copy() only creates a new top-level object but keeps references to inner objects, changes in the nested list shallow_copy[1] reflect in the original.

    2. Deep Copy (copy.deepcopy())

    Creates a new object and recursively copies all nested objects.
    Modifications in the copied object will not affect the original.

    deep_copy = copy.deepcopy(original)
    
    deep_copy[1][0] = 42
    print(original)  # Output: [1, [99, 3], 4] (unchanged)
    

    Explanation: deepcopy() creates an entirely independent copy of the object, including all nested elements.

    3. When to Use?

    Use copy.copy() when your object only contains immutable elements (like numbers, strings, tuples) or when shallow copying is sufficient.

    Use copy.deepcopy() when your object contains nested mutable objects and you want a fully independent copy.

    Interview Questions python developer backend engineer
  • 1 / 1
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Recent
  • Categories
  • Tags
  • Popular
  • World
  • Users
  • Groups