GWT Interview Questions with Answers:-
1. Define What is GWT?
Google Web Toolkit (GWT) is a development toolkit for building and optimizing complex browser-based applications. GWT is used by many products at Google, including Google AdWords and Orkut.
2. What are the features of GWT?
Following are the features of GWT −
- Google Web Toolkit (GWT) is a development toolkit to create RICH Internet Application(RIA).
- GWT provides developers option to write the client-side application in JAVA.
- GWT is open source, completely free, and used by thousands of developers around the world. It is licensed under the Apache License version 2.0.
3. What are the core components of GWT?
Following are the core components of GWT −
- JRE Emulation library:− Google Web Toolkit includes a library that emulates a subset of the Java runtime library. The list includes Java.lang, java.lang.annotation, java.math, java.io, java.sql, java.util and java.util.logging.
- GWT UI building library:− This part of GWT consists of many subparts which includes the actual UI components, RPC support, History management, and much more.
4. What is Module descriptor in GWT?
A module descriptor is the configuration file in the form of XML which is used to configure a GWT application. A module descriptor file extension is *.gwt.xml, where * is the name of the application and this file should reside in the project’s root.
5. What is the purpose of ‘module’ tag in the *.gwt.xml file in GWT?
This provides the name of the application.
6. What is the purpose of ‘inherits’ tag in the *.gwt.xml file in GWT?
This adds other get modules in application just like import does in Java applications. Any number of modules can be inherited in this manner.
7. What is the purpose of ‘entry-point’ tag in the *.gwt.xml file in GWT?
This specifies the name of the class which will start loading the GWT Application.
8. Can you have multiple entry-point classes in a *.gwt.xml file?
Yes! Any number of entry-point classes can be added.
9. Which method of an entry-point class is called when GWT application starts?
onModuleLoad() function gets called and acts similar to the main method of a java application.
10. How onModuleLoad() functions get called if multiple entry-point classes are specified in *.gwt.xml?
They are called sequentially in the order in which entry-point classes appear in the module file. So when the onModuleLoad() of your first entry point finishes, the next entry point is called immediately.
11. What is the purpose of ‘source’ tag in the *.gwt.xml file in GWT?
This specifies the names of source folders which GWT compiler will search for source compilation.
12. What is the purpose of ‘public’ tag in the *.gwt.xml file in GWT?
The public path is the place in your project where static resources referenced by your GWT modules, such as CSS or images, are stored.
13. What is the default public path for static resources in the GWT application?
The default public path is the public subdirectory underneath where the Module XML File is stored.
14. What is the purpose of ‘script’ tag in the *.gwt.xml file in GWT?
15. What is the purpose of ‘stylesheet’ tag in the *.gwt.xml file in GWT?
Automatically injects the external CSS file located at the location specified by src.
16. What is an entry-point class?
A module entry-point is any class that is assignable to EntryPoint and that can be constructed without parameters. When a module is loaded, every entry point class is instantiated and its EntryPoint.onModuleLoad() method gets called.
17. What is *.nocache.js file in GWT?
18. What is the .cache.html file in GWT?
It contains the actual program of a GWT application.
19. Explain the bootstrap procedure for the GWT application.
Following are the steps of a bootstrap procedure for GWT application when a browser loads the GWT application −
- Browser loads the host HTML page and a .nocache.js file.
- .nocache.js code resolves deferred binding configurations (for example, browser detection) and uses lookup table generated by GWT compiler to locate one of the .cache.html.
- .nocache.js code then creates an HTML hidden iframe, inserts that iframe into the host page’s DOM, and loads the .cache.html file into the same frame.
- .cache.html contains the actual program of a GWT application and once loaded in iframe shows the GWT application in the browser.
20. Why should a .nocache.js file never be cached?
GWT compiler generates a .nocache.js file every time with the same name whenever a GWT application is compiled. So browser should always download the .nocache.js file to get the latest gwt application. the gwt.js code actually appends a unique timestamp at the end of the file name so that browser always treats it a new file and should never cache it.
21. What is the purpose of Host Page?
The most important public resource is host page which is used to invoke actual GWT application. A typical HTML host page for an application might not include any visible HTML body content at all but it is always expected to include GWT application via a <script…/> tag.
22. What is the default style name of any GWT widget?
By default, the class name for each component is gwt-<classname>. For example, the Button widget has a default style of gwt-Button and similar way TextBox widget has a default style of GWT-TextBox.
23. Do GWT compiler creates default Id attribute for its Widget by default?
No! By default, neither the browser nor GWT creates default id attributes for widgets.
24.What is the purpose of setStyleName() function of a GWT widget?
This method will clear any existing styles and set the widget style to the new CSS class provided using style.
25. What is the purpose of addStyleName() function of a GWT widget?
This method will add a secondary or dependent style name to the widget. A secondary style name is an additional style name that is, so if there were any previous style names applied they are kept.
GWT Questions Pdf Free Download::
26. What is the purpose of removeStyleName() function of a GWT widget?
This method will remove the given style from the widget and leaves any others associated with the widget.
27.What is the purpose of getStyleName() function of a GWT widget?
This method gets all of the object’s style names, as a space-separated list.
28.What is the purpose of setStylePrimaryName() function of a GWT widget?
This method sets the object’s primary style name and updates all dependent style names.
29. What is the difference between the primary style and secondary styles of a GWT Widget?
By default, the primary style name of a widget will be the default style name for its widget class. For example, gwt-Button for Button widgets. When we add and remove style names using AddStyleName() method, those styles are called secondary styles.
The final appearance of a widget is determined by the sum of all the secondary styles added to it, plus its primary style. You set the primary style of a widget with the setStylePrimaryName(String) method.
30. How you can attach a CSS file with your GWT module?
There are multiple approaches for associating CSS files with your module. Modern GWT applications typically use a combination of CssResource and UiBinder.
Using a <link> tag in the host HTML page.
Using the <stylesheet> element in the module XML file.
Using a CssResource contained within a ClientBundle.
Using an inline <ui:style> element in a UiBinder template.
31. Which class is the superclass of all user-interface classes?
The class UIObject is the superclass for all user-interface objects.
32. Define the UIObject class.
The class UIObject is the superclass for all user-interface objects. It simply wraps a DOM element, and cannot receive events. It provides direct child classes like Widget, MenuItem, MenuItemSeparator, TreeItem.
All UIObject objects can be styled using CSS.
Every UIObject has a primary style name that identifies the key CSS style rule that should always be applied to it.
More complex styling behavior can be achieved by manipulating an object’s secondary style names.
33. Define Widget class?
The class Widget is the base class for the majority of user-interface objects. Widget adds support for receiving events from the browser and being added directly to panels.
34. What is the purpose of the Label widget of a GWT?
This widget contains text, not interpreted as HTML using an <div>element, causing it to be displayed with block layout.
35. What is the purpose of the HTML widget of a GWT?
This widget can contain HTML text and displays the HTML content using an <div> element, causing it to be displayed with block layout.
36. What is the purpose of the Image widget of a GWT?
This widget displays an image at a given URL.
37. What is the purpose of Anchor widget of GWT?
This widget represents a simple <a> element.
38..Which widget represents a standard push button in GWT?
Button widget represents a standard push button.
39Which widget represents a normal push button with custom styling in GWT?
PushButton represents a normal push button with custom styling.
40. Which widget represents a stylish stateful button which allows the user to toggle between up and down states in GWT?
ToggleButton widget represents a stylish stateful button which allows the user to toggle between up and down states.
41.Which widget represents a standard checkbox widget. Does this class also serve as a base class for RadioButton in GWT?
CheckBox widget represents a standard checkbox widget. This class also serves as a base class for RadioButton.
42. Which widget represents a mutually-exclusive selection radio button widget in GWT?
RadioButton widget represents a mutually-exclusive selection radio button widget.
43. Which widget represents a list of choices to the user, either as a list box or as a drop-down list in GWT?
ListBox widget represents a list of choices to the user, either as a list box or as a drop-down list.
44. Which widget acts as a suggestion box in GWT?
SuggestBox widget represents a text box or text area which displays a pre-configured set of selections that match the user’s input. Each SuggestBox is associated with a single SuggestOracle. The SuggestOracle is used to provide a set of selections given a specific query string.
45. Which widget represents a single line text box in GWT?
TextBox widget represents a single line text box.
46. Which widget represents a password text box in GWT?
PasswordTextBox widget represents a text box that visually masks its input to prevent eavesdropping.
47. Which widget represents a multiline text box in GWT?
TextArea widget represents a text box that allows multiple lines of text to be entered.
48. Which widget represents a rich text editor in GWT?
RichTextArea widget represents a rich text editor that allows complex styling and formatting.
49. Which widget represents a file upload in GWT?
FileUpload widget wraps the HTML <input type=’file’> element.
50.Which widget represents a hidden field in GWT?
Hidden widget represents a hidden field in an HTML form.