Database MCQ Number 00883

Database MCQ Set 1

1. Which of the following is not a process of generating a good relational schema?
a) Converting ER diagrams to relational schema
b) Decomposing the relational schema while satisfying functional dependencies
c) Joining multiple relations together to form a single relation containing all the attributes
d) A design of relations which is then tested and modified to satisfy given normal forms

Answer

Answer: c [Reason:] Joining multiple relations together to form a single relation containing all the attributes is not a method for the development of good relational schema because it might violate the normal forms if it is combined.

2. What is unique role assumption?
a) The attribute name has a unique meaning in the database
b) The attributes are all unique
c) No two tuples have even a single same value in a relation
d) None of the mentioned

Answer

Answer: a [Reason:] Unique role assumption means that the attribute names must have unique meaning in the database. This prevents us from using the same attribute to mean different things in different schemas.

3. The process of making a normalized schema unnormalized is called as ___
a) Unnormalization
b) Denormalization
c) Renormalization
d) Annormalization

Answer

Answer: b [Reason:] The process of making a normalized schema unnormalized is called as denormalization. Designers use it to tune performance of systems to support time-critical operations.

4. State true or false: Crosstabs are not desirable in a database design
a) True
b) False

Answer

Answer: a [Reason:] Crosstabs may be useful for the users but they are not desirable in a database system because the queries would get more complicated due to the addition of cross tabs.

5. The data that have a time interval associated with them during which they are valid are called as ________
a) Timed data
b) Temporal data
c) Model data
d) Clocked data

Answer

Answer: b [Reason:] The data that have a time interval associated with them during which they are valid are called as Temporal data. We use the term snapshot to mean the value of the data at a particular point in time.

6. The value of the data at a particular time is called as?
a) Instance
b) Picture
c) Snapshot
d) None of the mentioned

Answer

Answer: c [Reason:] The value of the data at a particular time is called as a snapshot. This is used in temporal data.

7. Functional dependencies that have a time associated with them during which they are valid are called as________
a) Timed functional dependencies
b) Clocked functional dependencies
c) Temporal functional dependencies
d) Modeled functional dependencies

Answer

Answer: c [Reason:] Functional dependencies that have a time associated with them during which they are valid are called as temporal functional dependencies. All snapshots of the relation should satisfy the functional dependency for it to be a temporal functional dependency.

8. State true or false: Overlapping time intervals cannot be prevented
a) True
b) False

Answer

Answer: b [Reason:] IF a system supports a native valid time type, then the system can detect and prevent overlapping time intervals.

9. Which of the following is the time of temporal data that record when a fact was recorded in a database?
a) Transaction time
b) Valid time
c) Enter time
d) Exit time

Answer

Answer: a [Reason:] The transaction time is the time of temporal data that records when a fact was recorded in a database.

10. To specify the foreign keys in relations referencing temporal data we need to specify _______
a) The time interval
b) The Boolean value for the working
c) The integer corresponding to the relation number
d) None of the mentioned

Answer

Answer: a [Reason:] To specify the foreign keys in relations referencing temporal data we need to specify the time interval. The time interval specification thus preserves referential integrity in the relation.

Database MCQ Set 2

