Home Tuitions

chapter-Table Creation and Data Manipulation Commands

Important MCQ-Based Questions on Informatics Practices (IP) class 11 chapter-Table Creation and Data Manipulation Commands

This page consists of Important MCQ-Based Questions on Informatics Practices (IP) class 11 chapter-Table Creation and Data Manipulation Commands all the questions are uploaded for practice with detailed explanations of every question. To check the solution, click on the answer. 

Find below Important MCQ-Based Questions on Informatics Practices (IP) class 11 chapter-Table Creation and Data Manipulation Commands

Important Questions for Informatics Practices (IP) class 11 chapter-Table Creation and Data Manipulation Commands set-1

Informatics Practices - MCQ on Table Creation and Data Manipulation Commands

Class XI

Q.1 SQL stands for

a) Standard Question Limited.

b) Structured Quinn Language.

c) Structured Query Language.

d) Standard Question Language.

Answer:

(c)

Explanation: SQL is a database computer language designed for managing data in relational database management systems (RDBMS).

Q.2 DDL stands for

a) Data Department Language.

b) Data Definition Language.

c) Data Development Language.

d) Data Document Language.

Answer:

(b)

Explanation: Data Definition Language (DDL) is a computer language for defining data structures.

Q.3 DML stands for

a) Data Manipulation Language.

b) Data Modification Language.

c) Data Marinated Language.

d) Develop Motivated Language.

Answer:

(a)

Explanation: Data Manipulation Language (DML) is a family of computer languages used by computer programs and/or database users to retrieve, insert, delete and update data in a database.

Q.4 The set of commands which allow us to perform tasks related to data definition is

a) DDL.

b) DML.

c) TCL.

d) SCC.

Answer:

(a)

Explanation: Data Definition Language (DDL) is a computer language for defining data structures.

Q.5 The set of commands which are used to manipulate data is

a) DDL.

b) DML.

c) TCL.

d) SCC.

Answer:

(b)

Explanation: Data Manipulation Language (DML) is a family of computer languages used by computer programs and/or database users to retrieve, insert, delete and update data in a database.

Q.5 ANSI stands for

a) Arabian National Standard Institute.

b) African National Standard Institute.

c) American National Standard Institute.

d) Automated National Standard Institute.

Answer:

(c)

Explanation: The American National Standards Institute or ANSI is a private non-profit organization that oversees the development of voluntary consensus standards for products, services, processes, systems, and personnel in the United States.

Q.7 Metadata is

a) meta of data.

b) meta inside data.

c) data about Meta.

d) data about data.

Answer:

(d)

Explanation: Metadata (meta data, or sometimes meta information) is "data about other data", of any sort in any media.

Q.8 Data Manipulation means

a) retrieval, insertion, deletion and modification.

b) retrieval, insertion, deletion and manifestation.

c) retrieval, invaluation, deletion and modification.

d) ramification, insertion, deletion and modification.

Answer:

(a)

Explanation: Data manipulation is the way in which data can be manipulated and changed.

Q.9 The number of types of DMLs are

a) two.

b) three.

c) four.

d) five.

Answer:

(a)

Explanation: There are two types of DMLs: Procedural DMLs and Non-Procedural DMLs.

Q.10 To insert a tuple in a table, the DML command used is

a) INSERT IN.

b) INSERT ON.

c) INSERT INTO.

d) INSERT ONTO.

Answer:

(c)

Explanation: For e.g., INSERT INTO "table_name" ("column1", "column2", ...)

VALUES ("value1", "value2", ...)

Q.11 To modify a tuple in a table, the DML command used is

a) SELECT

b) MODIFY.

c) UPDATE.

d) MODIFY TO.

Answer:

(c)

Explanation: The UPDATE statement is used to update records in a table.

Q.12 To delete a tuple in a table, the DML command used is

a) DESTROY.

b) DAMAGE.

c) DELETE.

d) TRUNCATE.

Answer:

(c)

Explanation: The DELETE statement is used to delete records in a table.

Q.13 The subdivision of SQL, which is used to create tables, is

a) DDL.

b) DDL AND DML

c) DML

d) DDL or DML

Answer:

(a)

Explanation: Data Definition Language (DDL) provides statements for creation and deletion of tables and indexes.

