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. Defined by a OneToOneField. You use it just like any other Field type: by including it as a class attribute of your model.






2. This gives your model metadata.






3. Returns a QuerySet that will automatically "follow" foreign-key relationships - selecting that additional related-object data when it executes its query. This is a performance booster which results in (sometimes much) larger queries but means later u






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






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






6. Lookup type for date/datetime fields that finds a 'day of the week' match.






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






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






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






10. Disjunction operator for Q objects.






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






12. To activate your models






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






15. Negation operator for Q objects.






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






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






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






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






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






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






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


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






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






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






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






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






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






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






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. Operator for comparing two model instances for equality. Behind the scenes - it compares the primary key values of two models.






32. Lookup type that takes either True or False and corresponds to SQL queries of IS NULL and IS NOT NULL - respectively.






33. Lookup type for date/datetime fields that finds an exact day match.






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






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






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






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






38. Fields are specified by these






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






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






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






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






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






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


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






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






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






48. Conjuntion operator for Q objects.






49. Performs an SQL delete query on all rows in the QuerySet. This method is applied instantly. You cannot call this method on a QuerySet that has had a slice taken or can otherwise no longer be filtered.






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







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