Q1) Create a Bank Database schema with the following relations and select an appropriate primary key.
account(account_number, branch_name, balance)
branch (branch_name, branch_city, assets)
customer (customer_name customer_street, customer_city)
loan (loan_number, branch_name, amount)
depositor((customer_name, account_number)
borrower(customer_name, loan_number)

Answer

Answer: create table account
(account_number varchar(15) not null unique,
branch_name varchar(15) not null,
balance number not null,
primary key(account_number));

create table branch
(branch_name varchar(15) not null unique,
branch_city varchar(15) not null,
assets number not null,
primary key(branch_name));

create table customer
(customer_name varchar(15) not null unique,
customer_street varchar(12) not null,
customer_city varchar(15) not null,
primary key(customer_name));

create table loan
(loan_number varchar(15) not null unique,
branch_name varchar(15) not null,
amount number not null,
primary key(loan_number));

create table depositor
(customer_name varchar(15) not null,
account_number varchar(15) not null,
primary key(customer_name, account_number),
foreign key(account_number) references account(account_number),
foreign key(customer_name) references customer(customer_name));

create table borrower
(customer_name varchar(15) not null,
loan_number varchar(15) not null,
primary key(customer_name, loan_number),
foreign key(customer_name) references customer(customer_name),
foreign key(loan_number) references loan(loan_number));

NOTE: Please insert the following data into the database for the execution of further queries.

insert into customer values (‘Jones’, ‘Main’, ‘Harrison’);
insert into customer values (‘Smith’, ‘Main’, ‘Rye’);
insert into customer values (‘Hayes’, ‘Main’, ‘Harrison’);
insert into customer values (‘Curry’, ‘North’, ‘Rye’);
insert into customer values (‘Lindsay’, ‘Park’, ‘Pittsfield’);
insert into customer values (‘Turner’, ‘Putnam’, ‘Stamford’);
insert into customer values (‘Williams’, ‘Nassau’, ‘Princeton’);
insert into customer values (‘Adams’, ‘Spring’, ‘Pittsfield’);
insert into customer values (‘Johnson’, ‘Alma’, ‘Palo Alto’);
insert into customer values (‘Glenn’, ‘Sand Hill’, ‘Woodside’);
insert into customer values (‘Brooks’, ‘Senator’, ‘Brooklyn’);
insert into customer values (‘Green’, ‘Walnut’, ‘Stamford’);
insert into customer values (‘Jackson’, ‘University’, ‘Salt Lake’);
insert into customer values (‘Majeris’, ‘First’, ‘Rye’);
insert into customer values (‘McBride’, ‘Safety’, ‘Rye’);

insert into branch values (‘Downtown’, ‘Brooklyn’, 900000);
insert into branch values (‘Redwood’, ‘Palo Alto’, 2100000);
insert into branch values (‘Perryridge’, ‘Horseneck’, 1700000);
insert into branch values (‘Mianus’, ‘Horseneck’, 400200);
insert into branch values (‘Round Hill’, ‘Horseneck’, 8000000);
insert into branch values (‘Pownal’, ‘Bennington’, 400000);
insert into branch values (‘North Town’, ‘Rye’, 3700000);
insert into branch values (‘Brighton’, ‘Brooklyn’, 7000000);
insert into branch values (‘Central’, ‘Rye’, 400280);

insert into account values (‘A-101’, ‘Downtown’, 500);
insert into account values (‘A-215’, ‘Mianus’, 700);
insert into account values (‘A-102’, ‘Perryridge’, 400);
insert into account values (‘A-305’, ‘Round Hill’, 350);
insert into account values (‘A-201’, ‘Perryridge’, 900);
insert into account values (‘A-222’, ‘Redwood’, 700);
insert into account values (‘A-217’, ‘Brighton’, 750);
insert into account values (‘A-333’, ‘Central’, 850);
insert into account values (‘A-444’, ‘North Town’, 625);

insert into depositor values (‘Johnson’,’A-101′);
insert into depositor values (‘Smith’, ‘A-215’);
insert into depositor values (‘Hayes’, ‘A-102’);
insert into depositor values (‘Hayes’, ‘A-101’);
insert into depositor values (‘Turner’, ‘A-305’);
insert into depositor values (‘Johnson’,’A-201′);
insert into depositor values (‘Jones’, ‘A-217’);
insert into depositor values (‘Lindsay’,’A-222′);
insert into depositor values (‘Majeris’,’A-333′);
insert into depositor values (‘Smith’, ‘A-444’);

insert into loan values (‘L-17’, ‘Downtown’, 1000);
insert into loan values (‘L-23’, ‘Redwood’, 2000);
insert into loan values (‘L-15’, ‘Perryridge’, 1500);
insert into loan values (‘L-14’, ‘Downtown’, 1500);
insert into loan values (‘L-93’, ‘Mianus’, 500);
insert into loan values (‘L-11’, ‘Round Hill’, 900);
insert into loan values (‘L-16’, ‘Perryridge’, 1300);
insert into loan values (‘L-20’, ‘North Town’, 7500);
insert into loan values (‘L-21’, ‘Central’, 570);

insert into borrower values (‘Jones’, ‘L-17’);
insert into borrower values (‘Smith’, ‘L-23’);
insert into borrower values (‘Hayes’, ‘L-15’);
insert into borrower values (‘Jackson’, ‘L-14’);
insert into borrower values (‘Curry’, ‘L-93’);
insert into borrower values (‘Smith’, ‘L-11’);
insert into borrower values (‘Williams’,’L-17′);
insert into borrower values (‘Adams’, ‘L-16’);
insert into borrower values (‘McBride’, ‘L-20’);
insert into borrower values (‘Smith’, ‘L-21’);

Database MCQ Set 3

1. Which of the following is not a system database ?
a) Northwind
b) Master
c) Tempdb
d) All of the mentioned

