in Education by
Which of the following is a best practice to measure time taken by a process for execution? (a) System.currentTimeMillis() (b) System.nanoTime() (c) System.getCurrentTime() (d) System.getProcessingTime() I got this question in an internship interview. This is a very interesting question from Coding best practices in portion Autoboxing & Miscellaneous of Java Select the correct answer from above options

1 Answer

0 votes
by
 
Best answer
Right answer is (b) System.nanoTime() The best explanation: System.nanoTime takes around 1/100000 th of a second whereas System.currentTimeMillis takes around 1/1000th of a second.

Related questions

0 votes
    What are the two types of Streams offered by java 8? (a) sequential and parallel (b) sequential and random ... & Miscellaneous of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    Which of the following is not introduced with Java 8? (a) Stream API (b) Serialization (c) Spliterator (d) ... & Miscellaneous of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    Which of the following is not a core interface of Hibernate? (a) Configuration (b) Criteria (c) ... Miscellaneous of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    Which of the following methods returns proxy object? (a) loadDatabase() (b) getDatabase() (c) load() (d) ... & Miscellaneous of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    Which of the following methods hits database always? (a) load() (b) loadDatabase() (c) getDatabase() (d) ... & Miscellaneous of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    Which of the following method is used inside session only? (a) merge() (b) update() (c) end() (d ... Autoboxing & Miscellaneous of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    Which of the following is not a state of object in Hibernate? (a) Attached() (b) Detached() (c) ... Autoboxing & Miscellaneous of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    Which of the following is not an inheritance mapping strategies? (a) Table per hierarchy (b) Table per ... Miscellaneous of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    Which of the following is not an advantage of using Hibernate Query Language? (a) Database independent (b) ... Miscellaneous of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    Which one of the following causes memory leak? (a) Release database connection when querying is complete (b) ... Miscellaneous of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    JUnits are used for which type of testing? (a) Unit Testing (b) Integration Testing (c) System Testing (d) ... & Miscellaneous of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    Which jar provides FileUtils which contains methods for file operations? (a) file (b) apache commons (c) ... Miscellaneous of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    What is Optional object used for? (a) Optional is used for optional runtime argument (b) Optional is used ... & Miscellaneous of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    Which of the below statement about JUnit is false? (a) It is an open source framework (b) It provides an ... & Miscellaneous of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
...