Question Bank

Rows per page: 1025100

Showing 176–200

Programming Languages and Software Engineering Databases #5

Given R defined in the previous question, which of the below statements are false?

Previous question:
The table below contains a representative data sample for all the functional dependencies in a real-life data set. Which are the functional dependencies that hold for the data below?

The relation R is in the first normal form.

The relation R is in the second normal form.

In the relation R the values in column B determines the values in column A.

The relation R can not contain two tuples with different values in column D when the values in column A match.

Programming Languages and Software Engineering Databases #6

Given the E/R diagram below Which of the following relations appear in the relational model representation of the diagram?

Courses(CID, title)

Students(SID, name)

Enroll(SID,CID)

Enroll(SID, name, CID, title, grade)

Students(SID, name, CID)

Enroll(SID, CID, grade)

Programming Languages and Software Engineering Databases #7

The table EMPLOYEES contains 10 employees, each having the salary = 1000 euro, with one exception - an employee has the salary set to NULL. The first 5 employees work in department 1 and the other 5 in department 2. How many rows will return the following query?

sql
SELECT department_id, SUM(salary) 
FROM employees 
GROUP BY department_id 
HAVING SUM(NVL(salary,1000)) > 4000;

No rows (empty)

One row

Two row

Other variant

Programming Languages and Software Engineering Databases #8

Which of the following queries returns the identifier (ID) and the name of all departments without any employee? Assume that the column DEPARTMENT_ID exists in both EMPLOYEES and DEPARTMENTS tables.

sql
SELECT d.department_id, d.department_name
FROM departments d
WHERE NOT EXISTS (SELECT 1 FROM employees e WHERE e.department_id=d.department_id);
sql
SELECT d.department_id, d.department_name
FROM employees e LEFT OUTER JOIN departments d
ON (d.department_id=e.department_id) WHERE e.department_id IS NULL;
sql
SELECT d.department_id, d.department_name
FROM employees e RIGHT OUTER JOIN departments d
ON (d.department_id=e.department_id) WHERE e.department_id IS NULL;
sql
SELECT department_id, department_name
FROM departments
MINUS
SELECT d.department_id, d.department_name
FROM employees e JOIN departments d ON e.department_id=d.department_id;
Programming Languages and Software Engineering Databases #9

You want to display all the cities that have no departments and all the departments that have not been allocated to any city. Which type of join between DEPARTMENTS and LOCATIONS tables would produce this information as part of its output?

NATURAL JOIN

FULL OUTER JOIN

LEFT OUTER JOIN

RIGHT OUTER JOIN

Programming Languages and Software Engineering Databases #10

Which statements are correct regarding indexes?

When a table is dropped, the corresponding indexes are automatically dropped.

For each DML operation performed, the corresponding indexes are automatically updated.

Indexes should be created on columns that are frequently referenced as part of an expression.

A PRIMARY KEY or a UNIQUE constraint in a table automatically creates a unique index.

Programming Languages and Software Engineering Databases #11

The following SQL statement was written to retrieve the rows for the PRODUCT_ID that has a UNIT_PRICE greater than 1,000 and has been ordered more than five times:

sql
SELECT product_id, COUNT(order_id) total, unit_price 
FROM order_items 
WHERE unit_price>1000 AND COUNT(order_id)>5 
GROUP BY product_id, unit_price; 

Which statement is true regarding this SQL statement?

The statement would execute and give you the desired result.

The statement would not execute because the aggregate function is used in the WHERE clause.

The WHERE clause should have the OR logical operator instead of AND.

The statement would not execute because in the SELECT clause, the unit_price column is placed after the column having the aggregate function.

Programming Languages and Software Engineering Databases #12

Which of the following queries will return the columns FIRST_NAME and SALARY of all employees who have the same manager (MANAGER_ID) as that of the employee with EMPLOYEE_ID = 101 and have a SALARY greater than or equal to the employee with EMPLOYEE_ID = 101?

sql
SELECT first_name, salary 
FROM employees 
WHERE (manager_id, salary) >= ALL (SELECT manager_id, salary 
                                   FROM employees WHERE employee_id = 101)
AND employee_id <> 101;
sql
SELECT first_name, salary 
FROM employees WHERE (manager_id, salary) >= (SELECT manager_id, salary 
                                              FROM employees 
                                              WHERE employee_id = 101) 
AND employee_id <> 101;
sql
SELECT first_name, salary 
FROM employees 
WHERE (manager_id, salary) >= ANY (SELECT manager_id, salary 
                                   FROM employees 
                                   WHERE employee_id = 101 AND employee_id <> 101);
sql
SELECT first_name, salary 
FROM employees WHERE manager_id = (SELECT manager_id 
                                   FROM employees WHERE employee_id = 101) 
AND salary >= (SELECT salary 
               FROM employees 
               WHERE employee_id = 101) 
AND employee_id <> 101;
sql
SELECT e.first_name, e.salary 
FROM employees e, employees m 
WHERE m.employee_id = 101 AND e.manager_id = m.manager_id 
AND e.salary >= m.salary AND e.employee_id <> m.employee_id;
Programming Languages and Software Engineering Databases #13

Evaluate the CREATE TABLE statement:

sql
CREATE TABLE products 
(product_id NUMBER(6) CONSTRAINT prod_id_pk PRIMARY KEY, 
product_name VARCHAR2(15)); 

Which statement is true regarding the PROD_ID_PK constraint?

It would be created only if a unique index is manually created first.

It would be created and would use an automatically created unique index.

It would be created and would use an automatically created non-unique index.

It would be created and remains in a disabled state because no index is specified in the command.

Programming Languages and Software Engineering Databases #14

Given the view V below, when the WITH CHECK OPTION clause generates an exception?

