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. This represents a collection of objects from your database. It can have zero - one or many filters.






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


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






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






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






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






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


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






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






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






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






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






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






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






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






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






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






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






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






20. A Python "magic method" that returns a unicode "representation" of any object.






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






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






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






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






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






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






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






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






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






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






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






32. To activate your models






33. Fields are specified by these






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






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






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






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






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






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






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






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






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






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






44. Conjuntion operator for Q objects.






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






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






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






48. Performs an SQL update query for the specified fields - and returns the number of rows affected. This method is applied instantly and the only restriction on the QuerySet that is updated is that it can only update columns in the model's main table. F






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






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







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