Test your basic knowledge |

Django Queryset

Subject : it-skills
Instructions:
  • Answer 50 questions in 15 minutes.
  • If you are not ready to take this test, you can study here.
  • Match each statement with the correct term.
  • Don't refresh. All questions and answers are randomly picked and ordered every time you load a test.

This is a study tool. The 3 wrong answers for each question are randomly chosen from answers to other questions. So, you might find at times the answers obvious, but you will see it re-enforces your understanding as you take the test each time.
1. Lookup type that yields an "exact" match. If you don't provide a lookup type -- that is - if your keyword argument doesn't contain a double underscore -- the lookup type is assumed to be of this sort.






2. This query finds all entries between a start date of start_date and an end date of end_date.






3. Takes the ouput of one filter and uses it as input for another filter. This works because a refinement of a QuerySet is itself a QuerySet.






4. A Q object that encapsulates queries for entries with a question value that starts with 'What' in a case-insensitive fashion.

Warning: Invalid argument supplied for foreach() in /var/www/html/basicversity.com/show_quiz.php on line 183


5. Lookup type that finds a case-sensitive regular expression match.






6. Operator for comparing two model instances for equality. Behind the scenes - it compares the primary key values of two models.






7. Returns the object matching the given lookup parameters






8. Defined by a OneToOneField. You use it just like any other Field type: by including it as a class attribute of your model.






9. A Q object that asks for entries with a question value that start with 'Who' or do not have a publication date of 2005.

Warning: Invalid argument supplied for foreach() in /var/www/html/basicversity.com/show_quiz.php on line 183


10. A convenience method for looking up an object with the given kwargs - creating one if necessary.






11. Returns a DateQuerySet -- a QuerySet that evaluates to a list of datetime.datetime objects representing all available dates of a particular kind within the contents of the QuerySet.

Warning: Invalid argument supplied for foreach() in /var/www/html/basicversity.com/show_quiz.php on line 183


12. This query finds all entries with an id greater than 4.






13. This object encapsulates a collection of keyword arguments - with the keys being field lookup types. These objects can be combined using the & and | operators - as well as negated with the ~ operator.






14. Lookup type that finds a case-insensitive regular expression match.






15. Lookup type that returns results that fall into an inclusive date range.






16. This method immediately deletes the object and has no return value.






17. By default - results returned by a QuerySet are ordered by the ordering tuple given by the ordering option in the model's Meta. You can override this on a per-QuerySet basis by using the this method.






18. The database that will be used if this query is executed now






19. This model type is useful if you only want to modify the Python-level behavior of a model - without changing the models fields in any way. This creates a stand-in for the original model. You can create - delete and update instances of this new model






20. This query finds all entries with an id in the list [1 - 3 - 4]






21. This method is for controlling which database the QuerySet will be evaluated against if you are using more than one database. The only argument this method takes is the alias of a database - as defined in DATABASES.






22. Lookup type that returns results with a case-insensitive end sequence.






23. Lookup type that returns results less than or equal to a given value.






24. Lookup type that tests for inclusion in a case-sensitive fashion.






25. These add custom "row-level" functionality to your objects. These act on a particular model instance.






26. restrictions on ________: (1) Your intermediate model must contain one - and only one - foreign key to the target model. (2) Your intermediate model must contain one - and only one - foreign key to the source model. (3) When defining a many-to-many r






27. Exception raised by get(**kwargs) if more than one item matches the query.






28. The first element in this iterable is the value that will be stored in the database - the second element will be displayed by the admin interface - or in a ModelChoiceField.






29. Returns the most recent object in the table - by date - using the field_name provided as the date field.






30. Specifies the model that will be used to govern the many-to-many relationship. You can then put extra fields on the intermediate model. The intermediate model is associated with the ManyToManyField using this to point to the model that will act as an






31. (1) These cannot be Python reserved words - because that would result in a Python syntax error. (2) These cannot contain more than one underscore in a row - due to the way Django's query lookup syntax works.






32. Returns a QuerySet that will automatically "follow" foreign-key relationships - selecting that additional related-object data when it executes its query. This is a performance booster which results in (sometimes much) larger queries but means later u






33. Returns a new QuerySet that uses SELECT DISTINCT in its SQL query. This eliminates duplicate rows from the query results.






34. Performs an SQL delete query on all rows in the QuerySet. This method is applied instantly. You cannot call this method on a QuerySet that has had a slice taken or can otherwise no longer be filtered.






35. Defines a one-to-one relationship. You use it just like any other Field type: by including it as a class attribute of your model.






36. To activate your models






37. what the field _______ determines: (1) The database column type (e.g. INTEGER - VARCHAR); (2) The widget to use in Django's admin interface - if you care to use it (e.g. <input type="text"> - <select>); (3) The minimal validation requirements - used






38. Sometimes - the Django query syntax by itself can't easily express a complex WHERE clause. For these edge cases - Django provides this QuerySet modifier -- a hook for injecting specific clauses into the SQL generated by a QuerySet.






39. Fields are specified by these






40. The default for this is the name of the child class followed by '_set'.






41. Lookup type that returns results with a case-sensitive end sequence.






42. Can be used to remove all many-to-many relationships for an instance






43. Lookup type that returns results greater than a given value.






44. This field is added automatically - but this behavior can be overridden






45. This query uses an F object to increment the pingback count for every entry in the blog.

Warning: Invalid argument supplied for foreach() in /var/www/html/basicversity.com/show_quiz.php on line 183


46. Returns a copy of the current QuerySet (or QuerySet subclass you pass in). This can be useful in some situations where you might want to pass in either a model manager or a QuerySet and do further filtering on the result. You can safely call all() on






47. Conjuntion operator for Q objects.






48. Lookup type for date/datetime fields that finds an exact month match. Takes an integer 1 (January) through 12






49. Returns an integer representing the number of objects in the database matching the QuerySet. This never raises exceptions.






50. Lookup type that returns results greater than or equal to a given value.







Sorry!:) No result found.

Can you answer 50 questions in 15 minutes?


Let me suggest you:



Major Subjects



Tests & Exams


AP
CLEP
DSST
GRE
SAT
GMAT

Most popular tests