sql
UPDATE V SET Curs = ’Databases II’ WHERE ID=101; 
CREATE VIEW V(ID, Course, EDate) AS 
    SELECT StudID, CourseTitle, EnrollmentDate 
    FROM Enrollments 
    WHERE CourseTitle=’Algebra’ 
    AND Accepted=1 WITH CHECK OPTION;

always

only if the student with ID = 101 applied and he/she is accepted in the Algebra course

only if the student with ID = 101 applied and he/she is accepted in the Database II course

if the student with ID = 101 applied for Algebra course, regardless of the value of the Accepted column

Programming Languages and Software Engineering Java Language #1

What does data encapsulation refer to?

Encapsulation of specific expertise into a class

Hiding access to the private state of an object

Making all the attributes of a class private

Including no methods in a class but only attributes

Hiding access to the entire state of an object.

Programming Languages and Software Engineering Java Language #2

Which of the following statement(s) is/are FALSE for the Java language?

The multiple inheritance can be obtained by applying the simple inheritance by a number of times;

The simple inheritance can be simply obtained implementing a single interface

Only the abstract class can benefit from multiple inheritance

Multiple inheritance can be simulated by implementing multiple interfaces.

Programming Languages and Software Engineering Java Language #3

Which statement(s) from the ones below are true in relation with the Java language?

The final keyword applies to classes, attributes and methods

A final method can only call other final methods in the same class

A final method in a class cannot be overriden in subclasses

A final attribute can be set only once

Final attributes can only exist in final classes.

Programming Languages and Software Engineering Java Language #4

Which of the following assertion(s) hold in relation with the Java language?

Inheritance can always be replaced by objects’ composition

A class can implement any number of interfaces

Using objects’ composition provide a possibility to avoid access restrictions

Object composition is also referred as objects aggregation.

Programming Languages and Software Engineering Java Language #5

What is true about the String class in Java?

The content of a String cannot be modified after creation

The == operator is used to compare the content of two String objects

The String class is final

The String class has an attribute called size providing the length of the string

Programming Languages and Software Engineering Java Language #6

Which of the following statement(s) is/are true about a Java abstract class:

A class which cannot be instantiated

A class having at least an abstract method

A class defined using the abstract keyword

Programming Languages and Software Engineering Java Language #7

Which is the output of the following program?

java
public class MainClass { 
  void method(int ... a){ 
    System.out.print(1 + " "); 
} 
void method(int[] a){ 
  System.out.print(2+ " "); 
} 
public static void main(String args[]){ 
  MainClass a = new MainClass(); 
  a.method(new int[]{1,2,3,4}); 
  } 
}

1

2

1 2

compilation error

execution error

Programming Languages and Software Engineering Java Language #8

Which of the following statement(s) is/are false about Collections and Collection?

Collections is a special type of collection which holds a Set of collection

Both Collection and Collections entity belongs to java.util package

Collections is a utility class

Collection is an interface to Set and List

Collection instances do not use erasure when are instantiated

Programming Languages and Software Engineering Java Language #9

Which of the following lines of code is suitable to start a thread?

java
class X implements Runnable { 
  public void run() { 
    System.out.println(“Thread is in Running state”); 
  } 
  public static void main(String args[]) { 
    /* Missing code? */ 
  } 
}
java
X obj = new X() 
Thread t=new Thread(obj); 
t.start();
java
X obj = new X() 
Thread t=new Thread(X);
java
X x= new X() 
Thread t=new Thread(); 
x.run();
java
Thread t=new Thread(X()) 
t.start();

None of these

java
Thread t=new Thread(new X()) 
t.start();
Programming Languages and Software Engineering Java Language #10

What is the result of the following statements?

java
List list = new ArrayList(); 
list.add("one"); 
list.add("two"); 
list.add(7); 
6: for (String s: list) 
7:       System.out.print(s);

onetwo

onetwo followed by an exception

Compiler error on line 6

Compiler error on line 7

Programming Languages and Software Engineering Python Language #1

Analyze the following code:

python
class A: 
  def __init__(self, s): 
    self.s = s 
  def print(self): 
    print(s) 
a = A("Welcome") 
a.print()

The program has an error because class A does not have a constructor.

The program has an error because class A should have a print method with signature print(self, s).

The program has an error because class A should have a print method with signature print(s).

The program would run if the line print(s) is changed to print(self.s).

Programming Languages and Software Engineering Python Language #2

What is the result of the execution of the following code?

python
x = 2 
for i in range(x): 
  x += 1 
  print (x)

0 1 2 3 4 . . .

0 1

3 4

0 1 2 3

Programming Languages and Software Engineering Python Language #3

Which is the output of the following code?

python
names1 = [’Amir’, ’Barry’, ’Charles’, ’Dao’] 
names2 = names1 
names3 = names1[:] 
names2[0] = ’Alice’ 
names3[1] = ’Bob’ 
sum = 0 
for ls in (names1, names2, names3): 
  if ls[0] == ’Alice’: 
    sum += 1 
  if ls[1] == ’Bob’: 
    sum += 10 print(sum)

print(sum)

11

12

21

22

33

0

Programming Languages and Software Engineering Python Language #4

Which of the following is/are features of DocString?

Provide a convenient way of associating documentation with Python modules, functions, classes, and methods

Provide a convenient way of associating documentation only with Python classes, and methods

All functions should have a docstring

Providing documentation to a application is time-waste

Docstrings can be accessed by the __doc__ attribute on objects

Programming Languages and Software Engineering Python Language #5

Which of the following statements are TRUE about generators (in Python): (this question was marked wrong by the commision)

Generators are lazy in nature

Generators are eager in nature

Generators could make your program to perform faster if the values are generated only once

Generators could make your program to perform faster if the values are generated multiple times

Generators could make your program to perform slower