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






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






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


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






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. True if the QuerySet has an order_by() clause or a default ordering on the model. False otherwise.






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






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






9. Takes the ouput of one filter and uses it as input for another filter. This works because a refinement of a QuerySet is itself a QuerySet.






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






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






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


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






14. The database that will be used if this query is executed now






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






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






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






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






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






20. Disjunction operator for Q objects.






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






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






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






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






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






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






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






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






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






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






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






32. Negation operator for Q objects.






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






34. When to run syncdb






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






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






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


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






39. A Manager method that returns a new QuerySet containing objects that match the given lookup parameters.






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






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






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






43. This query deletes all Entry objects with a pub_date year of 2005.






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






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






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






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






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






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






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







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