Correct Answer : Get Lastest Questions and Answer : Explanation: Here imporatnat method is belwo. boolean java.util.concurrent.atomic.AtomicInteger.compareAndSet(int expect, int update)
Atomically sets the value to the given updated value if the current value == the expected value. Parameters: expect the expected value update the new value Returns: true if successful. False return indicates that the actual value was not equal to the expected value.
int java.util.concurrent.atomic.AtomicInteger.getAndDecrement()
Atomically decrements by one the current value. Returns: the previous value
int java.util.concurrent.atomic.AtomicInteger.incrementAndGet()
Atomically increments by one the current value. Returns: the updated value
Question : You have been given below code, what is the output, when executed using command "java -ea RateOfInterest" package com.hadoopexam; public class Welcome {
public static void main(String[] args) { int courseFee = 0; String courseName = "Web Service"; switch (courseName) { case "Hadoop": courseFee = 79; break; case "Spark": courseFee = 89; break; default: assert false : "Given course is in Progress and currently not available"; // line n1 } System.out.println("Fees for the course is :" + courseFee); } } 1. AssertionError: Given course is in Progress and currently not available
2. It will print Given course is in Progress and currently not available.
Correct Answer : Get Lastest Questions and Answer : Explanation: No matching course is found. Hence, control will go to default statement. In default statement it will throw assertion error.
Question : You have been given below code, what is the behavior expected?
Correct Answer : Get Lastest Questions and Answer : Explanation: you need to manually release the ExecutorService by calling the shutdown() method to terminate the program.
Submits a value-returning task for execution and returns a Future representing the pending results of the task. The Future's get method will return the task's result upon successful completion. If you would like to immediately block waiting for a task, you can use constructions of the form result = exec.submit(aCallable).get(); Note: The Executors class includes a set of methods that can convert some other common closure-like objects, for example, java.security.PrivilegedAction to Callable form so they can be submitted. Parameters: task the task to submit the type of the task's result Returns: a Future representing pending completion of the task Throws: RejectedExecutionException - if the task cannot be scheduled for execution NullPointerException - if the task is null
Which of the following statement is correct? 1. In character streams (e.g. HadoopExam.com), data is handled in terms of bytes (e.g. 0100001001), in byte streams, data is handled in terms of Unicode characters e.g. UTF-8. UTF-16.
2. Character streams are suitable for reading or writing to files such as executable files, image files, and files in low-level file formats such as .zip, .class, and .jpg.