Answer

Answer: a [Reason:] Northwind is a sample database.

2. Point out the correct statement :
a) By default, tempdb autogrows as needed while SQL Server is running
b) By default, master autogrows as needed while SQL Server is running
c) By default, pubs autogrows as needed while SQL Server is running
d) By default, msdb autogrows as needed while SQL Server is running

Answer

Answer: a [Reason:] Tempdb holds all temporary tables and temporary stored procedures.

3. Which of the following holds temporary data ?
a) Northwind
b) Master
c) Tempdb
d) Msdb

Answer

Answer: c [Reason:] Tempdb is a global resource; the temporary tables and stored procedures for all users connected to the system are stored there.

4. Which is the most important system database ?
a) Northwind
b) Master
c) Tempdb
d) All of the mentioned

Answer

Answer: b [Reason:] The master database records all of the system level information for a SQL Server system.

5. Point out the wrong statement related to master database :
a) They are used to provide details of an backup plans
b) master records the information for SQL Server temporarily
c) master records the initialization information for SQL Server
d) None of the mentioned

Answer

Answer: b [Reason:] Master is the database that records the existence of all other databases.

6. Which database is used as template for all databases ?
a) Northwind
b) Master
c) Tempdb
d) Model

Answer

Answer: d [Reason:] When a CREATE DATABASE statement is issued, the first part of the database is created by copying in the contents of the model database.

7. Which of the following database is used by SQL Server Agent ?
a) Pubs
b) Msdb
c) Tempdb
d) Model

Answer

Answer: b [Reason:] The msdb database is used by SQL Server Agent for scheduling alerts and jobs, and recording operators.

8. How many types of system databases are present in SQL Server 2008?
a) 3
b) 4
c) 5
d) 6

Answer

Answer: b [Reason:] Microsoft SQL Server 2008 have four system databases.

9. Which of the following system database occupies more space and memory ?
a) Master
b) Msdb
c) Tempdb
d) Model

Answer

Answer: a [Reason:] The master database records all of the system level information for a SQL Server system.

10. The ___ database stores basic configuration information for the server.
a) Master
b) Msdb
c) Tempdb
d) Model

Answer

Answer: a [Reason:] Master database includes information about the file locations of the user databases, as well as logon accounts, server configuration settings, and a number of other items such as linked servers and startup stored procedures.

Database MCQ Set 4

1. Which one of the following statements should be used to include a file?
a) #include ‘filename’;
b) include ‘filename’;
c) @include ‘filename’;
d) #include ;

Answer

Answer: b [Reason:] An example of this-

  1. <?php
  2. #include 'mysql.connect.php';
  3. //begin database selection and queries.
  4. ?>

2. Which one of the following methods is responsible for sending the query to the database?
a) query()
b) send_query()
c) sendquery()
d) query_send()

Answer

Answer: a [Reason:] Its prototype looks like-

class mysqli
{
	mixed query(string query [, int resultmode])
}

3. Which one of the following methods recuperates any memory consumed by a result set?
a) destroy()
b) remover()
c) alloc()
d) free()

Answer

Answer: d [Reason:] Once this method is executed, the result set is no longer available.

4. Which of the methods are used to manage result sets using both associative and indexed arrays?
a) get_array() and get_row()
b) get_array() and get_column()
c) fetch_array() and fetch_row()
d) fetch_array() and fetch_column()

Answer

Answer: c [Reason:] Their prototype is as follows-

calss mysqli_result
{
	mixed fetch_array ([int resulttype])
}
 
calss mysqli_result
{
	mixed fetch_row()
}

5. Which one of the following method is used to retrieve the number of rows affected by an INSERT, UPDATE, or DELETE query?
a) num_rows()
b) affected_rows()
c) changed_rows()
d) new_rows()

Answer

Answer: b [Reason:] The method num_rows() is only useful for determining the number of rows retrieved by a SELECT query. But to retrieve the number of rows affected by INSERT, UPDATE, or DELETE query, use affected_rows().

6. Which version of MySQL introduced the prepared statements?
a) MySQL 4.0
b) MySQL 4.1
c) MySQL 4.2
d) MySQL 4.3

Answer

Answer: b [Reason:] When the query() method is looped repeatedly it comes at a cost of both overhead, because of the need to repeatedly parsing of the almost identical query for validity, and coding convenience, because of the need to repeatedly reconfigure the query using the new values for each iteration. To help resolve the issues incurred by repeatedly executed queries, MySQL introduced prepared statements.

