Computers and Technology
Consider the following relations: Emp(eid: integer, ename: varchar, sal: integer, age: integer, did: integer) Dept(did: integer, budget: integer, floor: integer, mgr_eid: integer) Salaries range from $10,000 to $100,000, ages vary from 20 to 80, each department has about five employees on average, there are 10 floors, and budgets vary from $10,000 to $1 million. You can assume uniform distributions of values. For each of the following queries, which of the listed index choices would you choose to speed up the query.1. Query: Print ename, age, and sal for all employees. A) Clustered hash index on fields of Emp. B) Unclustered hash index on fields of Emp. C) Clustered B+ tree index on fields of Emp. D) Unclustered hash index on fields of Emp. E) No index.2. Query: Find the dids of departments that are on the 10th floor and have a budget of less than $15,000. A) Clustered hash index on the floor field of Dept.B) Unclustered hash index on the floor field of Dept. C) Clustered B+ tree index on fields of Dept. D) Clustered B+ tree index on the budget field of Dept. E) No index.
Write a static method named contains that accepts two arrays of integers a1 and a2 as parameters and that returns a boolean value indicating whether or not a2's sequence of elements appears in a1 (true for yes, false for no). The sequence of elements in a2 may appear anywhere in a1 but must appear consecutively and in the same order. For example, if variables called list1 and list2 store the following values: int[] list1 = {1, 6, 2, 1, 4, 1, 2, 1, 8}; int[] list2 = {1, 2, 1}; Then the call of contains(list1, list2) should return true because list2's sequence of values {1, 2, 1} is contained in list1 starting at index 5. If list2 had stored the values {2, 1, 2}, the call of contains(list1, list2) would return false because list1 does not contain that sequence of values. Any two lists with identical elements are considered to contain each other, so a call such as contains(list1, list1) should return true.