8
Q:

void waitForSignal() {

Object obj = new Object();

synchronized (Thread.currentThread()) {

obj.wait();

obj.notify();

}

}

Which statement is true?

A) This code can throw an InterruptedException. B) This code can throw an IllegalMonitorStateException.
C) This code can throw a TimeoutException after ten minutes D) All the above

Answer:   B) This code can throw an IllegalMonitorStateException.



Explanation:

It will throw  IllegalMonitorStateException.

Subject: Java
Job Role: IT Trainer
Q:

How can you make sure your dependencies are safe ?

Answer

When writing Node.js applications, ending up with hundreds or even thousands of dependencies can easily happen.
For example, if you depend on Express, you depend on 27 other modules directly, and of course on those dependencies' as well, so manually checking all of them is not an option!


The only option is to automate the update / security audit of your dependencies. For that there are free and paid options:


1. npm outdated
2. Trace by RisingStack
3. NSP
4. GreenKeeper
5. Snyk

Report Error

View answer Workspace Report Error Discuss

1 4528
Q:

What is the difference between ViewState and SessionState?

Answer

'ViewState' is specific to a page in a session.
'SessionState' is specific to user specific data that can be accessed across all pages in the web application.

Report Error

View answer Workspace Report Error Discuss

Subject: Java
Job Role: Analyst , IT Trainer

3 2551
Q:

How can you avoid callback hells ?

Answer

There are lots of ways to solve the issue of callback hells:


1. Modularization: break callbacks into independent functions
2. Use a control flow library, like async
3. Use generators with Promises
4. Use async/await (note that it is only available in the latest v7 release and not in the LTS version)

Report Error

View answer Workspace Report Error Discuss

Subject: Java
Job Role: Analyst , IT Trainer

3 2334
Q:

What is an error-first callback ?

Answer

Error-first callbacks are used to pass errors and data as well. You have to pass the error as the first parameter, and it has to be checked to see if something went wrong. Additional arguments are used to pass data.


 


fs.readFile(filePath, function(err, data) {
if (err) {
// handle the error, the return is important here
// so execution stops here
return console.log(err)
}
// use the data object
console.log(data)
})

Report Error

View answer Workspace Report Error Discuss

2 3023
Q:

What are Spring beans ?

Answer

The Spring Beans are Java Objects that form the backbone of a Spring application. They are instantiated, assembled, and managed by the Spring IoC container. These beans are created with the configuration metadata that is supplied to the container.
Beans defined in spring framework are singleton beans. There is an attribute in bean tag named "singleton" if specified true then bean becomes singleton and if set to false then the bean becomes a prototype bean. By default it is set to true. So, all the beans in spring framework are by default singleton beans.

Report Error

View answer Workspace Report Error Discuss

Subject: Java
Job Role: Analyst , IT Trainer

4 2995
Q:

What is Spring IoC container ?

Answer

The Spring IoC is responsible for creating the objects,managing them (with dependency injection (DI)), wiring them together, configuring them, as also managing their complete lifecycle.

Report Error

View answer Workspace Report Error Discuss

Subject: Java Exam Prep: Bank Exams
Job Role: Analyst , Project Manager , Software Architect

3 1995
Q:

Which containers use a FlowLayout as their default layout ?

Answer

The Panel and Applet classes use the FlowLayout as their default layout.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

3 5453
Q:

Which containers use a border Layout as their default layout ?

Answer

The window, Frame and Dialog classes use a border layout as their default layout.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

8 5976