Home Tuitions

CUET Information practice (IP) Chapter 7 Accessing MySQL Database Using ODBC/JDBC

Board CBSE
Textbook NCERT
Class Class 12
Subject Informative Practices (IP)
Chapter CUET Information practice (IP) Chapter 7 Accessing MySQL Database Using ODBC/JDBC
Chapter Name Chapter 7 Accessing MySQL Database Using ODBC/JDBC
Category CUET (Common University Entrance Test) UG

Practice MCQ Based questions for CUET Information practice (IP) Chapter 7 Accessing MySQL Database Using ODBC/JDBC

This page is created by HT experts and consists of MCQ-based questions with detailed explanations for CUET Information practice (IP) Chapter 7 Accessing MySQL Database Using ODBC/JDBC. All the important concepts of Chapter 7 Accessing MySQL Database Using ODBC/JDBC for the CUET entrance exam are covered by MCQ questions with detailed explanations. Do solve chapter-wise MCQ questions for CUET Computer Science and CUET IP prepared by experts. 

MCQ Based questions for CUET Information practice (IP) Chapter 7 Accessing MySQL Database Using ODBC/JDBC Set-A

Informatics Practices - MCQ on Grouping Records and Table Joins

Class XII

1. The other name for group function is

a. combined function.

b. joint function.

c. aggregate function.

d. count function.

Answer:

(c)

Exp: Group Functions are also called multiple-row and aggregate functions. They work with data of multiple rows and return one result per group of rows processed.

Q.2. The option that considers only distinct values is called

a. distinct.

b. exclusive.

c. distinguish.

d. different.

Answer:

(a)

Exp: Distinct option causes a group function to consider only distinct values of argument expression.

Q.3. The option that considers all values is called

a. distinct.

b. similar.

c. equal.

d. all.

Answer:

(d)

Exp: All option causes a group function to consider all values including all duplicates.

Q.4.Function that computes average is

a. count.

b. sum.

c. avg.

d. having.

Answer:

(c)

Exp: The Avg function computes the average of the given data. It returns the average value of parameter(s) n. The syntax is: AVG ([DISTINCT | ALL] n).

Q.5. Function that counts number of rows in a particular column is

a. sum.

b. count.

c. avg.

d. join.

Answer:

(b)

Exp: Count function counts the number of rows in a given column or expression. It returns number of rows in the query. The syntax is: COUNT ({* DISTINCT | ALL} expr). If we specify asterisk (*), this function returns all rows including duplicates and nulls.

Q.6. Function that returns maximum value from a given column or expression is

a. min.

b. max.

c. maxa.

d. mina.

Answer:

(b)

Exp: Max function returns the maximum value from a given column or expression. It returns the maximum value of argument expr. The syntax is: MAX ([DISTINCT | ALL] expr).

Q.7. Function that returns minimum value from a given column or expression is

a. min.

b. max.

c. mina.

d. maxa.

Answer:

(a)

Exp: Min function returns the minimum value from a given column or expression. It returns the minimum value of argument expr. The syntax is: MIN ([DISTINCT | ALL] expr).

Q.8. Function that returns sum of values in a given column or expression is

a. count.

b. max.

c. avg.

d. sum.

Answer:

(d)

Exp: Sum function returns sum of values in a given column or expression. It returns sum of values of n. The syntax is: SUM ([DISTINCT | ALL] n).

Q.9. MIN is a / an

a. join function.

b. aggregate function.

c. complex function.

d. count function.

Answer:

(b)

Exp: Avg, Count, Max, Min and Sum are called aggregate functions because they operate on aggregate of tuples. The result of an aggregate function is a single value.

Q.10. The command to calculate the total salary for teachers of grade ‘A1’ is

a. COUNT (gross) FROM teacher

and grade = ‘A1’;

b. SELECT SUM (gross) FROM teacher

where grade = ‘A1’;

c. SELECT (count) FROM teacher

or grade = ‘A1’;

d. count FROM teacher

where grade = ‘A1’;

Answer:

(b)

Exp: To calculate the total salary for teachers of grade ‘A1’ is: SELECT SUM (gross) FROM teacher

where grade = ‘A1’;

Q.11. Other name for single row functions is

a. vector functions.

b. line functions.

c. scalar functions.

d. aggregate functions.

Answer:

(c)

Exp: Single row or scalar functions work with a single row at a time. They return a result for every row of a queried table. Example of single row functions are the text/character functions such as year(), day() etc.