Q.14 The command, which is used to extract data from database, is

a) SELECT.

b) GET.

c) OPEN.

d) READ.

Answer:

(a)

Explanation: SELECT command retrieves data from one or more tables.

Q.15 The SQL statement, which is used to insert new data in the database, is

a) ADD RECORD.

b) ADD NEW.

c) INSERT.

d) INSERT NEW.

Answer:

(c)

Explanation: Appends a new record to the end of a table that contains the specified field values.

Q.15 The SQL statement, which is used to delete particular data in the database, is

a) DELETE.

b) DROP.

c) TRUNCATE.

d) REMOVE.

Answer:

(a)

Explanation: The SQL TRUNCATE TABLE clause deletes all rows from a database table. We use truncate command only when we want to delete all rows in a table.

Q.17 The correct sql query if I want to change "Hansen" into "Nilsen" in the "LastName" column in the Persons table is

a) UPDATE Persons SET LastName='Nilsen' WHERE LastName='Hansen'.

b) MODIFY Persons SET LastName='Hansen' INTO LastName='Nilsen.

c) UPDATE Persons SET LastName='Hansen' INTO LastName='Nilsen'.

d) MODIFY Persons SET LastName='Nilsen' WHERE LastName='Hansen'.

Answer:

(a)

Explanation: When we need to change some values in an existing row we can use update command. It specifies the rows to be changed using the where clause.

Q.18 The statement, which is used to update data in the database, is

a) SAVE AS.

b) UPDATE.

c) SAVE.

d) MODIFY.

Answer:

(b)

Explanation: UPDATE is used to change some values in an existing row command. It specifies the rows to be changed using the where clause.

Q.19 The proper syntax of CREATE TABLE command is

a) CREATE TABLE <table-name> (<datatype>[(size)],<data type> <size>);

b) Create <tablename> <datatype > <size>,<column name><datatype > <size>;

c) CREATE TABLE <tablename> (<column name1 ,<datatype>[<size>]),<column name2 >, datatype>[<size>]..).

d) CREATE <table-name> (<datatype>[(size)],<data type> <size>);

Answer:

(c)

Explanation: When a table is created its column names, data types and size are supplied for each column.

Q.20 A constraint is

a) a command in the SQL *plus.

b) the conditions or checks on table only .

c) the conditions or checks on columns of a table only.

d) the condition or check on one or more columns of a table.

Answer:

(d)

Explanation: A constraint is a condition or check applicable on a field or set of fields. Two basic types of constraints are column constraints and table constraints.

Q.21 NOT NULL constraint ensure that

a) a column can never have empty values.

b) a column cannot have value 0.

c) a column can have empty value.

d) a column can have value 0.

Answer:

(a)

Explanation: NOT NULL constraint ensure that we cannot leave the column blank or empty and must provide a value to it, where zero or greater than it.

Q.22 UNIQUE constraint ensure that

a) two rows can have same value in the specified column.

b) no two rows can have same value in the specified column.

c) data delicacy can be there.

d) data inconsistency may /may not be there.

Answer:

(a)

Explanation: It ensures the value in a column is unique. It can be applied to one or more columns.

Q.23 In primary key constraints,

a) the primary key can have null value.

b) same as unique constraint.

c) declares column as the primary key and cannot have null value.

d) declares column as the primary key and can have null value.

Answer:

(c)

Explanation: Primary key constraint declares the column, as primary key of the table can primary key cannot have null values. It can be applied to one or more columns.

Q.24 If, I want to select all columns from a table named CLASS, then the correct method, is

a) SELECT * FROM CLASS.

b) SELECT (ALL) FROM CLASS.

c) SELECT CLASS.

d) SELECT *. FROM CLASS.

Answer:

(a)

Explanation: Data is selected from the table using SELECT command.

Q.25 If, I want to select one column named Marks from a table having duplicate rows named Student, then the correct method, is

a) SELECT Marks FROM Student;

b) SELECT DISTINCT Marks from Student;

c) SELECT Marks. Student;

d) SELECT Student “Marks”;

Answer:

(a)

Explanation: DISTINCT eliminates the duplicate rows from the result of SELECT statement.

Q.25 If, I want to create the Customer table specified as Customer (First Name, Last Name, Address, City, Country, Birth Date), then the SQL command, will be

