Search test library by skills or roles
⌘ K

Adaface Sample Django Questions

Here are some sample Django questions from our premium questions library (10273 non-googleable questions).

Skills

🧐 Question

Easy

URL Dispatcher
Routes
Solve
Review the following sample Django URL.conf:
 image
Pick the correct statements if settings.APPEND_SLASH=False:
            
            A: A request to /books/2015/04/ would match the third entry in the list. Django would call the function views.month_books(request, year=2015, month=4).
            B: A request to /books/2015/04/ would match the second entry in the list. Django would call the function views.year_books(request, year=2015).
            
            C: A request to /books/2023/ will match the first entry in the list. Django would call the the function views.custom_newyear_2023(request).
            D: A request to /books/2023/ would match the second entry in the list. Django would call the function views.year_books(request, year=2023).
            
            E: /books/2022 would not match any of these patterns, because each pattern requires that the URL end with a slash.
            F: A request to /books/2022 would match the second entry in the list. Django would call the function views.year_books(request, year=2022).

Medium

External Bank Transfer
Database Transactions
Solve
Review the following Django code for a banking application:
 image
The code needs to debit an account with the provided amount and deposit the amount in an external entity. Here’s how the code is broken:
            
            1) First, the amount is debited from the account by creating a new row in BalanceLine table.
            2) Next, a new row is created in the DB in ExternalTransfer table and a new id (used as unique reference) is created for the transfer.
            3) An external 3rd party API call is made using the new id created in step 2.
            
            The function transfer_to_other_bank is called as shown below:
 image
Pick the correct statements:
            
            A: If post_transfer_emails() raises an exception, the database transactions that happened in transfer_to_other_bank are not rolled back since they are listed in a separate atomic transaction.
            B: If post_transfer_emails() raises an exception, the database transactions (new rows in ExternalTransfer and BalanceLine tables) are rolled back. The banking_api call is called again with a null reference.
            C: If post_transfer_emails() raises an exception, the database transactions are rolled back but the banking_api is not called again.
            D: If post_transfer_emails() raises an exception, the banking_api is called again with rollback=True. If the response is success, then the database transactions are rolled back. If the response is failure, the database transactions are committed.

Medium

Query retired people
Solve
An HRTech startup has the following Django code:
 image
We want a QuerySet with all Person objects where retired == True and age != 45. Which of the following do you think we should use?
 image
🧐 Question🔧 Skill

Easy

URL Dispatcher
Routes

2 mins

Django
Solve

Medium

External Bank Transfer
Database Transactions

3 mins

Django
Solve

Medium

Query retired people

2 mins

Django
Solve
🧐 Question🔧 Skill💪 Difficulty⌛ Time
URL Dispatcher
Routes
Django
Easy2 mins
Solve
External Bank Transfer
Database Transactions
Django
Medium3 mins
Solve
Query retired people
Django
Medium2 mins
Solve

Trusted by recruitment teams in enterprises globally

Amazon Morgan Stanley Vodafone United Nations HCL PayPal Bosch WeWork Optimum Solutions Deloitte Microsoft NCS Doubtnut Sokrati J&T Express Capegemini

We evaluated several of their competitors and found Adaface to be the most compelling. Great library of questions that are designed to test for fit rather than memorization of algorithms.


Swayam Narain, CTO, Affable

hashtag image heart icon Swayam
customers across world
Join 1500+ companies in 80+ countries.
Try the most candidate friendly skills assessment tool today.
g2 badges
Ready to streamline your recruitment efforts with Adaface?
Ready to streamline your recruitment efforts with Adaface?
logo
40 min tests.
No trick questions.
Accurate shortlisting.
ada
Ada
● Online
Previous
Score: NA
Next
✖️