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 returns results with a case-insensitive end sequence.






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






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






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


5. This model method saves a model instance to the database. This method has no return value.






6. Returns a new QuerySet that uses SELECT DISTINCT in its SQL query. This eliminates duplicate rows from the query results.






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






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






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






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






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






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






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






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






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






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






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






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






19. When to run syncdb






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






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






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






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






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






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






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






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






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






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






30. In some complex data-modeling situations - your models might contain a lot of fields - some of which could contain a lot of data (for example - text fields) - or require expensive processing to convert them to Python objects. If you are using the res






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






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






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






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






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






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






38. Negation operator for Q objects.






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






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






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






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


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






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






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






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






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






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






49. This tells Django how to calculate the URL for an object. Django uses this in its admin interface - and any time it needs to figure out a URL for an object.






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







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