a) CREATE TABLE Customer (First_Name ,Last_Name ,Address ,City,Country char, Birth_Date );

b) CREATE TABLE Customer (First_Name char(25 Last_Name char(25,Address char(50, City char(25,Country char(25,Birth_Date date );

c) CREATE TABLE Customer (First_Name char(25 Last_Name char(25,Address char(50, City char(25,Country char(25,Birth_Date date (21 );

d) CREATE TABLE Customer (First_Name char(25 ||” “|| Last_Name char(25 || “ “ || Address char(50 || “ “|| City char(25 || “ “||Country char(25||” “|| , Birth_Date date “ ADDRESS” );

Answer:

(b)

Explanation: || is concatenation operator and only one column will be displayed as “ADDRESS” and the syntax of date is date. It cannot hold size of (21. It is yyyy-mm-dd.

Q.27 If, I want to select all the records from a table named STUDENTS where First Name is “Aditi” and Last name is “Suneja”, then the SQL command, will be

a) SELECT First Name =’Guneet’, Last Name=’Kaur’.

b) SELECT * From STUDENT where First Name =’Guneet’ OR Last Name=’Kaur’.

c) SELECT * From STUDENT where First Name =’Guneet’ AND Last Name=’Kaur’.

d) SELECT * From STUDENT where First Name LIKE ’Guneet’ AND Last Name LIKE ‘Kaur’.

Answer:

(c)

Explanation: AND operator displays a record when all the conditions are met where as OR operator displays the record if any of the condition is met.

Q.28 If, I want to select all the records from a table named "STUDENTS" where the "FIRST NAME" is alphabetically between (and including) "Guda" and "Aditi", then the SQL command, will be

a) SELECT * FROM STUDENTS WHERE First Name>'Guda” AND First Name<’Aditi’

b) SELECT * FROM STUDENTS WHERE First Name BETWEEN 'Guda' AND ‘Aditi’

c) SELECT First Name>'Guda’ AND First Name< ‘Aditi’ FROM STUDENTS.

d) SELECT (all) FROM STUDENTS WHERE First Name IS 'Guda' AND ‘Aditi’

Answer:

(b)

Explanation: Between operator includes the name “Guda” and “Aditi” also. > and < operators does not include these two names.

Q.29 The major problem with SQL is

a) SQL cannot support object orientation.

b) the same query can be written in many ways, each with vastly different execution plans.

c) SQL syntax is too difficult for non-computer professionals to use.

d) SQL creates excessive locks within the Oracle database.

Answer:

(b)

Explanation: The declarative nature of SQL makes it possible to write an individual query in many different forms, each with identical results. For example, a query can be written with a standard join, a non-correlated sub-query or a correlated sub-query, each producing identical results but with widely varying internal execution plans.

Q.30 The important feature of relational databases and SQL is

a) independence of table relationship.

b) high speed of SQL.

c) powerful GUI front-end.

d) easy to install and use.

Answer:

(a)

Explanation: Prior to the invention of relational databases, it was very difficult to establish relationships with other database objects and systems relied on pointers in order to establish data relationships. With the advent of relational database management, it became possible to establish ad-hoc relationships using SQL joins.

Important Questions for Informatics Practices (IP) class 11 chapter-Table Creation and Data Manipulation Commands set-2

Q.31 The database design feature, which is most important to SQL performance, is

a) removal of data redundancy.

b) the introduction of data redundancy.

c) the introduction of non-first normal form relations.

d) the introduction of SQL*Plus.

Answer:

(b)

Explanation: The degree of normalization in the database design is critical to SQL performance. The ideal candidates for the introduction of redundancy are small data items that are updated very infrequently.

Q.32 The command, which will delete all data from a table and will not write to the rollback segment, is

a) DROP.

b) DELETE.

c) CASCADE.

d) TRUNCATE.

Answer:

(d)

Explanation: The truncate command does not write data to the user segment.

Q.33 The sql statement, which will return only different values, duplicate values will be deleted in select statement, is

a) SELECT DIFFERENT.

b) SELECT UNIQUE.

c) SELECT NOT NULL.

d) SELECT DISTINCT.

Answer:

(d)

Explanation: DISTINCT removes duplicate values.

