0

programming languages Online Quiz - 72

Description: programming languages Online Quiz - 72
Number of Questions: 20
Created by:
Tags: programming languages
Attempted 0/20 Correct 0 Score 0

window.location.href="www.google.com". The given statement when executed would result in one of the following:

  1. It will give an error

  2. It will execute and nothing will happen

  3. It will execute and www.google.com is going to open

  4. None of The above


Correct Option: C

onUnload event of Javascript is fired in which of the following conditions

  1. When browser is closed

  2. When the page reloads as well.

  3. Only when you navigate out of the page.

  4. All Of the Above


Correct Option: D

The following piece of javascript code is going to work fine. function tryVariableArguments() { var intCnt = 0; for (intCnt = 0; intCnt < tryVariableArguments.arguments.length; intCnt++) { alert(tryVariableArguments.arguments[intCnt]); } } Trial Page tryVariableArguments('1','2','3'); tryVariableArguments('1','2'); tryVariableArguments();

  1. True

  2. False


Correct Option: B

One can add custom method and properties to objects in javascript without using prototype as well.

  1. True

  2. False


Correct Option: B

parseJSON is a standard function available in javascript like alert, eval and others.

  1. True

  2. False


Correct Option: B

Please select right set of technologies that are required for implementing Dynamic Content or DHTML in your application

  1. HTML

  2. CSS

  3. Javascript

  4. Ajax


Correct Option: A,B

Does hibernate allow mixing table-per-class hierarchy and table-per-subclass strategies?

  1. Yes

  2. No

  3. Can't say

  4. None of the above


Correct Option: B

AI Explanation

To answer this question, you need to understand the table-per-class hierarchy and table-per-subclass strategies in Hibernate.

In Hibernate, there are different strategies for mapping inheritance relationships between classes and database tables. The table-per-class hierarchy strategy maps the entire inheritance hierarchy to a single table, using additional columns to differentiate between different subclasses. On the other hand, the table-per-subclass strategy maps each subclass to its own table, with the common attributes in the superclass being duplicated in each subclass table.

Now, let's go through each option to understand why it is correct or incorrect:

Option A) Yes - This option is incorrect because Hibernate does not allow mixing the table-per-class hierarchy and table-per-subclass strategies. You have to choose one strategy for the entire inheritance hierarchy.

Option B) No - This option is correct. Hibernate does not allow mixing the table-per-class hierarchy and table-per-subclass strategies.

Option C) Can't say - This option is incorrect because it is possible to determine whether Hibernate allows mixing these strategies or not.

Option D) None of the above - This option is incorrect because the correct answer is B) No.

The correct answer is B) No. This option is correct because Hibernate does not allow mixing the table-per-class hierarchy and table-per-subclass strategies.

Which statement is correct ?

  1. session.contains() method to determine if an instance belongs to the session cache.

  2. session.contains() method to determine if an instance belongs to the data base

  3. Both are correct

  4. none of the above


Correct Option: A

What does session.evict() method do ?

  1. Remove the object and its collections from the first level cache

  2. Remove the object and its collections from the second level cache

  3. Remove the object and its collections from the data base

  4. None of the above


Correct Option: A

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) Remove the object and its collections from the first level cache - This option is correct. The session.evict() method in Hibernate removes the object and its collections from the first level cache. The first level cache, also known as the session cache, is associated with the Hibernate session and holds the persistent objects loaded from the database. By evicting the object, you are removing it from the first level cache, and subsequent operations on that object will result in database queries to fetch the object again.

Option B) Remove the object and its collections from the second level cache - This option is incorrect. The session.evict() method does not directly remove the object from the second level cache. The second level cache is a shared cache and is not specific to a particular session. Objects in the second level cache can be accessed by multiple sessions, and removing an object from the first level cache does not automatically remove it from the second level cache.

Option C) Remove the object and its collections from the database - This option is incorrect. The session.evict() method does not remove the object from the database. It only removes it from the first level cache. If you want to delete an object from the database, you would use the session.delete() method instead.

Option D) None of the above - This option is incorrect. Option A is the correct answer.

The correct answer is A) Remove the object and its collections from the first level cache. This option is correct because the session.evict() method in Hibernate removes the object and its collections from the first level cache.

Is the Session threadsafe in Hibernate ?

  1. TRUE

  2. FALSE

  3. No matter

  4. None of the above


Correct Option: B

How can you make a property be read from the database but not modified in anyway

  1. By using the insert="false" and update="false" attributes

  2. By using the isinsert="false" and isupdate="false" attributes.

  3. By using the isinsert="no" and isupdate="no" attributes

  4. None


Correct Option: A

Which statement is correct ?

  1. A Session will not obtain a JDBC Connection (or a Datasource) unless it is needed

  2. A Session will obtain a JDBC Connection (or a Datasource) on object create

  3. A Session has no relation with JDBC Connection (or a Datasource)

  4. None of the above


Correct Option: A

How to enable query cache in hibernate

  1. Hibernate.cache.query_cache true

  2. Hibernate.cache.use_query_cache true

  3. Hibernate.cache.query_cache yes

  4. None


Correct Option: B

If you are not certain that a matching row exists in the database then which method is the best ?

  1. Session.load();

  2. Session.get();

  3. Session.fetch();

  4. None of the above


Correct Option: B

Which statement is correct?

  1. Bag has index column

  2. Bag permits duplicate element values

  3. Bag does not permits duplicate element values

  4. None


Correct Option: B

What does session.createQuery("Query").scroll() return ?

  1. ListResultSet

  2. ResultSet

  3. ScrollableResultSet

  4. ScrollableResult


Correct Option: D

How can the mapping files be configured in Hibernate?

  1. Mapping files can be added to Configuration in the application code

  2. They can be configured in hibernate.cfg.xml using the elements

  3. Both a and b

  4. None of the above


Correct Option: C

It is possible to re-load an object and all its collections at any time, using the xxxx() method. This is useful when database triggers are used to initialize some of the properties of the object.What is the xxxx() method ?

  1. Refresh();

  2. Flush();

  3. Fetch();

  4. Load()


Correct Option: A

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) Refresh() - This option is correct because the Refresh() method is used to reload an object and all its collections at any time. It is useful when database triggers are used to initialize some of the properties of the object.

Option B) Flush() - This option is incorrect. The Flush() method is used to synchronize the persistence context with the underlying database, but it does not reload objects and their collections.

Option C) Fetch() - This option is incorrect. The Fetch() method is used to retrieve data from the database, but it does not reload objects and their collections.

Option D) Load() - This option is incorrect. The Load() method is used to lazily load an object or collection from the database, but it does not reload objects and their collections.

The correct answer is A) Refresh(). This option is correct because the Refresh() method is specifically designed to reload an object and all its collections at any time.

It is possible to re-load an object and all its collections at any time, using the xxxx() method. This is useful when database triggers are used to initialize some of the properties of the object.What is the xxxx() method ?

  1. Refresh();

  2. Flush();

  3. Fetch();

  4. Load()


Correct Option: A

Select the output of the following SQL statement : SELECT RPAD(name,10,'x') from client_table where name='TEST';

  1. xxxxxxTEST

  2. TESTxxxxxx

  3. ' TEST'

  4. 'TEST '


Correct Option: B
- Hide questions