Q.12. The other name for group function is

a. multiple function.

b. joint function.

c. scalar function.

d. vector function.

Answer:

(a)

Exp: Group Functions are also called multiple-row and aggregate functions. They return one result per group of rows processed.

Q.13. Functions that work with data of multiple rows at a time are known as

a. scalar function.

b. group function.

c. vector function.

d. multi-function.

Answer:

(b)

Exp: Multiple row or group functions are the group functions that return aggregate value. For example, sum(), count(), max(), min(), avg() etc.

Q.14.The difference between scalar function and multiple function is in the

a. number of columns.

b. number of functions.

c. number of characters.

d. number of rows.

Answer:

(d)

Exp: The difference between scalar function and multiple function is in the no. of rows they act upon. A single row function works with the data of a single row at a time and returns a single result for each row queried upon; a multiple row function works with a group of rows and returns a single result for that group.

Q.15. The clause that combines all the records that have identical values in a particular field or a group of fields is known as

a. having.

b. group by.

c. joint.

d. nested.

Answer:

(b)

Exp: Group by clause combines all the records that have identical values in a particular field or a group of fields. This grouping results into one summary record per group if group functions are used with it.

Q.16. Group within group is known as

a. group by.

b. joint grouping.

c. nested grouping.

d. combined grouping.

Answer:

(c)

Exp: With Group by clause, we can create groups within groups. Such type of grouping is called nested grouping. This can be done by specifying in Group by expression, where the first field determines the highest group level, the second field determines the second group level and so on.

Q.17. A field or expression that has different values in the rows belonging to the group is known as

a. non-group field.

b. joint field.

c. group – field.

d. non-joint field.

Answer:

(a)

Exp: A non-group field (or expression) is the field that has different values in the rows belonging to the group. MySQL will not create any error in which we include a non-group expression in the select-list.

Q.18. Clause used to place condition on group, is known as

a. where.

b. and.

c. having.

d. or.

Answer:

(c)

Exp: Having clause places conditions on groups. Having conditions include aggregate functions. The having clause can contain either a simple Boolean expression or use aggregate function in the having condition.

Q.19. Query that combines rows from two or more tables is known as

a. combine.

b. having.

c. where.

d. join.

Answer:

(d)

Exp: A join is a query that combines rows from two or more tables. In a join-query, more than one table are listed in FROM clause. The function of combining data from multiple tables is called joining.

Q.20. If n1 is the first table and n2 is the second table, then unrestricted join will return

a. n1-n2.

b. n1 X n2.

c. n1+n2.

d. n1/n2.

Answer:

(b)

Exp: In unrestricted join or Cartesian product of two tables, all possible concatenations are formed of all rows of both the tables.

CUET Information practice (IP) Chapter 7 Accessing MySQL Database Using ODBC/JDBC Set-B

Q.21. If two joining tables have fields with same name, then we should use

a. only one name.

b. qualified field names.

c. delete the entire field.

d. where clause.

Answer:

(b)

Exp: Qualified field names are very useful in identifying a field if the two joining tables have fields with same name. Therefore, the columns that have similar names in both tables should be given qualified names, i.e., table name.column name, to avoid ambiguity.

Q.22. To compare columns for equality, we use

a. where.

b. having.

c. equi-join.

d. non-equi join.

Answer:

(c)

Exp: In an equi-join, the values in the columns being joined are compared for equality. All columns in the tables being joined are included in the results. Here, all columns from joining table appear in the output even if they are identical.

Q.23. Clause that lists all tables is known as

a. where.

b. from.

c. having.

d. join.

Answer:

(b)

Exp: From clause lists all the tables involved and where clause specifies the join. Without a where clause, each row of the first table will be joined with every row of the second table which results in a Cartesian product.

Q.24. Query that specifies some relationship other than equality between columns is known as

a. non-equi-join.

b. equi-join.

c. from.

d. where.

Answer:

(a)

Exp: Non-equi-join is a query that specifies some relationship other than equality between the columns.

Q.25. Equi-join minus one of the two identical columns is known as

a. equi-join.

b. cross join.

c. natural join.

d. non-equi-join.

Answer:

(c)

Exp: Through natural join one of the two identical columns can be eliminated by restating the query.

Q.26. Cartesian product of two tables is known as

a. cross join.

b. natural join.

c. equi-join.

d. non-equi join.

