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 takes either True or False and corresponds to SQL queries of IS NULL and IS NOT NULL - respectively.






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






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






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






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






6. Lookup type that returns results with a case-sensitive start sequence.






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






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






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






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






11. Fields are specified by these






12. This sets a field to a particular value for all the objects in a QuerySet. You can only set non-relation fields and ForeignKey fields using this method.






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






14. This query updates all the headlines with pub_date in 2007 to read 'Everything is the same'.

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


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






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






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






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






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






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






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






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






23. If this option is True - the field is allowed to be blank. Default is False.






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






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






26. Returns the object matching the given lookup parameters






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






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






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


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






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






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






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






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


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






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






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






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






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






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






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






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






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






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


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






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






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






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






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






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







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