Q.34 The SQL keyword, which is used in ascending or descending order, i.e. sorting the result set, is

a) ORDER BY.

b) HAVING.

c) GROUP BY.

d) SORT.

Answer:

(a)

Explanation: ORDER BY is used for sorting the result set. By default it will sort in ascending order but if, we want the result set in descending order, then we use ORDER BY DESC.

Q.35 If, I want to change Roll No 400 only for those items that have Roll No 300, then the SQL statement, will be

a) MODIFY items SET Roll No=400 Where Roll N = 300;

b) UPDATE items SET Roll No=400 Where Roll N = 300;

c) UPDATE items Roll No=400 in place of Roll N = 300;

d) UPDATE items Roll No=400 HAVING Roll N = 300;

Answer:

(b)

Explanation: UPDATE command is used when we want to change the values of some specified columns and it is used with WHERE clause.

Q.35 If, I want to update roll no to 300 and marks to 100 of students having icode <I040, then the SQL statement, will be

a) UPDATE items SET Roll No=400; Marks = 100 Where Icode<I040;

b) UPDATE items SET Roll No=400, Marks = 100 Where Icode<I040;

c) UPDATE items SET Roll No=400 And SET Marks = 100 Where Icode<I040

d) UPDATE items SET Roll No=400, Marks = 100 Where Icode>I040

Answer:

(b)

Explanation: To update multiple columns, multiple column assignments can be specified with SET clause, separated by commas.

Q.37 DROP table command in sql lets you drop a table

a) if it has rows.

b) if it is not an empty table.

c) it may or may not be an empty table.

d) only if it is an empty table.

Answer:

(d)

Explanation: A table with rows in it cannot be dropped. First we use a DELETE command to remove all the rows then we can drop the empty table so that it is no longer recognized in the database.

Q.38 To remove the tuples from an employee table where salary >5000 the sql query is

a) DELETE FROM table named employee WHERE salary >5000;

b) DELETE employee WHERE salary >5000;

c) DELETE FROM employee WHERE salary >5000;

d) DELETE employee having salary>5000;

Answer:

(c)

Explanation: Delete command is used to remove some or all of the rows in a table.

Q.39 To remove all the tuples from an employee table the SQL query is

a) DELETE FROM employee;

b) DELETE ALL FROM employee;

c) DELETE * FROM employee;

d) DELETE employee;

Answer:

(a)

Explanation: DELETE <tablename> will delete all the rows in a table and table would be empty.

Q.40 To insert values in the tablename students (name, roll no, sex, grade, salary) the SQL query would be

a) INSERT INTO students VALUES (2,’aditi’, ‘f’,’e1’, 10,000;

b) INSERT INTO students VALUES (2,’aditi’, ‘e1,’f’, 10,000;

c) INSERT INTO students VALUES (‘aditi’, 20,‘f’,’e1’, 10,000;

d) INSERT INTO (name, roll no, sex, grade, salary) VALUES (‘aditi’, ‘20’,‘f’,’e1’, 10,000;

Answer:

(c)

Explanation: To insert values either of these commands can be used. INSERT INTO students VALUES (‘aditi’, ‘20’,‘f’,’e1’, 10,000; or INSERT INTO students (name, roll no, sex, grade, salary) VALUES (‘aditi’, ‘20’,‘f’,’e1’, 10,000;. The data values order should match with the table columns when we create table.

Q.41 If, I want to insert only name and roll no, then I use the command INSERT INTO students VALUES (‘aditi’, 20; the columns that are not listed

a) will have 0 value.

b) will have null value always.

c) will have default value always.

d) will have default value if it is defined otherwise Null value.

Answer:

(d)

Explanation: In an INSERT statement, only those columns can be omitted that have either default value defined or they allow null values.

Q.42 If, I want to select the rows from students table whose salary >2000 and place them in the employee table, then the sql query would be

a) INSERT INTO employee SELECT * FROM student WHERE salary >2000;

b) INSERT INTO employee SELECT * FROM students WHERE salary >2000;

c) INSERT INTO students SELECT * FROM employee WHERE salary >2000;

d) INSERT INTO employee SELECT * FROM student HAVING salary >2000;

Answer:

(b)

Explanation: We will simply replace the VALUES clause with the sql query selecting the rows from the employee table.