Answer:

(a)

Exp: The Cartesian product of two tables is also known as cross join. The cross join (or Cartesian product) is a join that matches each row from one table to every row from another table. Cross join, by default, does not apply any filtering condition on the joined data. However, if we want to filter, we can use where clause of SELECT query.

Q.27. The name of join that can be used so as not to specify a Join-condition is

a. cross join.

b. equi-join.

c. natural join.

d. non-equi-join.

Answer:

(c)

Exp: With natural join clause, we need not specify a join condition. It will automatically create natural-join through appropriate common field.

Q.28. A temporary label given along with the table name in From clause is known as

a. having.

b. count.

c. join.

d. table alias.

Answer:

(d)

Exp: A table alias is a temporary label given along with table name in FROM clause. It is used to cut down the amount of typing required in queries.

Q.29. To search a condition, we use

a. from clause.

b. where clause.

c. having clause.

d. join clause.

Answer:

(b)

Exp: The where clause specifies search condition used to determine data that will appear in the result table. The syntax is: SELECT column name 1, column name 2, … FROM table_name [WHERE condition];

Q.30. Apoorv is SQL programmer with Equip Solutions. He has to write the query to find the sum of the salary for the employees of his organization. The Employee table is as follows:

The correct query is

a. SELECT SUM(SALARY) FROM EMPLOYEE;

b. SELECT (SALARY), EMPLOYEE ;

c. SELECT (SAL);EMP;

d. SELECT EMPLOYEE (SALARY);

Answer:

(a)

Exp: The query to calculate the sum can be written as follows: SELECT SUM(SALARY) FROM EMPLOYEE;

This query will calculate the sum of all the employees working in the Employee table and the result will give the output as 375000.

Q.31. Neha has written the query (SELECT SUM(SALARY) FROM EMPLOYEE;) to calculate the total sum of the salary from the employee table. The Employee table is as follows:

The total value of the sum is

a. 376000.

b. 357000.

c. 375000.

d. 367000.

Answer:

(c)

Exp: The query SELECT SUM(SALARY) FROM EMPLOYEE;

will calculate the sum of all the employees working in the Employee table and the result will give the output as 375000.

Q.32. Vinay has to write the query to find the sum of the salaries grouped by dept from the following Employee table.

The correct way to write the query is

a. SELECT SALARY GROUP BY DEPT_NAME;

b. SELECT SUM(SALARY) GROUP BY DEPT_NAME;

c. SELECT SUM(SALARY) FROM EMPLOYEE, DEPT_NAME;

d. SELECT SUM(SALARY) FROM EMPLOYEE GROUP BY DEPT_NAME;

Answer:

(d)

Exp: The correct query is: SELECT SUM(SALARY) FROM EMPLOYEE GROUP BY DEPT_NAME;

The Group By clause combines all the records that have identical values in a particular field or a group of fields. This grouping results into one summary record per group if group functions are used with it.

Q.33. Based on the given table, Mahima has to write the query to find Sum for each particular department. She also needs to include the DEPT_NAME in the SELECT.

The correct query is

a. SELECT DEPT_NAME, FROM EMPLOYEE GROUP BY DEPT_NAME;

b. SELECT DEPT_NAME, SUM(SALARY) FROM EMPLOYEE GROUP BY DEPT_NAME;

c. SELECT SUM(SALARY) GROUP BY DEPT_NAME;

d. SELECT DEPT_NAME, SUM(SALARY) FROM EMPLOYEE;

Answer:

(b)

Exp: To know the Sum for each particular department, the query will be SELECT DEPT_NAME, SUM(SALARY) FROM EMPLOYEE GROUP BY DEPT_NAME;

The Group By clause combines all the records that have identical values in a particular field or a group of fields. This grouping results into one summary record per group if group functions are used with it.

Q.34. Aditi has been asked to COUNT the number of records in Employee table. The table is as follows:

The correct count is

a. 6.

b. 4.

c. 5.

d. 7.

Answer:

(d)

Exp: To COUNT the number of records in Employee table, the query will be written as: SELECT COUNT (*) “Total” FROM EMPLOYEE

Therefore, the number of records in Employee table is 7.

Q.35. The correct query to Count number of Department names in Employee table is

a. COUNT (DEPT) “Dept Name Count” FROM EMPLOYEE

b. SELECT COUNT (DEPT_NAME) “Dept Name Count”

