2
Q:

public class Threads2 implements Runnable {

public void run() {

System.out.println("run.");

throw new RuntimeException("Problem");

Which among the following is true?

}

public static void main(String[] args) {

Thread t = new Thread(new Threads2());

t.start();

System.out.println("End of method.");

}

}

A) java.lang.RuntimeException: Problem B) run. java.lang.RuntimeException: Problem
C) End of method. java.lang.RuntimeException: Problem D) End of method. run. java.lang.RuntimeException: Problem

Answer:   D) End of method. run. java.lang.RuntimeException: Problem



Explanation:

Only D can be true

Subject: Java
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 4555
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 2560
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 2342
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 3045
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 3010
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 2005
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 5475
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 6008