Q.43 ALTER TABLE command

a) add columns in a table only.

b) modify the column size only.

c) delete some columns in a table only.

d) can either add columns, modify the sizes or delete columns in a table.

Answer:

(d)

Explanation: ALTER table command is used to change the definitions of existing tables. IT can modify, delete or change sizes of columns.

Q.44 If, I want to calculate the total salary for employees grade ‘A1’, then the sql query would be

a) SELECT total (salary) FROM employee WHERE grade=’A1’;

b) SELECT sum (salary) FROM employee WHERE grade=”A1”;

c) SELECT sum (salary) FROM employee WHERE grade=’A1’;

d) SELECT sum (salary) FROM employee HAVING (grade) =”A1”;

Answer:

(c)

Explanation: Sum is used to calculate the total salary.

Q.45 To display the average salary of employees with grades ‘E2’ or ‘E4’, the sql command is

a) SELECT avg(salary) FROM employee WHERE (grade=’E2’ OR grade=’E4’);

b) SELECT avg(salary WHERE (grade=’E2’ OR grade=’E4’);

c) DISPLAY avg(salary) FROM employee WHERE (grade=’E2’ OR grade=’E4’);

d) SELECT avg(salary) FROM employee HAVING (grade=’E2’ AND grade=’E4’);

Answer:

(a)

Explanation: AVERAGE is an aggregate function used in SQL and is used with WHERE clause.

Q.45 To count the number of employees in employee table, the sql command is

a) SELECT count (*) FROM employee;

b) SELECT count (*) employee;

c) SELECT * FROM employee;

d) SELECT count FROM employee;

Answer:

(a)

Explanation: COUNT is also an aggregate function used in SQL.

Q.47 To count the number of cities, the different members belong to in employee

table, the SQL command is

a) SELECT count (DISTINCT) FROM employee;

b) SELECT count (DISTINCT city) FROM employee;

c) SELECT count (ALL city) FROM employee;

d) SELECT count (DISTINCT city);

Answer:

(b)

Explanation: DISTINCT keyword ensures that the multiple entries of the same city are ignored.

Q.48 The subdivision of SQL, which is used to put values in tables, is

a) DDL.

b) DDL AND DML.

c) DML.

d) DNL.

Answer:

(c)

Explanation: Data Manipulation Language (DML) provides statements to enter, update, delete data and perform complex queries on these tables.

Q.49 The command that is used to create tables in the database is

a) MAKE TABLE.

b) START TABLE.

c) CREATE TABLE.

d) CLICK TABLE.

Answer:

(c)

Explanation: The SQL syntax for CREATE TABLE is

CREATE TABLE "table_name"

("column 1" "data_type_for_column_1",

"column 2" "data_type_for_column_2",

... );

Q.50 The command used to insert data in the table is

a) INSERT.

b) INSERT ONTO.

c) INSERT INTO.

d) INSERT BETWEEN.

Answer:

(c)

Explanation: The syntax for inserting data into a table one row at a time is as follows:

INSERT INTO "table_name" ("column1", "column2", ...)

VALUES ("value1", "value2", ...);

Important Questions for Informatics Practices (IP) class 11 chapter-Table Creation and Data Manipulation Commands set-3

Q.51 Nulls are inserted in the table by typing

a) NULL with quotes.

b) NULL without quotes.

c) NULL with a semi-colon.

d) NULL without semi-colon.

Answer:

(b)

Explanation: NULL is a special keyword in SQL that depicts an empty value. A column having NULL is not empty but stores an empty value.

Q.52 Existing data in tables can be changed with

a) EXIST COMMAND.

b) UPDATE COMMAND.

c) REMOVE COMMAND.

d) DESTROY COMMAND.

Answer:

(b)

Explanation: An UPDATE statement is used to directly change or modify the values stored in one or more fields in a specified record in a single table.

Q.53 Tuples in the table can be deleted using

a) DELETE COMMAND.

b) REMOVE COMMAND.

c) DESTROY COMMAND.

d) TRUNCATE COMMAND.

Answer:

(a)

Explanation: This command is used to delete rows or records in a table.

Q.54 The command used to alter the definition of already created tables is

a) ALTER TABLE.

b) CHANGE TABLE.

c) ASSOCIATE TABLE.

