Database MCQ Set 1
1. ___ joins are SQL server default
a) Outer
b) Inner
c) Equi
d) None of the Mentioned
Answer
Answer: b [Reason:] Inner query joins only the rows that are matching.
2. The ____ is essentially used to search for patterns in target string.
a) Like Predicate
b) Null Predicate
c) In Predicate
d) Out Predicate
Answer
Answer: a [Reason:] Like matches the pattern with the query.
3. Which of the following is/are the Database server functions?
i) Data management ii) Transaction management
iii) Compile queries iv) Query optimization
a) i, ii, and iv only
b) i, ii and iii only
c) ii, iii and iv only
d) All i, ii, iii, and iv
Answer
Answer: a [Reason:] All these are functions of database.
4. To delete a database _____ command is used
a) Delete database database_name
b) Delete database_name
c) drop database database_name
d) drop database_name
Answer
Answer: c [Reason:] This will delete the database with its structure.
5. ______ is a combination of two of more attributes used as a primary key
a) Composite Key
b) Alternate Key
c) Candidate Key
d) Foreign Key
Answer
Answer: a [Reason:] Primary keys together form the composite key.
6. Which of the following is not the function of client?
a) Compile queries
b) Query optimization
c) Receive queries
d) Result formatting and presentation
Answer
Answer: b [Reason:] Query optimization is used to improve the quality.
7. ______ is a special type of stored procedure that is automatically invoked whenever the data in the table is modified.
a) Procedure
b) Trigger
c) Curser
d) None of the Mentioned
Answer
Answer: b [Reason:] Triggers are used to initiate a action to take place.
8. ________ requires that data should be made available to only authorized users.
a) Data integrity
b) Privacy
c) Security
d) None of the Mentioned
Answer
Answer: c [Reason:] Some algorithms may be used for the security.
9. Some of the utilities of DBMS are _______
i) Loading ii) Backup iii) File organization iv) Process Organization
a) i, ii, and iv only
b) i, ii and iii only
c) ii, iii and iv only
d) All i, ii, iii, and iv
Answer
Answer: b [Reason:] Processing is not the a utility in dbms.
10. ______ allows individual row operation to be performed on a given result set or on the generated by a selected by a selected statement.
a) Procedure
b) Trigger
c) Curser
d) None of the Mentioned
Answer
Answer: c [Reason:] Triggers are used to initiate a action to take place.
Database MCQ Set 2
1. Which of the following is used to access the database server at time of executing the program and get the data from the server accordingly ?
a) Embedded SQL
b) Dynamic SQL
c) SQL declarations
d) SQL data analysis
Answer
Answer: b [Reason:] Embedded SQL, the SQL statements are identified at compile time using a preprocessor. The preprocessor submits the SQL statements to the database system for precompilation and optimization; then it replaces the SQL statements in the application program with appropriate code and function calls before invoking the programming-language compiler.
2. Which of the following header must be included in java program to establish database connectivity using JDBC ?
a) Import java.sql.*;
b) Import java.sql.odbc.jdbc.*;
c) Import java.jdbc.*;
d) Import java.sql.jdbc.*;
Answer
Answer: a [Reason:] The Java program must import java.sql.*, which contains the interface definitions for the functionality provided by JDBC.
3. DriverManager.getConnection(_______ , ______ , ______)
What are the two parameters that are included ?
a) URL or machine name where server runs, Password, User ID
b) URL or machine name where server runs, User ID, Password
c) User ID, Password, URL or machine name where server runs
d) Password, URL or machine name where server runs, User ID
Answer
Answer: b [Reason:] The database must be opened first in order to perform any operations for which this get connection method is used .
4. Which of the following invokes functions in sql ?
a) Prepared Statements
b) Connection statement
c) Callable statements
d) All of the mentioned
Answer
Answer: c [Reason:] JDBC provides a Callable Statement interface that allows invocation of SQL stored procedures and functions.
5. Which of the following function is used to find the column count of the particular resultset ?
a) getMetaData()
b) Metadata()
c) getColumn()
d) get Count()
Answer
Answer: a [Reason:] The interface ResultSet
has a method, getMetaData(), that returns a ResultSetMetaData object that contains metadata about the result set. ResultSetMetaData, in turn, has methods to find metadata information, such as the number of columns in the result, the name of a specified column, or the type of a specified column.
6. Which of the following is a following statement is a prepared statements ?
a) Insert into department values(?,?,?)
b) Insert into department values(x,x,x)
c) SQLSetConnectOption(conn, SQL AUTOCOMMIT, 0)
d) SQLTransact(conn, SQL ROLLBACK)
Answer
Answer: a [Reason:]? is used as a placeholder whose value can be provided later.
7. Which of the following is used as the embedded SQL in COBOL ?
a) EXEC SQL <embedded SQL statement >;
b) EXEC SQL <embedded SQL statement > END-EXEC
c) EXEC SQL <embedded SQL statement >
d) EXEC SQL <embedded SQL statement > END EXEC;
Answer
Answer: b [Reason:] EXEC SQL <embedded SQL statement >; is normally in C.
8. Which of the following is used to distinguish the variables in SQL from the host language variables ?
a) .
b) –
c) :
d) ,
Answer
Answer: b [Reason:]
EXEC SQL DECLARE c cursor FOR SELECT ID, name FROM student WHERE tot cred > :credit amount;
.
9. The update statement can be executed in host language using
a) EXEC SQL UPDATE c; b) EXEC SQL UPDATE c INTO :si, :sn; c) EXEC SQL UPDATE instructor SET salary = salary + 100 WHERE CURRENT OF c; d) EXEC SQL UPDATE END-SQL
Answer
Answer: c [Reason:] The SQL can be terminated by ; to terminate the sentence.
10. Which of the following is used to access large objects from a database ?
a) setBlob()
b) getBlob()
c) getClob()
d) all of the mentioned
Answer
Answer: d [Reason:] None.
Database MCQ Set 3
1. _____ is widely used today for protecting data in transit in a variety of applications such as data transfer on the Internet, and on cellular phone networks.
a) Encryption
b) Data mining
c) Internet Security
d) Architectural security
Answer
Answer: a [Reason:] Encryption is also used to carry out other tasks, such as authentication.
2. In a database where the encryption is applied the data is cannot be handled by the unauthorised user without
a) Encryption key
b) Decryption key
c) Primary key
d) Authorised key
Answer
Answer: b [Reason:] Even if the message is intercepted by an enemy, the enemy, not knowing the key, will not be able to decrypt and understand the message.
3. Which of the following is not a property of good encryption technique ?
a) Relatively simple for authorized users to encrypt and decrypt data
b) Decryption key is extremely difficult for an intruder to determine
c) Encryption depends on a parameter of the algorithm called the encryption key
d) None of the mentioned
Answer
Answer: d [Reason:] Here a,b and c are the properties have to be present in a good design of a encryption technique.
4. In which of the following encryption key is used to encrypt and decrypt the data ?
a) Public key
b) Private key
c) Symmetric key
d) Asymmetric key
Answer
Answer: c [Reason:] In public-key (also known as asymmetric-key) encryption techniques, there are two different keys, the public key and the private key, used to encrypt and decrypt the data.
5. Encryption of small values, such as identifiers or names, is made complicated by the possibility of ____
a) Dictionary attacks
b) Database attacks
c) Minor attacks
d) Random attacks
Answer
Answer: a [Reason:] This happens when particularly if the encryption key is publicly available.
6. Which one of the following uses a 128bit round key to encrypt the data using XOR and use it in reverse to decrypt it ?
a) Round key algorithm
b) Public key algorithm
c) Advanced Encryption Standard
d) Asymmetric key algorithm
Answer
Answer: c [Reason:] The standard is based on the Rijndael algorithm.
7. Which of the following requires no password travel across the internet ?
a) Readable system
b) Manipulation system
c) Challengeāresponse system
d) Responce system
Answer
Answer: c [Reason:] The database system sends a challenge string to the user. The user encrypts the challenge string using a secret password as encryption key and then returns the result. The database system can verify the authenticity of the user by decrypting the string with the same secret password and checking the result with the original challenge string.
8. Assymmetric Encryption: Why can a message encrypted with the Public Key only be decrypted with the receiver’s appropriate Private Key?
a) Not true, the message can also be decrypted with the Public Key
b) A so called “one way function with back door” is applyed for the encryption
c) The Public Key contains a special function which is used to encrypt the message and which can only be reversed by the appropriate Private Key
d) The encrypted message contains the function for decryption which identifies the Private Key
Answer
Answer: b [Reason:] An one-way function is a function which a computer can calculate quickly, but whose reversal would last months or years. An one-way function with back door can be reversed with the help of a couple of additional information (the back door), but scarcely without this information. The information for the back door is contained in the private Key.
9. Which is the largest disadvantage of the symmetric Encryption?
a) More complex and therefore more time-consuming calculations
b) Problem of the secure transmission of the Secret Key
c) Less secure encryption function
d) Isn’t used any more
Answer
Answer: b [Reason:] As there is only one key in the symmetrical encryption, this must be known by both sender and recipient and this key is sufficent to decrypt the secret message. Therefore it must be exchanged between sender and receiver in such a manner that an unauthorized person can in no case take possesion of it.
10. Which is the principle of the encryption using a key?
a) The key indicates which funcion is used for encryption. Thereby it is more difficult to decrypt a intercepted message as the function is unknown
b) The key contains the secret function for encryption including parameters. Only a password can activate the key
c) All functions are public, only the key is secret. It contains the parameters used for the encryption resp. decryption
d) The key prevents the user of having to reinstall the software at each change in technology or in the functions for encryption
Answer
Answer: b [Reason:] The encoding of a message is calculated by an algorithm. If always the same algorithm would be used, it would be easy to crack intercepted messages. However, it isn’t possible to invent a new algorithm whenever the old one was cracked, therefor the possibility to parameterize algorithms is needed and this is the assignment of the key.
Database MCQ Set 4
1. If a piece of data is stored in two places in the database, then
a) Storage space is wasted
b) Changing the data in one spot will cause data inconsistency
c) In can be more easily accessed
d) Storage space is wasted & Changing the data in one spot will cause data inconsistency
Answer
Answer: d [Reason:] The database is always consistent and so there is no duplication .
2. An audit trail _____
a) Is used to make backup copies
b) Is the recorded history of operations performed on a file
c) Can be used to restore lost information
d) None of the mentioned
Answer
Answer: b [Reason:] This is more useful for all recovery actions .
3. Large collection of files are called ______
a) Fields
b) Records
c) Database
d) Sectors
Answer
Answer: c [Reason:] The operator tree has a tree like format where the evaluation starts from root of the tree .
4. Which of the following hardware component is the most important to the operation of database management system?
a) High resolution video display
b) Printer
c) High speed, large capacity disk
d) Mouse
Answer
Answer: c [Reason:] All the data are stored in form of memory in the disk.
5. Which of the following is not true of the traditional approach to information processing
a) There is common sharing of data among the various applications
b) It is file oriented
c) Programs are dependent on the file
d) It is inflexible
Answer
Answer: a [Reason:] All the data are stored in form of memory in the disk.
6. Which of these is not a feature of Hierarchical model?
a) Organizes the data in tree-like structure
b) Parent node can have any number of child nodes
c) Root node does not have any parent
d) Child node can have any number of parent nodes
Answer
Answer: d [Reason:] The data are traversed using several algorithms.
7. Which of these data models is an extension of relational data model?
a) Object-oriented data model
b) Object-relational data model
c) Semi structured data model
d) None of the mentioned
Answer
Answer: b [Reason:] All the data are stored in form of memory in the disk.
8. The information about data in a database is called _______
a) Metadata
b) Hyper data
c) Tera data
d) None of the mentioned
Answer
Answer: a [Reason:] Metadata is information about a data.
9. A data dictionary is a special file that contains?
a) The names of all fields in all files
b) The data types of all fields in all files
c) The widths of all fields in all files
d) All of the mentioned
Answer
Answer: d [Reason:] The data dictionary is structured in tables and views, just like other database data.
10. The DBMS acts as an interface between what two components of an enterprise-class database system?
a) Database application and the database
b) Data and the database
c) The user and the database application
d) Database application and SQL
Answer
Answer: a [Reason:] Database application is the interface with the user to access the database.
Database MCQ Set 5
1. Which feature converts row data to column for better analytical view?
a) Views
b) Join
c) Pivot
d) Trigger
Answer
Answer: c [Reason:] Pivot table is very powerful, and very easy to use.
2. Which of the following statements is/are not true for SQL profiler?
a) Enables you to monitor events
b) Check if rows are being inserted properly
c) Check the performance of a stored procedure
d) None of the mentioned
Answer
Answer: c [Reason:] Stored procedures are like functions which do not return values.
3. Which global variables can be used to determine if a transaction is still open?
a) @@NESTLEVEL
b) @@FETCH_STATUS
c) @@TRANCOUNT
d) @@CONNECTIONS
Answer
Answer: c [Reason:] PRINT @@TRANCOUNT — The BEGIN TRAN statement will increment the — transaction count by 1.
4. Which statement is used to define a cursor?
a) OPEN
b) FETCH
c) DECLARE CURSOR
d) @@FETCH_STATUS
Answer
Answer: c [Reason:] A database cursor is a control structure that enables traversal over the records in a database.
5. What is the default “SORT” order for a SQL?
a) Ascending
b) Descending
c) As specified by the user
d) None of the mentioned
Answer
Answer: a [Reason:] Default is ascending order.
6. Capabilities of RAISERROR
a) It can be logged in the error log
b) It can print a message to the application
c) It can assign an error number, state and severity
d) All of the mentioned
Answer
Answer: d [Reason:] A relational database table is often described as “normalized” if it is in the Third Normal Form because most of the 3NF tables are free of insertion, update, and deletion anomalies.
7. How inserting data through stored procedure do reduces network traffic and increase database performance?
a) Stored procedure can accept parameter
b) Permission check is not required
c) The execution plan is stored in the cache after it was executed the first time
d) None of the mentioned
Answer
Answer: c [Reason:] A relational database table is often described as “normalized” if it is in the Third Normal Form because most of the 3NF tables are free of insertion, update, and deletion anomalies.
8. Stored procedures are safe from SQL injection attacks
a) True
b) False
c) Depends on the result
d) Always safe
Answer
Answer: a [Reason:] Injection attack is not possible in SP.
9. Which of the following connection type supports application role permissions and password encryption?
a) OLE DB
b) DBLib
c) ODBC
d) OLE DB and ODBC
Answer
Answer: d [Reason:] Open Database Connectivity (ODBC) is Microsoft’s strategic interface for accessing data in a heterogeneous environment of relational.
10. Cursor that reflects the changes made to the database table even after the result set is returned
a) Static
b) Dynamic
c) FORWARD_ONLY
d) Keyset
Answer
Answer: b [Reason:] A database cursor is a control structure that enables traversal over the records in a database.