A team stores its data in a relational database and retrieves it with SQL queries. Which of the following statements about how the database engine treats their queries are true? Select all that apply.
Because the programmer writes no loops, the engine finishes every query in the same time regardless of table size.
Creating an index can change how long a query takes without changing the rows it returns.
Writing a WHERE condition as b AND a instead of a AND b changes which rows the query returns.
A query with no ORDER BY clause may return the same rows in a different order on different runs.
Unlock full course notes by signing up
Evaluating a query with WHERE and HAVING
An online shop records orders in a table called orders, with each amount in dollars:
The shop runs this query:
Give the number of rows the query returns, the total reported for Patel in dollars and the total reported for Lee in dollars, each as a whole number.
Resolving conflicting CSS rules by specificity
CSS is a declarative styling language: a stylesheet declares rules, and the browser's cascade decides which rule wins when several set the same property. A web page has a nav element with id nav. Inside it is a link, an a element, that has two classes, item and active. All five rules below match that link and appear in this source order. There are no inline styles and no !important declarations.
Give each answer as a whole number or a single word: the number of class selectors in rule 2, how many of the five rules contain exactly one ID selector, the number of the rule whose colour is applied, and the colour the link is drawn in.
Which commands does Make run?
A C project is built with Make using the Makefile below. The developer runs make app, which successfully builds everything, and then edits and saves only the file util.h. Saving util.h gives it a later modification time than the existing object files. No other file changes. Assume all commands succeed and modification times distinguish successive changes.
The developer then runs make app again. How many cc commands does Make execute on this second run? Give your answer as a whole number.
Counting the answers to Prolog queries
In a logic language such as Prolog you declare facts and rules, and the system searches for every variable binding that makes a query true. Uppercase names are variables, and \= means the two terms must differ. Consider this program:
For each query in the table, enter the total number of answers Prolog reports if you keep asking for more until it says no. Count each reported binding once; enter 0 if the query has no answers.