c. SELECT COUNT (DEPT_NAME) “Dept Name Count” FROM EMPLOYEE

d. SELECT (DEPT_NAME) “Dept Name Count” FROM EMPLOYEE

Answer:

(c)

Exp: To count the number of Department names in Employee table, the query will be:

SELECT COUNT (DEPT_NAME) “Dept Name Count” FROM EMPLOYEE

Therefore, there are four departments in all.

Q.36. Based on the following table, the avg of all the salaries in the organization is

a. 62500.

b. 63500.

c. 53571.

d. 54571.

Answer:

(a)

Exp: The query for the avg of all the salaries is SELECT AVG(SALARY) FROM EMPLOYEE. This query will return the value as 62500.

The SELECT AVG(SALARY) FROM EMPLOYEE would ignore nulls and the way the average is calculated then would be 50,000+60,000+50,000+70,000+75,000+70,000 / 6 = 62500.

Q.37. Based on the following table,

The output of the query Select COUNT(*),COUNT(SALARY) FROM EMPLOYEE; is

a. 6,7.

b. 6,6.

c. 7,6.

d. 7,7.

Answer:

(c)

Exp: Here, Count (*) will return the value 7 and Count (Salary) will return the value as 6, because COUNT(*) is not going to ignore the Nulls in the result whereas COUNT(SALARY) is going to ignore the Nulls.

Q.38. Based on the following table, write the query to find the minimum salary within a particular department

a. SELECT (SALARY),NAME FROM EMPLOYEE

GROUP BY NAME;

b. SELECT MIN(SALARY),NAME FROM EMPLOYEE

GROUP BY NAME;

c. SELECT MIN, NAME FROM EMPLOYEE

GROUP BY NAME;

d. SELECT MIN(SALARY),NAME FROM EMP;

Answer:

(c)

Exp: The query to find the minimum salary within a particular department is:

SELECT MIN(SALARY),NAME FROM EMPLOYEE

GROUP BY NAME;

Therefore, the minimum salary will be 50000.

Q.39. Based on the following table, write the query to find the maximum salary within a particular department

a. SELECT MAX(SALARY),NAME FROM EMPLOYEE GROUP BY NAME;

b. SELECT MAX(SALARY),NAME FROM EMP;

c. SELECT MAX, NAME FROM EMPLOYEE

GROUP BY NAME;

d. SELECT (SALARY),NAME FROM EMPLOYEE

GROUP BY NAME;

Answer:

(a)

Exp: The query to find the maximum salary within a particular department is:

SELECT MAX(SALARY),NAME FROM EMPLOYEE GROUP BY NAME;

Therefore, the maximum salary will be 75000.

Q.40. The syntax for Group By function is

a. SELECT rows

FROM table name [GROUP column name];

b. SELECT column name 1, column name 2,.

[GROUP BY column name];

c. SELECT column name 1, column name 2,.

FROM table name [GROUP BY];

d. SELECT column name 1, column name 2,.

FROM table name

[GROUP BY column name];

Answer:

(d)

Exp: The syntax for Group By function is:

SELECT column name 1, column name 2,.

FROM table name

[GROUP BY column name];

The Group By clause combines all the records that have identical values in a particular field or a group of fields. This grouping results into one summary record per group if group functions are used with it.

Q.41. To join 5 tables, the minimum no. of join conditions that we require is

a. 5.

b. 4.

c. 3.

d. 2.

Answer:

(b)

