A. 2 3 5 4 1

advertisement
DBSJ_THEORY_05
Full name
Who
CREATOR
REVIEWER
APPROVER
APTECH_Theory5_hoang.pt_v1.0.doc
Class
Database and security in Java
Date
21-08-2010
Name
Role
Date
Phan Tích Hoàng
Lecturer
21 August 2010
Signature
APTECH DBSJ THEORY 5
1. Which of the following is not an advantage offered by the JBDC API ?
A. Platform independence
B. Vendor independence
C. Program independence
D. Ease of maintainance
2. ....... and ...... are used to specify the address of the SQL Server
connecting using Type-4 for connecting using a Type-4 driver .
A. Url,portNumber
B. ServerName,instanceName
C. Protocol,portNumber
D. Protocol,serverName
3. Arrange the steps for inserting a new row in the database using a
CachedRowset object in the correct sequence ?
1. crs.acceptChanges();
2. crs.moveToInsertRow();
3. crs.updateString("Emp_Name","Michelle");
4.crs.moveToCurrentRow();
5. crs.insertRow();
A.
B.
C.
D.
4. In
A.
B.
C.
D.
2
2
1
2
3
3
2
3
5
4
3
1
4
5
4
4
1
1
5
5
order to make an applet secure it is permitted to.......……………………..
Only listen for incoming socket creation requests.
Send datagrams only to the web server from which it was loaded .
Establish only secure network connection with any web server.
Access only the system properties and define only their own class loaders.
5. Arrange the steps for setting up a policy file for granting permission in
the correct sequence .
1. Create a Policy entry
2. Start the Policy Tool
3. Updating policy Tool
4. Grant the required permissions
5. Save the Policy file
A.
B.
C.
D.
1
1
2
2
2
3
1
1
3
2
4
3
4
5
3
4
5
4
5
5
6. Which of the following statements about restrictions on applications is
false ?
A. A security manager can be installed for an application by using the policy tool .
B. The Java runtime does not use a security manager when executing application.
Learn, Study and Pratice
2
APTECH DBSJ THEORY 5
C. If an application tries to access system properties without having the requisite
permission then the Java interpreter throws an AccessControlException.
D. A java.security file is created when the application is run with the security
manager.
7.
The ......... interface is used as the top-level interface for all opaque keys
A. KeySpec
B. CertificateFactory
C. KeyPairGenerator
D. Key
8. Which of the following statements about methods of the Cipher class is
false ?
A. The getAlgorithm() method returns the algorithm name of the Cipher object as
a string .
B. The getProvider() method returns the name of the Provider of the Cipher
object as a string.
C. The getBlockSize() method returns the block size of the Cipher object as a
primitive integer
D. The init() method of the Cipher class is a final method .
9. A file storing the digital signature along with their corresponding public
and..keys is known as......…..
A. keystore
B. Digital Certificate
C. Signed JAR file
D. keyFactory
10. Arrange the steps for signing data using Java tools in the correct
sequence ?
1. Generating the key and keystore for signing the JAR file .
2. Create a JAR file containing the data to be sent
3. Export the public key as a copy of the certificate so that message recipient
authenticate the sender's signature
4. Sign the JAR file using the jarsigner tool and the private key
A.
B.
C.
D.
1
2
1
2
2
1
2
1
3
4
4
3
4
3
3
4
11. A key-pair generator object is obtained by invoking the........of the
KeyPairGenerator class .
A. default constructor
B. parameterized constructor
C. Default static getInstance() method
D. parameterized static getInstance() method
12. Which of the following statements about signing data using the
Signature is false ?
Learn, Study and Pratice
3
APTECH DBSJ THEORY 5
A. The Signature object to be used for generating of verifying signatures must be
created specifying the message digest algorithm used by the signature
algorithm
B. The Signature object is initialized by pass an instance of the private key
C. The Signature object must also be initialized to specify if it is going to be used
for encryption or decryption.
D. Signature object stores the data to be signed as a byte arry in itself
13. .....…………………… is used to connect the Java applications with the
database .
A. API
B. DBMS
C. JDBC
D. JNS
14. Which method checks all the available drivers for the eligibility to make
a connection .
A. DriverManager.getConnection()
B. Class.forName()
C. Connection.createStatement()
D. executeQuery()
15. Which of the following classes is used to check the authenticity of digital
signature ?
A. MessageDigest
B. Signature
C. KeyFactory
D. CertificateFactory
16. Which method is used to execute SQL statements that returns more than
one result set ?
A. executeAll()
B. executeUdate()
C. executiveQuery()
D. execute()
17. Which exception would be throw due to the execution of the following
code ?
//check driver exist
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:bank", "sa", "1234567");
A.
B.
C.
D.
InvalidArgumentException
SQL exception
NullPointer exception
ClassNotFoundException
18. Which of the following statements about DatabaseMetaData and
ResultSetMetaData are false ?
A. The methods of the DatabaseMetaData interface are used to get information
about the database to which the connection is made.
Learn, Study and Pratice
4
APTECH DBSJ THEORY 5
B. The methods of the ResultSetMetaData can be used to get information about
the result set is obtained.
C. The getColumnCount() method returns the number of the columns in the
database accurately.
D. A ResultSetMetaData objects is obtained by invoking the getMetaData()
method on a valid result set object.
19. Which of the following statement is false regarding call to stored
procedure from JDBC
A. Create a Callable statement object
B. A Callable Statement object contains a call to stored procedure
C. The execution call should be like CallableStatement cs = con.prepareCall(“(call
SHOW_SUPLIERS)”);.
D. We need not make an instance of the Connection class before making a
Callable statement.
20. Which of the folllowing is not a property that has to set before
populating a rowset obtained by using the default constructor ?
A. userName
B. password
C. dataSourceName
D. Url
21. Which of the following statements about database drivers is false ?
A. The Type-1 driver uses bridging technology to provide database access via
ODBC drivers.
B. The Type-2 driver converts the client request to a database understandable,
native format.
C. The Type-3 driver converts the JDBC calls into the network protocol which is
again translated into database specific calls by a middle tier.
D. The Type-3 driver converts the JDBC calls into a network protocol which is
again translated into database specific calls by middle tier.
22. Which the following statements is false ?
A. the executeQuery() method is used to execute SQL statements which return
more than one result set.
B. The executeUpdate() method is used to execute SQL DDL statements.
C. The execute() method returns true when a result set object is created due to
the execution of an SQL statement.
D. The executeUpdate() method return an integer indicating the number of rows
effected by the execution of the SQL statement.
23. Which of the following statements ia a valid way of calling a stored
procedure named Display_Books ?
String booksProcedure = "Create Procedure DISPLAY_BOOKS as select " +
"BOOKS.BK_NAME,PUBLISHER.PUB_NAME " +
"from BOOKS, PUBLISHERS where BOOK.BK_ID = PUBLISHERS.PUB_ID order by BK_NAME";
A. Statement st = con.createStatement();
st.executeUpdate(Display_Books);
B. CallableStatement cst = con.prepareCall(“(call DISPLAY_BOOKS)”);
ResultSet rs = cst.executeQuery();
Learn, Study and Pratice
5
APTECH DBSJ THEORY 5
C. Statement st = con.createStatement(booksProcedure);
st.executeUpdate();
D. CallableStatement cst = con.prepareStatement(“(call DISPLAY_BOOKS)”);
ResultSet rs = cst.executeQuery();
24. Which of the following statements about the Java 2 Security model are
false ?
A. The Java 2 Security model provides for a consistent and flexiable policy for
applets and applications.
B. An Access Controller can be used to override the Security Manager.
C. A policy file comprises the mapping of one or more permissions with a class.
D. The Keystore is a password protected database that holds public keys and
certifications.
25. Which of the following statements about Cryptography schemes is false
?
A. Public Key Cryptography uses different keys for encryption and decryption.
B. Secret Key Cryptography uses a single secret key for both encryption and
decryption of data.
C. It is possible to recover the original data from a message digest created using
Hash Functions.
26. Which of the following statements about encryption using the Java
Cryptography Extension is false ?
A. The Symmetric Block Encryption method can ensure the integrity of a message
but not the authenticity.
B. The Password based Encryption method can ensure the integrity of a message
but not the authenticity.
C. The Key Agreement Protocol can only ensure the integrity of a message but not
the authenticity.
D. The Message Authentication Code protocol can ensure both the intergrity as
well as the authenticity of a message.
27. Which characteristic of resultSet refers to the ability to check whether
the cursor stays open after a COMMIT ?
A. Scrollable
B. Upadatable
C. Holdable
D. Executable
28. Which of the following defines the process of confirming the indentity of
an entity?
A. Authorization
B. Confidentiality
C. Intergrity
D. Authentication
29. What will be the result of trying to compile and run the following code
assuming a valid Connection object con ?
Learn, Study and Pratice
6
APTECH DBSJ THEORY 5
PreparedStatement pstmtBook = con.prepareStatement("UPDATE books SET price
= ? WHERE author_name = ?");
pstmtBook.setFloat(1,20.25);
pstmtBook.setString(2,"lan Wright");
System.out.println("Result: " + pstmtBook.executeUpdate());
A.
B.
C.
D.
The
The
The
The
code prints Result: 20. 25.
code prints Result: 1.
code prints Result: 0.
complete changed row is printed out on the screen.
30. Which of the following statements about CachedRowSet objects is false
?
A. CachedRowSet object created using the default constructor has a default
SyncProvider object associated with it.
B. Data can be written back to the database simply by invoking the
acceptChanges() method.
C. CachedRowSet objects are serializable.
D. Data exchange with CachedRowSet objects is faster as compared to
JDBCRowSet objects since the data is cached in memory.
31. The _____ class is used to produce a pair of public and private keys for
a specified algorithm
A. KeyFactory
B. KeyPairGenerator
C. CertificateFactory
D. KeyStore
32. Which of the following statements about the packages in the Java
Cryptography Extension is false ?
A. The java.security package provides classes that make up the Java
Cryptography Architecture.
B. The java.security.spec package provides classes and interfaces for key and
algorithm parameter specification.
C. The javax.crypto package provides classes and interfaces for cryptographic
operations.
D. The javax.crypto.spec package has replaced the java.security.spec package.
33. Arrange the steps for verifying a digital signature in the correct
sequence.
1. Initialize the signature instance with the public key
2. Create a Signature instance using the same signature as that used to
generate tha signature.
3. The verify() method returns a Boolean value denoting the authenticity of the
signature.
4. Invoke the verify() method on the newly created Signature object to
compare the two signatures.
5. Supply data to be verified to Signature object by invoking update()
A.
B.
C.
D.
21543
51234
25134
23514
Learn, Study and Pratice
7
APTECH DBSJ THEORY 5
34. Which method retrieves the version number of the connected database
product and returns the same in a string format ?
A. getVersion()
B. getDriverVersion()
C. getDatabaseVersion()
D. getDatabaseProductVersion()
35. Which property of a database transaction refers to the ability of the
DBMS to ensure that there are no conflicts between concurrent transactions
?
A. Atomicity
B. Isolation
C. Durability
D. Consistency
36. Which of the following features of cryptography verifies and prevents
any unintended receiver from reading the data ?
A. Authentication
B. Confidentiality
C. Integrity
D. Non-repudiation
37. Which of the following constant specifies that the ResultSet cannot be
modified ?
A. CONCURRENCY.READ_ONLY
B. CONCURRENCY.UPDATABLE
C. CONCURRENCY.NOUPDATE
D. CONCURRENCY.READ_ONCE
38. Which of the following statements about digital signatures is false ?
A. A Digital Certification is a data structure with a digital signature containing
information like the publickey, identity of the key owner and name of
certification authority.
B. Digital Signatures do not contain any record of the data and time when
particular document was signed.
C. A Digital Signature can satisfactorily assure the authenticity and integrity of the
message in real world scenaries
D. A Digital Signature uses Public Key Crytography to encrypt and decrypt
messages.
39. A _____ file is an ASCII text file and can be composed with a text editor
or the graphical policytool ultility
A. Policy
B. Security
C. Editor
D. Database
40. Which one of the following ResultSet constants allows to navigate from
the beginning of a ResultSet to the end of it ?
A. TYPE_SCROLL_INSENSITIVE
Learn, Study and Pratice
8
APTECH DBSJ THEORY 5
B. TYPE_SCROLL_SENSITIVE
C. TYPE_SCROLL
D. TYPE_FORDWARD_ONLY
41. Which of the following statements about JAAS 1.0 are false ?
A. Method of LoginContext class are used to authenticate a user.
B. A subject represents details such as password about an entity.
C. A subject represents details such as password about an entity.
D. JAAS 1.0 extends the access control architecture of the Java 2 Platform in a
compatible fashion to support user based authorization.
42. Which of the following statements about rowsets are false ?
A. Any changes made to a rowsets data reflected in the database automatically.
B. A JDBCRowSet is an example of a connected rowset.
C. The CachedRowSetImpl class is the only implementation of the CachedRowSet
interface.
D. All rowset objects are by default scrollable and updatable
Learn, Study and Pratice
9
Download