Interview Questions.

GWT Interview Questions and Answers


GWT Interview Questions and Answers

Q1. What is Google Web Toolkit (GWT)?

Ans: The Google Web Toolkit (GWT) is a toolkit to expand Ajax internet utility with Java. The programmer writes Java code and this code is translated into HTML and Javascript via the GWT compiler.

The compiler creates browser specific HTML and JavaScript to assist all of the predominant browsers correctly. GWT supports a standard set of UI widgets, has construct in help for the browser lower back button and a JUnit primarily based test framework.

GWT presents  modes:

Development Mode: allows to debug the Java code of your utility immediately thru the same old Java debugger.

Web mode: the utility is translated into HTML and Javascript code and may be deployed to a webserver.

Q2. What are the Important modules in GWT?


GWT Compiler

JRE Emulation library

Hosted Mode ( Run as java)

Web Mode ( Run as JavaScript)

Q3. Is GWT works in all the browsers? If sure why?

Ans: Yes GWT works in all of the browsers due to the fact GWT compiler creates javascript code per browser and in line with localization.

I intended, in case you configure module.Xml with Firefox and IE then GWT compiler will create javascript code for both browsers seperately.

And whilst you load the application it first check from which browser you're commencing the utility and it'll load the corresponding javascript.

It way GWT helps Cross browser capability.

Q4. What are the functions of GWT?

Ans: Following are the features of GWT:

Google Web Toolkit (GWT) is a development toolkit to create RICH Internet Application(RIA).

GWT presents developers option to write patron facet software in JAVA.

GWT compiles the code written in JAVA to JavaScript code.

Application written in GWT is move-browser compliant. GWT robotically generates javascript code suitable for each browser.

GWT is open supply, absolutely unfastened, and utilized by thousands of builders round the sector. It is licensed underneath the Apache License model 2.Zero.

Q5. What are the center components of GWT?

Ans: Following are the middle additives of GWT:

GWT Java to JavaScript compiler: This is the maximum crucial a part of GWT which makes it a powerful device for building RIAs. The GWT compiler is used to translate all of the software code written in Java into JavaScript.

JRE Emulation library: Google Web Toolkit consists of a library that emulates a subset of the Java runtime library. The listing includes java.Lang, java.Lang.Annotation, java.Math, java.Io, java.Sq., java.Util and java.Util.Logging.

GWT UI constructing library: This part of GWT includes many subparts which incorporates the real UI components, RPC help, History management, and much more.

GWT Hosted Web Browser: GWT Hosted Web Browser lets you run and execute your GWT packages in hosted mode, in which your code runs as Java inside the Java Virtual Machine with out compiling to JavaScript.

Q6. Why would not GWT offer a synchronous server connection option?

Ans: GWT's network operations are all asynchronous, or non-blockading. That is, they return straight away as soon as called, and require the consumer to apply a callback approach to address the consequences when they're sooner or later returned from the server. Though in some cases asynchronous operators are less handy to apply than synchronous operators, GWT does now not offer synchronous operators.

The purpose is that maximum browsers' JavaScript engines are single-threaded. As a result, blockading on a call to XMLHTTPRequest also blocks the UI thread, making the browser appear to freeze during the connection to the server. Some browsers offer a way around this, however there is no popular solution. GWT does now not put in force a synchronous network connection because to accomplish that would be to introduce a characteristic that doesn't paintings on all browsers, violating GWT's commitment to no-compromise, go-browser AJAX. It would additionally introduce complexity for developers, who would should hold  distinct variations of their communications code with the intention to handle all browsers.

Q7. What is the reason of ‘supply’ tag in *.Gwt.Xml file in GWT?

Ans: This specifies the names of supply folders which GWT compiler will search for supply compilation.

Q8. What is the purpose of ‘public’ tag in *.Gwt.Xml document in GWT?

Ans: The public path is the place to your undertaking where static resources referenced through your GWT module, including CSS or pictures, are saved.

Q9. Which widget represents a single line textual content box in GWT?

Ans: TextBox widget represents a single line textual content box.

Q10. Which widget represents a password textual content field in GWT?

Ans: PasswordTextBox widget represents a textual content box that visually mask its enter to prevent eavesdropping.

Q11. Which widget represents a multiline textual content container in GWT?

Ans: TextArea widget represents a text box that lets in multiple lines of text to be entered.

Q12. Which widget represents a rich text editor in GWT?

Ans: RichTextArea widget represents a wealthy text editor that lets in complex styling and formatting.