Exp: To join n tables together, we need a minimum of (n-1 join conditions. Therefore, to join 5 tables, we require (n-1 joins. Here, n = 5. So, (5-1 = 4 joins.

Q.42. Cartesian product is denoted by

a. $.

b. ^.

c. #.

d. X.

Answer:

(d)

Exp: Cartesian product is also known as unrestricted joinor cross join. It is a binary operation and is denoted by (X). It returns all rows in all tables listed in query.

Q.43. The join which is used to return all rows from first table where there are matches in second table or not is

a. natural join.

b. cross join.

c. right join.

d. left join.

Answer:

(d)

Exp: Left join returns all rows from first table where there are matches in second table or not. For unmatched rows of first table, NULL is shown in columns of second table. For example, SELECT <select-list> FROM <table1> LEFT JOIN <table2> ON <joining-condition>;

Q.44. The join that returns all rows from second table where there are matches in first table or not is known as

a. right join.

b. left join.

c. natural join.

d. cross join.

Answer:

(a)

Exp: Right join returns all rows from second table where there are matches in first table or not. The syntax is:

SELECT <select-list> FROM <table1> RIGHT JOIN <table2> ON <joining-condition>;

Q.45. Christ Hospital has a database record of all the patients admitted in the departments as per their sufferings. The Hospital table contains all the necessary information. Based on the following table, the query to select all information of patients of cardiology department is

a. SELECT * HOSPITAL

WHERE Name = ‘Cardiology’;

b. FROM HOSPITAL

WHERE Department = ‘Cardiology’;

c. SELECT * FROM HOSPITAL

WHERE Department = ‘Cardiology’;

d. WHERE Department = ‘Cardiology’;

Answer:

(c)

Exp: The correct query to select all information of patients of cardiology department is

SELECT * FROM HOSPITAL

WHERE Department = ‘Cardiology’;

The SELECT statement is used to pull information from a table. The where clause specifies search condition used to determine data that will appear in the result table.

Q.46. Christ Hospital has a database record of all the patients admitted in the departments as per their sufferings. The Hospital table contains all the necessary information. Based on the following table, the query to list the names of female patients who are in ENT department is

a. SELECT Name WHERE Department = ‘ENT’ and Sex = ‘F’;

b. SELECT Name FROM HOSPITAL

WHERE Department = ‘ENT’ and Sex = ‘F’;

c. SELECT Name FROM HOSPITAL

WHERE Charges = ‘ENT’ and Sex = ‘F’;

d. SELECT FROM HOSPITAL

WHERE Department = ‘ENT’ and Sex = ‘F’;

Answer:

(b)

Exp: The correct query to list the names of female patients who are in ENT department is

SELECT Name FROM HOSPITAL

WHERE Department = ‘ENT’ and Sex = ‘F’;

The SELECT statement is used to pull information from a table. The where clause specifies search condition used to determine data that will appear in the result table.

Q.47. Christ Hospital has a database record of all the patients admitted in the departments as per their sufferings. The Hospital table contains all the necessary information. Based on the following table, the query to list names of all patients with their date of admission in ascending order is

a. SELECT Name FROM HOSPITAL

ORDER BY Dateofadm;

b. SELECT Name FROM HOSPITAL

HAVING Dateofadm;

c. SELECT Name FROM HOSPITAL

AND Dateofadm;

d. SELECT Name FROM HOSPITAL

GROUP Dateofadm;

Answer:

(a)

Exp: The correct query to list names of all patients with their date of admission in ascending order is

SELECT Name FROM HOSPITAL

ORDER BY Dateofadm;

The SELECT statement is used to pull information from a table.

Q.48. Christ Hospital has a database record of all the patients admitted in the departments as per their sufferings. The Hospital table contains all the necessary information. Based on the following table, the query to display Patient’s Name, Charges, Age of only female patients is

a. SELECT Name, FROM HOSPITAL

WHERE Sex = ‘F’;

b. SELECT Charges, Age

WHERE Sex = ‘F’;

c. SELECT HOSPITAL FROM Name, Charges, Age

WHERE Sex = ‘F’;

d. SELECT Name, Charges, Age FROM HOSPITAL

WHERE Sex = ‘F’;

Answer:

(d)

Exp: The correct query to display Patient’s Name, Charges, Age of only female patients is

SELECT Name, Charges, Age FROM HOSPITAL

WHERE Sex = ‘F’;

The SELECT statement is used to pull information from a table. The where clause specifies search condition used to determine data that will appear in the result table.

Q.49. Christ Hospital has a database record of all the patients admitted in the departments as per their sufferings. The Hospital table contains all the necessary information. Based on the following table, the query to count number of patients with Age < 30 is

a. SELECT Age < 30;

b. SELECT COUNT (*) FROM HOSPITAL AND Age < 30;

c. SELECT COUNT (*) FROM HOSPITAL WHERE Age < 30;

d. SELECT COUNT WHERE Age < 30;

Answer:

(c)

Exp: The correct query to count number of patients with Age < 30 is

SELECT COUNT (*) FROM HOSPITAL WHERE Age < 30;

The SELECT statement is used to pull information from a table. The where clause specifies search condition used to determine data that will appear in the result table.

Q.50. A clause that requires a complete join- condition is

a. on.

b. having.

c. using.

d. natural join.

Answer:

(a)

Exp: ON clause requires a complete join-condition and produces equi-join.