7. Which of the following methods is used to execute the statement after the parameters have been bound?
a) bind_param()
b) bind_result()
c) bound_param()
d) bound_result()

Answer

Answer: a [Reason:] Once the statement has been prepared, it needs to be executed. Exactly when it’s executed depends upon whether you want to work with bound parameters or bound results. In the case of bound parameters, you’d execute the statement after the parameters have been bound with the bind_param() method.

8. Which one of the following methods is used to recuperating prepared statements resources?
a) end()
b) finish()
c) final()
d) close()

Answer

Answer: d [Reason:] Once you’ve finished using a prepared statement, the resources it requires can be recuperated with the close() method.

9. Which method retrieves each row from the prepared statement result and assigns the fields to the bound results?
a) get_row()
b) fetch_row()
c) fetch()
d) row()

Answer

Answer: c [Reason:] Its prototype follows:

  1. class mysqli
  2. {
  3. boolean fetch()
  4. }

10. Which method rolls back the present transaction?
a) commit()
b) undo()
c) back()
d) rollback()

Answer

Answer: d [Reason:] Its prototype follows:

class mysqli
{
boolean rollback()
}

Database MCQ Set 5

1. Which one of the following databases has PHP supported almost since the beginning?
a) Oracle Database
b) SQL
c) SQL+
d) MySQL

Answer

Answer: d [Reason:] None.

2. The updated MySQL extension released with PHP 5 is typically referred to as..
a) MySQL
b) mysql
c) mysqli
d) mysqly

Answer

Answer: c [Reason:] The updated MySQL extension with PHP 5 is known as MySQL and typically referred to as mysqli.

3. Which one of the following lines need to be uncommented or added in the php.ini file so as to enable mysqli extension?
a) extension=php_mysqli.dll
b) extension=mysql.dll
c) extension=php_mysqli.dl
d) extension=mysqli.dl

Answer

Answer: a [Reason:] Also make sure that extension_dir directive points to the appropriate directory.

4. In which version of PHP was MySQL Native Driver(also known as mysqlnd) introduced?
a) PHP 5.0
b) PHP 5.1
c) PHP 5.2
d) PHP 5.3

Answer

Answer: d [Reason:] PHP required that MySQL client library be installed on the server from which PHP was communicating with MySQL, whether the MySQL server also happened to reside locally or elsewhere. PHP 5.3 removes this problem by introducing MySQL Native Driver.

5. Which one of the following statements is used to create a table?
a) CREATE TABLE table_name (column_name column_type);
b) CREATE table_name (column_type column_name);
c) CREATE table_name (column_name column_type);
d) CREATE TABLE table_name (column_type column_name);

Answer

Answer: a [Reason:] None.

6. Which one of the following statements instantiates the mysqli class?
a) mysqli = new mysqli()
b) $mysqli = new mysqli()
c) $mysqli->new.mysqli()
d) mysqli->new.mysqli()

Answer

Answer: b [Reason:] If you choose to interact with MySQL server using the object-oriented interface, you need to first instantiate the mysqli class via its constructor.

7.Which one of the following statements can be used to select the database?
a) $mysqli=select_db(‘databasename’);
b) mysqli=select_db(‘databasename’);
c) mysqli->select_db(‘databasename’);
d) $mysqli->select_db(‘databasename’);

Answer

Answer: d [Reason:] None.

8. Which one of the following methods can be used to diagnose and display information about a MySQL connection error?
a) connect_errno()
b) connect_error()
c) mysqli_connect_errno()
d) mysqli_connect_error()

Answer

Answer: c [Reason:] The mysqli extension includes a few features that can be used to capture error messages or alternatively you can use exceptions.

9. Which method returns the error code generated from the execution of the last MySQL function?
a) errno()
b) errnumber()
c) errorno()
d) errornumber()

Answer

Answer: a [Reason:] Error numbers are often used in lieu of natural-language message to ease software internationalization efforts and allow for customization of error messages.

10. If there is no error, then what will the error() method return?
a) TRUE
b) FALSE
c) Empty String
d) 0

Answer

Answer: c [Reason:] None.

ed010d383e1f191bdb025d5985cc03fc?s=120&d=mm&r=g

DistPub Team

Distance Publisher (DistPub.com) provide project writing help from year 2007 and provide writing and editing help to hundreds student every year.