Q13. Explain bootstrap procedure for GWT application.

Ans: Following are the stairs of bootstrap proceure for GWT software while a browser hundreds the GWT software −

Browser loads the host html page and .Nocache.Js document.

Browser executes the .Nocache.Js document’s javascript code.

.Nocache.Js code resolves deferred binding configuarations (for instance, browser detection) and use research table generated by GWT compiler to discover one of the .Cache.Html.

.Nocache.Js code then creates a html hidden iframe, inserts that iframe into the host web page’s DOM, and hundreds the .Cache.Html record into the identical iframe.

.Cache.Html incorporates the actual application of a GWT application and as soon as loaded in iframe shows the GWT utility within the browser.

Q14. What are Modules, Entry Points and HTML Pages in GWT?

Ans: GWT packages are defined as modules. A module "modulename" is defined via a configuration report "modulename.Gwt.Xml". Each module can outline one or extra Entry point lessons.

An access factor is the starting point for a GWT utility, similar to the primary approach in a standard Java program. A Java magnificence that is an access point should put into effect the interface "com.Google.Gwt.Middle.Customer.EntryPoint" which defines the technique onModuleLoad().

The module is hooked up to a HTML page, which is called "host page". The code for a GWT web application executes within this HTML document.

The HTML web page can define "div" containers to which the GWT software can assign UI additives or the GWT UI components are definitely assigned to the frame tag of the HTML web page.

Q15. What are the language differences between web mode and hosted mode?

Ans: Typically, in case your code runs as intended in hosted mode and compiles to JavaScript without mistakes, internet mode conduct could be equal. Occasional different troubles can motive subtle insects to seem in web mode that do not seem in hosted mode. Fortunately the ones instances are uncommon.

Q16. What is the motive of the IsSerializable interface in GWT?

Ans: A consumer-described class is serializable if all of the following practice:

It is assignable to IsSerializable or Serializable, both because it immediately implements such a interfaces or because it derives from a superclass that does

All non-very last, non-transient instance fields are themselves serializable, and

As of GWT 1.5, it ought to have a default (zero argument) constructor (with any get admission to modifier) or no constructor at all.

One key distinction though is that , for protection motives, all Serializable classes ought to be included in a serialization policy, that is generated at compile time, at the same time as IsSerializable training do not have that requirement.

If your interest is solely in GWT, and also you do not e.G. Percentage your version lessons between the net utility and another application, I advise you have got your version classes/DTOs implement IsSerializable.

Q17. What is Gwt Sever Side RemoteServiceServlet?

Ans: Public class Remote Service Servlet extends javax.Servlet.Http.HttpServletimplements SerializationPolicyProvider

The servlet base class for your RPC carrier implementations that automatically deserializes incoming requests from the patron and serializes outgoing responses for purchaser/server RPCs.

Q18. How GWT Navigation works?

Ans: In GWT we are able to cope with web page navigation the usage of couple of methods.

Using History tokens.

Clearing the content panel and load the brand new page inside the content material panel.

Q19. What 3d celebration libraries have used with GWT? Which libraries might you suggest? Why?


GUICE: for Server facet dependency injection

GIN: for consumer side dependency injection

GWTP: Model - View - Presenter framework

Q20. Describe how an occasion bus is used and implemented.

Ans: Create a Classs that extends GWTEvent

Define a brand new handler and marker interface for the event elegance.

Register the occasion the use of EventBus in which you implement interface( the only written inside the occasion magnificence)

enforce the interface approach and speak to the occasion fireplace approach

Q21. What is Module descriptor in GWT?

Ans: A module descriptor is the configuration document in the shape of XML that's used to configure a GWT application. A module descriptor record extension is *.Gwt.Xml, wherein * is the call of the software and this document must reside within the venture's root.

Q22. How can we run GWT software?

Ans: Two approaches of walking the application:

Create a battle document and installation in any app server or

Run ant hosted within the command activate. And click on at the ‘Launch Default Browser’.

Q23. How to collect the GWT software?

Ans: Run ant construct inside the root folder of the utility

By default gwt compiler creates optimized JS documents for some browsers.

Disadvantage is it takes numerous time to bring together every alternate because of the diversifications


Open command activate

Go to the application root folder

Run command as "ant build"

Then you could see assemble logs are coming. If you notice BUILD SUCCESSFUL it manner no error to your software. If BUILD FAILED it approach there may be an errors to your software.