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






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






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






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






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






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






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






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






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






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






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






12. Evaluates the QuerySet (by performing the query) and returns an iterator over the results. A QuerySet typically caches its results internally so that repeated evaluations do not result in additional queries; this method will instead read results dire






13. If True - this field is the primary key for the model.






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






15. If you are using this attribute on a ForeignKey or ManyToManyField - you must always specify a unique reverse name for the field.






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






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






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






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






20. This class type is useful when you just want to use the parent class to hold information that you don't want to have to type out for each child model. This class isn't going to ever be used in isolation. When it is used as a base class for other mode






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






22. An iterable (e.g. - a list or tuple) of 2-tuples to use as options for this field. If this is given - Django's admin will use a select box instead of the standard text field and will limit options to those given.






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






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






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






26. a QuerySet can be sliced - using Python's array-slicing syntax.






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






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


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






30. Returns a dictionary of aggregate values (averages - sums - etc) calculated over the QuerySet. Each argument to this method specifies a value that will be included in the dictionary that is returned.






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


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






33. True if the QuerySet has an order_by() clause or a default ordering on the model. False otherwise.






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






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






36. Fields are specified by these






37. Lookup type that yields a case-insensitive match.






38. Lookup type that returns results less than a given value.






39. 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)






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






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






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






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






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






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






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






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






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






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






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







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