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. Returns a new QuerySet that uses SELECT DISTINCT in its SQL query. This eliminates duplicate rows from the query results.






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






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






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






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






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






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






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






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






10. Disjunction operator for Q objects.






11. This style of inheritanc is useful when you're subclassing an existing model (perhaps something from another application entirely) and want each model to have its own database table. Here - each model in the hierarchy is a model all by itself.






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






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






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






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






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






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






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






19. A manager method which returns a single object. If there are no results that match the query - this method will raise a DoesNotExist exception. If more than one item matches this query - the method will raise MultipleObjectsReturned.






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






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






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






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






24. Conjuntion operator for Q objects.






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






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


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






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






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






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






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






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






33. To activate your models






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






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






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






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






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






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






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






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






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






44. Fields are specified by these






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






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






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






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






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






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







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