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. If True - the table does not permit duplicate values for this field.






2. These methods are intended to do "table-wide" things.






3. If this option is True - Django will store empty values as NULL in the database. Default is False.






4. Lookup type that returns results with a case-insensitive start sequence.






5. Disjunction operator for Q objects.






6. Returns an EmptyQuerySet -- a QuerySet that always evaluates to an empty list. This can be used in cases where you know that you should return an empty result set and your caller is expecting a QuerySet object (instead of returning an empty list - fo






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






8. This method is more or less the opposite of defer(). You call it with the fields that should not be deferred when retrieving a model. If you have a model where almost all the fields need to be deferred - using this method to specify the complementary






9. 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






10. 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


11. This query deletes all Entry objects with a pub_date year of 2005.






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






13. This tells Django how to calculate the URL for an object. Django uses this in its admin interface - and any time it needs to figure out a URL for an object.






14. Defined by django.db.models.ForeignKey. You use it just like any other Field type: by including it as a class attribute of your model.






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






16. If you pickle a QuerySet - this will force all the results to be loaded into memory prior to pickling. When you unpickle a QuerySet - it contains the results at the moment it was pickled - rather than the results that are currently in the database.






17. These are "anything that's not a field" - such as ordering options (ordering) - database table name (db_table) - or human-readable singular and plural names (verbose_name and verbose_name_plural)






18. This gives your model metadata.






19. This is a criterion that narrow down a QuerySet based on given parameters.






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






21. These are specified as keyword arguments to the QuerySet methods filter() - exclude() and get(). These take the form field__lookuptype=value .






22. Takes a list of primary-key values and returns a dictionary mapping each primary-key value to an instance of the object with the given ID.






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






24. Keyword shortcut for looking up an object by primary key.






25. This represents a collection of objects from your database. It can have zero - one or many filters.






26. Conjuntion operator for Q objects.






27. This model method saves a model instance to the database. This method has no return value.






28. Returns a ValuesQuerySet -- a QuerySet that returns dictionaries when used as an iterable - rather than model-instance objects.






29. 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.






30. This object allows you to compare the value of a model field with another field on the same model. Django supports the use of addition - subtraction - multiplication - division and modulo arithmetic with these objects - both with constants and with o






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






32. Lookup type that corresponds to a boolean full-text search - taking advantage of full-text indexing. This is like contains but is significantly faster due to full-text indexing.






33. Used to get a QuerySet for a model. This is called 'objects' by default.






34. A convenience method for constructing an object and saving it all in one step.






35. 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.






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






37. This method returns tuples of values when iterated over. Each tuple contains the value from the respective field passed into the call to this method -- so the first item is the first field - etc.






38. In this case - an intermediate model can have multiple foreign keys to the source model. Here - two foreign keys to the same model are permitted - but they will be treated as the two (different) sides of the many-to-many relation.






39. Here - you can't use add - create - or assignment (i.e. - beatles.members = [...]) to create relationships. You need to specify all the detail for the relationship required by the intermediate model.






40. Use this method to reverse the order in which a queryset's elements are returned. Calling this method a second time restores the ordering back to the normal direction.






41. 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.






42. Returns True if the QuerySet contains any results - and False if not. This tries to perform the query in the simplest and fastest way possible - but it does execute nearly the same query. This means that calling this method on a queryset is faster th






43. Each one of these is a Python class that subclasses django.db.models.Model. Each attribute of one of these represents a database field.






44. Accomplish this by using the field name of related fields across models - separated by double underscores - until you get to the field you want. For example - to get all Entry objects with a Blog whose name is 'Beatles Blog': Entry.objects.filter(blo






45. 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.






46. A Manager method that returns a new QuerySet containing objects that match the given lookup parameters.






47. A manager method that returns a new QuerySet containing objects that do not match the given lookup parameters.






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






49. To activate your models






50. Evaluation happens upon use the "step" parameter of slice syntax - the first time you iterate over it - when pickling or caching results - upon calling repr() - upon calling len() - upon calling list() - upon calling bool()







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