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






2. Lookup type that returns results in a given list.






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






4. This model method is used for updating a ManyToManyField.






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






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






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






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






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






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






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






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






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






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


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






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






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






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






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






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






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


22. To activate your models






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






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. A convenience method for looking up an object with the given kwargs - creating one if necessary.






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






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






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






29. The value given in the absence of a specified value for the field. This can be a value or a callable object. If callable it will be called every time a new object is created.






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


31. Manager method used to retrieve every object in a model.






32. When to run syncdb






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






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






35. Returns a new QuerySet containing objects that match the given lookup parameters.






36. 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()






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






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. This query finds all entries between a start date of start_date and an end date of end_date.






40. Lookup type for date/datetime fields that finds an exact year match. Takes a four-digit year.






41. Exception raised by get(**kwargs) if no items match the query.






42. Returns the object matching the given lookup parameters






43. A QuerySet is iterable - and it executes its database query the first time you iterate over it.






44. If True - the table does not permit duplicate values for this field.






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






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






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






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






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






50. Adds to each object in the QuerySet with the provided list of aggregate values (averages - sums - etc) that have been computed over the objects that are related to the objects in the QuerySet. Each argument to this is content that will be added to ea







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