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 method immediately deletes the object and has no return value.






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






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






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






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






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






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






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






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






11. To activate your models






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






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


14. Extra text to be displayed under the field on the object's admin form to provide assistance to users. It's useful for documentation even if your object doesn't have an admin form.






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






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






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






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






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






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






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






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






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






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






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






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






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






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






29. Conjuntion operator for Q objects.






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






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


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






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






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






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 add custom "row-level" functionality to your objects. These act on a particular model instance.






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






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






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






40. Returns the object matching the given lookup parameters






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






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






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






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






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






46. This gives your model metadata.






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






48. Lookup type that returns results in a given list.






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






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







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