d) TRUNC TABLE.

Answer:

(a)

Explanation: The ALTER TABLE statement allows you to rename an existing table. It can also be used to add, modify, or drop a column from an existing table.

Q.55 The command used to drop a table from a database is

a) DELETE TABLE.

b) REMOVE TABLE.

c) DESTROY TABLE.

d) DROP TABLE.

Answer:

(d)

Explanation: The command is DROP TABLE "table_name".

Q.55 Subset of SQL commands that are used to describe various entities of the database is

a) DDL.

b) DML.

c) DRL.

d) DCL.

Answer:

(a)

Explanation: Data Definition Language (DDL) is a computer language for defining data structures.

Q.57 Subset of SQL commands that are used to manipulate data in tables is

a) DDL.

b) DML.

c) DRL.

d) DCL.

Answer:

(b)

Explanation: Data Manipulation Language (DML) is a family of computer languages used by computer programs and/or database users to retrieve, insert, delete and update data in a database.

Q.58 The command for creating a database is

a) USE DATABASE.

b) CREATE DATABASE.

c) MAKE DATABASE.

d) OPEN DATABASE.

Answer:

(b)

Explanation: The syntax used is CREATE DATABASE <database name>.

Q.59 The syntax used for opening a database is

a) OPEN <database name>;

b) SHOW <database name>;

c) USE <database name>;

d) VIEW <database name>;

Answer:

(c)

Explanation: For example, to open sample database that was created just before, one needs to write: USE sample;

Q.60 To check the names of existing databases, the command used is

a) VIEW DATABASES;

b) SHOW DATABASES;

c) CHECK DATABASES;

d) SEE DATABASES;

Answer:

(b)

Explanation: SHOW DATABASES list the databases on the MySQL server host. SHOW SCHEMAS is a synonym for SHOW DATABASES.

Q.61 To remove a database, one needs to issue a command named 

a) REMOVE DATABASE.

b) DROP DATABASE.

c) DELETE DATABASE.

d) CONTROL DATABASE.

Answer:

(b)

Explanation: The syntax is DROP DATABASE <database name>;

Q.62 A condition or a check that is applied to a column or set of columns in a table is

a) restriction.

b) constraint.

c) condition.

d) view.

Answer:

(b)

Explanation: A constraint is a condition or check applicable on a field or set of fields.

Q.63 The constraints applied to maintain data integrity are known as

a) integrity constraints.

b) unique constraints.

c) default constraints.

d) check constraint.

Answer:

(a)

Explanation: Integrity constraints are used to ensure accuracy and consistency of data in a relational database.

Q.64 The two basic types of constraints are

a) column and unique constraint.

b) primary key and default constraint.

c) check and foreign key constraints.

d) column constraint and table constraint.

Answer:

(d)

Explanation: The difference between two is that column constraints apply only to individual columns, whereas table constraints apply to groups of one or more columns.

Q.65 The constraint that ensures that no two rows have the same value in the specified column is

a) unique constraint.

b) primary key constraint.

c) default constraint.

d) check constraint.

Answer:

(a)

Explanation: This constraint when applied to columns ensures that there cannot exist more than one NULL value in the column.

Q.65 The difference between unique constraint and primary key constraint is that

a) unique key allows null values but the primary key cannot allow null values.

b) unique key allows duplicate values but the primary key cannot allow duplicate values.

c) unique key allows foreign key values but the primary key cannot allow these values.

d) unique key allows character values but the primary key cannot allow these values.

Answer:

(a)

Explanation: The primary keys cannot allow null values, thus, this constraint must be applied to columns declared as NOT NULL.

Q.67 The constraint that declares a column as the primary key of the table is

a) unique constraint.

b) primary key constraint.

c) default constraint.

d) check constraint.

Answer:

(b)

Explanation: Primary key constraint declares a column as the primary key of the table. This constraint is similar to unique constraint except that only one column can be applied in this constraint.

Q.68 The number of default values that a column can have is

a) one.

b) two.

c) three.

d) four.

Answer:

(a)

Explanation: A default value can be specified for a column using the DEFAULT clause.

Q.69 The constraint that limits values that can be inserted into a column of a table is

a) unique constraint.

b) primary key constraint.

c) default constraint.

d) check constraint.

Answer:

(d)

