Hibernate ORM and Unix/Linux Programming Quiz
Covers Hibernate ORM framework concepts, Java persistence, and Unix/Linux system programming including file management, process signals, and system utilities
Questions
16.) To delete all the trailing spaces of each line of file test1
- a) sed 's/[ ][^ ]*$//' test2
- b) sed 's/[ ][ ]*$//' test2
- c) sed 's/[ ][ ]*$/' test2
- d) sed 's/[ ][ $]*$//' test2
17.) How to duplicate file descriptors?
- a) duplicate()
- b) dup()
- c) cp()
- d) mknod()
18.) What is the difference between at & cron?
- a) Both are Unix scheduling utilities
- b) at is restricted one and crontab is not restricted
- c) No difference
- d) at takes input from user while cron takes from a confiuration file
19.) How to remove a queued file from the printer queue?
- a) lpqrm
- b) lprm
- c) jobs -r
- d) lpc -rm
20.) If inet service is restarted, all the open sockets gets closed
- a) True
- b) False
- c)
- d)
21.) The difference between telnet & rsh?
- a) telnet works only with terminals where rsh works for all
- b) telnet is unix product while rsh is a TCP product
- c) telnet uses byte protocol while rsh uses stream protocol
- d) No difference. They can be used interchangably
What does session.evict() method do ?
- a) remove the object and its collections from the first level cache
- b) remove the object and its collections from the second level cache
- c) remove the object and its collections from the data base
- d) None of the above
22.) Unix shell scripting does not support floating points directly
- a) True
- b) False
- c)
- d)
Which is simplest code snippet you will add in the below main function to set the name attribute of 50th in the ItemList to “Done”? import java.util.ArrayList; import java.util.List; class Item { public int code; public String name; public Item(String name) { this.name = name; } } public class Main { public static void main(String args[]) { List itemList = new ArrayList(); for (int i = 0; i < 50; i++) { Item im = new Item("Test"); itemList.add(im); } //Code to change name of the 50th object to “Done” } }
- im.name = "Done";
- Item otherObject = new Item(“Done”); itemList.set(49, otherObject);
- ((Item)itemList.get(49)).name = “Done”;
- None of above is correct as they are not changing 50th element.
23.) Is it possible to process return value of system()?
- a) Yes
- b) No
- c)
- d)
Is the Session threadsafe in Hibernate ?
- a) TRUE
- b) FALSE
- c) no matter
- d) none of the above
24.) lpc command is used to
- a) Add printer and queues
- b) Add modem & flash drive
- c) Add printer alone
- d) Invalid command
How can you make a property be read from the database but not modified in anyway
- a) By using the insert="false" and update="false" attributes.
- b) By using the isinsert="false" and isupdate="false" attributes.
- c) By using the isinsert="no" and isupdate="no" attributes
- d) None
25.) How to send signals to other processes?
- a) Use sigsend()
- b) use kill()
- c) use signal()
- d) Only init can send signals
Which statement is correct ?
- a) A Session will not obtain a JDBC Connection (or a Datasource) unless it is needed
- b) A Session will obtain a JDBC Connection (or a Datasource) on object create
- c) A Session has no relation with JDBC Connection (or a Datasource)
- d) none of the above
How to enable query cache in hibernate
- a) hibernate.cache.query_cache true
- b) hibernate.cache.use_query_cache true
- c) hibernate.cache.query_cache yes
- d) none
If you are not certain that a matching row exists in the database then which method is the best ?
- a) Session.load();
- b) Session.get();
- c) Session.fetch();
- d) None of the above
Which statement is correct?
- a) bag has index column
- b) bag permits duplicate element values
- c) bag does not permits duplicate element values
- d) None
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 ?
- a) refresh();
- b) flush();
- c) fetch();
- d) load()
What is the root level element in a hibernate mapping file?
- a) <session-factory>
- b) <hibernate>
- c) <hibernate-configuration>
- d) None