0

programming languages Online Quiz - 338

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

6.) How do I get my program to act like a daemon?

  1. a) Run with root user

  2. b) Run with &

  3. c) Run with root user using &

  4. d) None


Correct Option: D

Does hibernate require persistent classes to implement Serializable?

  1. Required

  2. b) Not Required

  3. c) None of the above

  4. All of the above


Correct Option: B

What does CacheMode do ?

  1. a) a) controls how a particular SessionFactory interacts with the Data Base.

  2. b) controls how a particular SessionFactory interacts with the second-level cache.

  3. c) controls how a particular session interacts with the second-level cache.

  4. d) None


Correct Option: C

7.) Why do processes never decrease in size?

  1. a) They never releases the memory utilized

  2. b) They release the memory but kernel does not use them

  3. c) Since they are running

  4. d) It’s a false statement


Correct Option: B

If instances are not in the session or second-level cache which will give better performance?

  1. a) Query.list()

  2. b) Query.iterate()

  3. c) Both are same

  4. d) None of the above


Correct Option: A

8.) What is the difference between select() & poll()?

  1. a) select() and poll() have no differences

  2. b) poll() is event driven while select() is not

  3. c) select() is event driven while poll() is not

  4. d) None


Correct Option: B

AI Explanation

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

Option A) select() and poll() have no differences - This option is incorrect because select() and poll() do have differences.

Option B) poll() is event-driven while select() is not - This option is correct. The main difference between select() and poll() lies in their behavior. poll() is event-driven, meaning that it only checks for events when explicitly called. It does not block the execution of the program. On the other hand, select() is not event-driven and blocks the program's execution until an event occurs.

Option C) select() is event-driven while poll() is not - This option is incorrect. The correct statement is the opposite: poll() is event-driven while select() is not.

Option D) None - This option is incorrect because there are differences between select() and poll().

The correct answer is B) poll() is event-driven while select() is not.

What does sess.delete() do?

  1. a) remove data from in memory

  2. b) remove from database.

  3. c) remove from sessionFactory

  4. d) None of the above.


Correct Option: B

9.) How do I `lock' a file?

  1. a) Use filelock()

  2. b) use lockfile()

  3. c) Use lockfd()

  4. d) use fcntl()


Correct Option: D

How can a whole class be mapped as immutable?

  1. a) By using the mutable="false" attribute in the class mapping.

  2. b) By using the ismutable="false" attribute in the class mapping.

  3. c) By using the ismutable="no" attribute in the class mapping.

  4. d) None


Correct Option: A

10.) What is a NFS?

  1. a) National File System

  2. b) Network Flashmemory System

  3. c) Network File System

  4. d) Network Fault System


Correct Option: C

what does hibernate.hbm2ddl.auto create this means ?

  1. create tables automatically

  2. b) create session object automatically

  3. c) create Session Factory object automatically

  4. d) None


Correct Option: A

11.) How can I tell how much memory my system has?

  1. a) Use getmemory()

  2. b) Use sysctl()

  3. c) Use freemem()

  4. d) Use malloc()


Correct Option: B

Employee emp = session.load(Employee .class);

  1. Yes

  2. b) No

  3. Cant say

  4. Both


Correct Option: B

AI Explanation

To answer this question, we need to understand the purpose and behavior of the load method in Hibernate.

The load method in Hibernate is used to load an entity object from the database based on its identifier. It returns a proxy object that is associated with the given entity class and identifier. The actual database query is not executed immediately; instead, it is deferred until the proxy object is accessed.

In the given code snippet, the load method is used to load an instance of the Employee class. Since we are only loading the object and not accessing any of its properties or methods, the actual database query is not executed yet.

Therefore, the correct answer is:

Option B) No - The code snippet only loads the Employee object using the load method but does not perform any operations on it.

28 ____ forces hibernate to bypass the setter method and access the instance variable directly while initializing a newly loaded object.

  1. a) By mapping the property with access="onlyfield" in Hibernate metadata

  2. b) By mapping the property with access="variable" in Hibernate metadata

  3. c) By mapping the property with access="field" in Hibernate metadata

  4. d) none of the above


Correct Option: C

11.) How can I tell how much memory my system has?

  1. a) Use getmemory()

  2. b) Use sysctl()

  3. c) Use freemem()

  4. d) Use malloc()


Correct Option: B

Difference between Emp e = session.load(Emp.class) and Emp e = session.createCriteria(Emp.class) ?

  1. a) On session close session.load() Emp Object unavailable to access

  2. b) On session close session.createCriteria() Emp unavailable to access

  3. c) None

  4. Both a & b


Correct Option: A
Explanation:

To understand the difference between session.load(Emp.class) and session.createCriteria(Emp.class), the user needs to know about Hibernate, an ORM (Object-Relational Mapping) framework that provides a way to map Java objects to database tables.

session.load(Emp.class) and session.createCriteria(Emp.class) are two different ways to retrieve data from the database using Hibernate.

session.load(Emp.class) is used to load an object from the database using its identifier. It returns a proxy object of the requested entity and the actual database query is executed only when the proxy object is accessed for the first time. If the identifier is not found in the database, then it throws the ObjectNotFoundException exception.

On the other hand, session.createCriteria(Emp.class) is used to create a Criteria object that can be used to retrieve data from the database. It provides a way to construct a query using a set of criteria such as restrictions, projections, and ordering. It returns a list of objects that match the criteria specified in the query.

Now let's go through each option and explain why it is right or wrong:

A. a) On session close session.load() Emp Object unavailable to access: This option is partially correct. When the session is closed before accessing the Emp object loaded using session.load(), then the ObjectNotFoundException exception is thrown. However, the Emp object is still available to access until the session is closed.

B. b) On session close session.createCriteria() Emp unavailable to access: This option is incorrect. When the session is closed before accessing the Emp object retrieved using session.createCriteria(), then the LazyInitializationException exception is thrown. However, the Emp object is still available to access until the session is closed.

C. c) None: This option is incorrect. There is a difference between session.load() and session.createCriteria() as explained above.

D. Both a & b: This option is incorrect. Option A is partially correct and option B is incorrect.

Therefore, the correct answer is:

The Answer is: A

12.) What is a socket

  1. a) A port to connect printer

  2. b) A port to connect keyboard

  3. c) An abstraction to pass data across processes

  4. d) A hardware device


Correct Option: C

13.) What is a message queue?

  1. a) A printer queue

  2. b) An IPC mechanism with destructive execute

  3. c) An IPC mechanism with destructive write

  4. d) An IPC mechanism with destructive read


Correct Option: D

14.) What is a pthred

  1. a) A printer thread

  2. b) A POSIX standard thread to support multi-tasking

  3. c) A POSIX standard thread to support multi-threading

  4. d) A POSIX standard thread to support kernel debugging


Correct Option: C

15.) If open() is used to open a non-existent file in read-only mode what will happen

  1. a) Creates File

  2. b) Does nothing

  3. c) Return error

  4. d) Not allowed.


Correct Option: C
- Hide questions