Explanation: When a check constraint involves more than one column from the same table, it is specified after all the columns have been defined.

Q.70 Referential integrity is ensured through

a) unique constraint.

b) foreign key constraint.

c) default constraint.

d) check constraint.

Ans. b)

Explanation: Referential integrity is a system of rules that a DBMS uses to ensure that relationships between records in the related table are valid.

Q.71 To enforce a foreign key constraint at the column level, the syntax to be followed is

a) Column name datatype (size) REFERENCEStable-name

[(column name)] [ ON DELETE CASCADE] [ ON UPDATE CASCADE]

b) Columnname datatype (size) REFERENCES tablename

[(columnname)] [ ON DELETE CASCADE] [ ON DELETE CASCADE]

c) Columnname datatype (size) REFERENCES tablename

[(columnname)] [ ON DELETE CASCADE] [ ON MODIFY CASCADE]

d) Columnname datatype (size) REFERENCES tablename

[(columnname)] [ ON DELETE CASCADE] [ ON TRANSLATE CASCADE]

Ans. a)

Explanation: Here, the first column name is the name of related column in child table and the column name appearing after REFERENCES clause is the name of related column in the parent table.

Q.72 Keywords RESTRICT|SET NULL|NO ACTION is used in place of

a) DESCRIBE.

b) CASCADE.

c) COMMIT.

d) DELETE.

Answer:

(b)

Explanation: RESTRICT will reject the operation; NO ACTION will not allow deletion or updation of a primary key as long as there is a foreign key dependent on it; SET NULL will set NULL in the foreign key column.

Q.73 When a constraint is to be applied on a group of columns of the table, it is called

a) column constraint.

b) table constraint,

c) row constraint.

d) database constraint.

Answer:

(a)

Explanation: The table constraints appear in the end of table definition.

Q.74 MySQL names constraints as

a) Cons.

b) Constraint

c) Cons_no

d) SYS_cn

Answer:

(d)

Explanation: MYSQL assigns a unique name to each constraint defined by us. Here, n is the integer that makes the constraint name unique.

Q.75 MySQL names constraints as SYS_Cn, where n is

a) number of foreign constraints defined in a table.

b) an integer that makes the constraint name unique.

c) number of same data type in related columns.

d) Number of constraints in a table.

Answer:

(b)

Explanation: MYSQL assigns a unique name to each constraint defined by us. Here, n is the integer that makes the constraint name unique.

Q.75 The syntax for assigning names to constraints is

a) CONSTRAINT <name-of-constraint> <definition-of-constraint>

b) CON <name-of-constraint> <definition-of-constraint>

c) CONS <name-of-constraint> <definition-of-constraint>

d) CONSN <name-of-constraint> <definition-of-constraint>

Answer:

(a)

Explanation: MYSQL assigns a unique name to each constraint defined by us. MySQL names constraints as SYS_Cn, where n is an integer that makes the constraint name unique.

Q.77 To view the CREATE TABLE statement of an existing table, the command used is

a) VIEW CREATE TABLE <tablename>;

b) GET CREATE TABLE <tablename>;

c) SHOW CREATE TABLE <tablename>;

d) CREATE TABLE <tablename>;

Answer:

(c)

Explanation: If one wants to view the CREATE TABLE statement of an existing table, one may write: SHOW CREATE TABLE <tablename>

Q.78 To make the changes permanent, the command used is

a) ROLLBACK.

b) COMMIT.

c) PERMANENT.

d) NO CHANGE.

Answer:

(b)

Explanation: Commit refers to the idea of making a set of tentative changes permanent. A popular usage is at the end of a transaction.

Q.79 To remove the entire contents of table ‘STUDENT’, the command used is

a) TRUNCATE FROM STUDENT;

b) REMOVE FROM STUDENT;

c) DELETE FROM STUDENT;

d) ELIMINATE FROM STUDENT;

Answer:

(c)

Explanation: By using this command, the table will not be deleted but the entire contents of the table are deleted.

Q.80 An operation which returns the database to some previous state is known as

a) commit.

b) rollback.

c) savepoint.

d) permanent.

Answer:

(b)

Explanation: Rollbacks are important for database integrity, because they mean that the database can be restored to a clean copy even after erroneous operations are performed.

Informatics Practices