Skip to content

Instantly share code, notes, and snippets.

@subhajeet2107
Last active May 30, 2024 06:44
Show Gist options
  • Save subhajeet2107/1e849808a1d83b3cddf1191ac52489be to your computer and use it in GitHub Desktop.
Save subhajeet2107/1e849808a1d83b3cddf1191ac52489be to your computer and use it in GitHub Desktop.
Simple Interview questions for Django Developer

Django/Python Questions

  1. Find the most frequent integer in a list, Test list : [3,5,6,3,9,0,3,8,3,1,3]

  2. Find the common elements of 2 lists

        a = [2,3,4,1,1,3,6]
        b = [2,8,9,1,3]

    find integers which are in list a but not list b do not use loops !

  3. Sort this list of tuples by second item in each tuple

        awesome_list = [(2,3,1),(6,8,6),(9,1,4),(4,4,0),(2,3,3),(6,2,1)]
  4. Implement a function to reverse a string (a list of characters), in-place.

    None -> None
    [''] -> ['']
    ['f', 'o', 'o', ' ', 'b', 'a', 'r'] -> ['r', 'a', 'b', ' ', 'o', 'o', 'f']

Cannot use index cursors

  1. What are Generators ? The Fibonacci sequence is a series of numbers where a number is found by adding up the two numbers before it. Starting with 0 and 1, the sequence goes 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, Write a Fibonacci Sequence Generator.

  2. How do you export data from one database to another having the same model but with no data ? lets say we have a database A with model AppDetails, how do you export data of this model to another database B having same model

  3. Difference between StackedInline and TabularInline, if we want to add a model having Manytomany foreign key in django admin, which type of admin model should we use ?

  4. What is the Data Structure used for indexing in DBMS ? When to not use indexing ?

  5. Given an array of integers, write a function that returns true if there is a triplet (a, b, c) that satisfies a2 + b2 = c2

    Input: arr[] = {3, 1, 4, 6, 5}
    Output: True
    There is a Pythagorean triplet (3, 4, 5).
    
    Input: arr[] = {10, 4, 6, 12, 5}
    Output: False
    There is no Pythagorean triplet.
  6. How to get all logged-in user list or count in Django ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment