Top 50 Java-google Web Toolkit (GWT) Interview Questions You Must Prepare 24.Jun.2024

Q1. What Is The Purpose Of 'script' Tag In *.gwt.xml File In Gwt?

Automatically injects the external JavaScript file located at the location specified by src.

Q2. What Is The Purpose Of Image Widget Of A Gwt?

This widget displays an image at a given URL.

Q3. What Is The Difference Between 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.

 

Q4. What Is The Purpose Of 'module' Tag In *.gwt.xml File In Gwt?

This provides name of the application.

 

Q5. What Is The Purpose Of 'inherits' Tag In *.gwt.xml File In Gwt?

This adds other gwt module in application just like import does in java applications. Any number of modules can be inherited in this manner.

Q6. 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 widgest has a default style of gwt-TextBox.

Q7. What Is .cache.html File In Gwt?

It contains the actual program of a GWT application.

Q8. 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.

Q9. 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.

Q10. 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.

Q11. What Is The Purpose Of Html Widget Of A Gwt?

This widget can contain HTML text and displays the html content using a <div> element, causing it to be displayed with block layout.

Q12. Which Class Is The Superclass Of All User-interface Classes?

The class UIObject is the superclass for all user-interface objects.

Q13. 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.

Q14. How To Enable History Support In Gwt Application?

In order to use GWT History support, we must first embed following iframe into our host HTML page.
<iframe src="javascript:''" id="__gwt_historyFrame" style="width:0;height:0;border:0"></iframe>

 

Q15. Which Gwt Widget Represents A View Of A Tree?

CellTree widget represents a view of a tree. This widget will only work in standards mode, which requires that the HTML page in which it is run have an explicit <!DOCTYPE> declaration.

 

Q16. Explain 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.

Q17. Which Gwt Widget Represents A Standard Hierarchical Tree?

Tree widget represents a standard hierarchical tree widget. The tree contains a hierarchy of TreeItems that the user can open, close, and select.

Q18. 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 client side application in JAVA.
  • GWT compiles the code written in JAVA to JavaScript code.
  • Application written in GWT is cross-browser compliant. GWT automatically generates javascript code suitable for each browser.
  • GWT is open source, completely free, and used by thousands of developers around the world. It is licensed under the Apache License version 2.@

Q19. Which Gwt Widget Represents A Panel That Lays All Of Its Widgets Out In A Single Horizontal Column?

HorizontalPanel widget represents a panel that lays all of its widgets out in a single horizontal column.

 

Q20. 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.

Q21. Which Widget Represents A Rich Text Editor In Gwt?

RichTextArea widget represents a rich text editor that allows complex styling and formatting.

 

Q22. What Is Gwt Logging Framework?

The logging framework emulates java.util.logging, so it uses the same syntax and has the same behavior as server side logging code.
GWT logging is configured using .gwt.xml files.
We can configure logging to be enabled/disabled; we can enable/disable particular handlers, and change the default logging level.

Q23. 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.

 

Q24. What Are The Components Of A Gwt Application?

A GWT application consists of following four important parts out of which last part is optional but first three parts are mandatory −

  • Module descriptors
  • Public resources
  • Client-side code
  • Server-side code

Q25. What Is The Purpose Of Label Widget Of A Gwt?

This widget contains text, not interpreted as HTML using a <div>element, causing it to be displayed with block layout.

Q26. 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.

Q27. What Is The Purpose Of 'public' Tag In *.gwt.xml File In Gwt?

The public path is the place in your project where static resources referenced by your GWT module, such as CSS or images, are stored.

Q28. Which Widget Represents A Standard Push Button In Gwt?

Button widget represents a standard push button.

Q29. Which Class Is The Base Class Of All Layout Panel Classes?

Panel is the abstract base class for all panels, which are widgets that can contain other widgets.

Q30. 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.

Q31. 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.

Q32. What Is The Purpose Of 'source' Tag In *.gwt.xml File In Gwt?

This specifies the names of source folders which GWT compiler will search for source compilation.

Q33. Which Method Of A Entry-point Class Is Called When Gwt Application Starts?

onModuleLoad() function gets called and acts similar to main method of a java application.

Q34. Explain 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.

Q35. 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.

Q36. What Are Layout Panels In Gwt?

Layout Panels can contain other widgets. These panels controls the way widgets to be shown on User Interface. Every Panel widget inherits properties from Panel class which in turn inherits properties from Widget class and which in turn inherits properties from UIObject class.

Q37. 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.

Q38. What Is *.nocache.js File In Gwt?

It contains the javascript code required to resolve deferred binding configuarations (for example, browser detection) and to use lookup table generated by GWT compiler to locate one of the .cache.html.

 

Q39. Which Gwt Widget Represents A Browsable View Of A Tree In Which Only A Single Node Per Level May Be Open At One Time?

CellBrowser widget represents a browsable view of a tree in which only a single node per level may be open at one time. This widget will only work in standards mode, which requires that the HTML page in which it is run have an explicit <!DOCTYPE> declaration.

Q40. What Is The Purpose Of Removestylename() Function Of A Gwt Widget?

This method will remove given style from the widget and leaves any others associated with the widget.

Q41. Can You Have Multiple Entry-point Classes In A *.gwt.xml File?

Yes! Any number of entry-point classes can be added.

Q42. Why Should A .nocache.js File Never Be Cached?

GWT compiler generates .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. gwt.js code actually appends a unique timestamp at the end of the file name so that browser always treat it a new file and should never cache it.

Q43. What Are The Core Components Of Gwt?

Following are the core components of GWT −
GWT Java to JavaScript compiler − This is the most important part of GWT which makes it a powerful tool for building RIAs. The GWT compiler is used to trlate all the application code written in Java into JavaScript.
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.
GWT Hosted Web Browser − GWT Hosted Web Browser lets you run and execute your GWT applications in hosted mode, where your code runs as Java in the Java Virtual Machine without compiling to JavaScript.

Q44. What Is Default Public Path For Static Resources In Gwt Application?

The default public path is the public subdirectory underneath where the Module XML File is stored.

Q45. What Is The Purpose Of 'entry-point' Tag In *.gwt.xml File In Gwt?

This specifies the name of class which will start loading the GWT Application.

Q46. Which Widget Represents A Single Line Text Box In Gwt?

TextBox widget represents a single line text box.

 

Q47. 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.

Q48. What Is The Purpose Of Anchor Widget Of Gwt?

This widget represents a simple <a> element.

 

Q49. Explain Bootstrap Procedure For Gwt Application?

Following are the steps of bootstrap proceure for GWT application when a browser loads the GWT application −

  • Browser loads the host html page and .nocache.js file.
  • Browser executes the .nocache.js file's javascript code.
  • .nocache.js code resolves deferred binding configuarations (for example, browser detection) and use lookup table generated by GWT compiler to locate one of the .cache.html.
  • .nocache.js code then creates a html hidden iframe, inserts that iframe into the host page's DOM, and loads the .cache.html file into the same iframe.
  • .cache.html contains the actual program of a GWT application and once loaded in iframe shows the GWT application in the browser.

Q50. What Is The Purpose Of 'stylesheet' Tag In *.gwt.xml File In Gwt?

Automatically injects the external CSS file located at the location specified by src.