Java Interview Questions & Answers

  1. Question 1. Explain Some Assembly Controls?

    Answer :

    • BRA Branch; Motorola 680×0, Motorola 68300; short (16 bit) unconditional branch relative to the current program counter
    • JMP Jump; Motorola 680×0, Motorola 68300; unconditional jump (any valid effective addressing mode other than data register)
    • JMP Jump; Intel 80×86; unconditional jump (near [relative displacement from PC] or far; direct or indirect [based on contents of general purpose register, memory location, or indexed])
    • JMP Jump; MIX; unconditional jump to location M; J-register loaded with the address of the instruction which would have been next if the jump had not been taken
    • JSJ Jump, Save J-register; MIX; unconditional jump to location M; J-register unchanged
    • Jcc Jump Conditionally; Intel 80×86; conditional jump (near [relative displacement from PC] or far; direct or indirect [based on contents of general purpose register, memory location, or indexed]) based on a tested condition: JA/JNBE, JAE/JNB, JB/JNAE, JBE/JNA, JC, JE/JZ, JNC, JNE/JNZ, JNP/JPO, JP/JPE, JG/JNLE, JGE/JNL, JL/JNGE, JLE/JNG, JNO, JNS, JO, JS
    • Bcc Branch Conditionally; Motorola 680×0, Motorola 68300; short (16 bit) conditional branch relative to the current program counter based on a tested condition: BCC, BCS, BEQ, BGE, BGT, BHI, BLE, BLS, BLT, BMI, BNE, BPL, BVC, BVS
    • JOV Jump on Overflow; MIX; conditional jump to location M if overflow toggle is on; if jump occurs, J-register loaded with the address of the instruction which would have been next if the jump had not been taken
  2. Question 2. What Is Assembly Condition Codes?

    Answer :

    Condition codes are the list of possible conditions that can be tested during conditional instructions. Typical conditional instructions include: conditional branches, conditional jumps, and conditional subroutine calls. Some processors have a few additional data related conditional instructions, and some processors make every instruction conditional. Not all condition codes available for a processor will be implemented for every conditional instruction.

  3. File Maker Interview Questions

  4. Question 3. What Is Data Movement?

    Answer :

    Data movement instructions move data from one location to another. The source and destination locations are determined by the addressing modes, and can be registers or memory. Some processors have different instructions for loading registers and storing to memory, while other processors have a single instruction with flexible addressing modes.

  5. Question 4. What Are Kinds Of Processors?

    Answer :

    Processors can broadly be divided into the categories of: CISC, RISC, hybrid, and special purpose.

  6. File Maker Tutorial

  7. Question 5. What Are Assembly Attributes?

    Answer :

    Attributes are declarative tags in code that insert additional metadata into an assembly.

  8. J2EE Interview Questions

  9. Question 6. What Are The Types Of Assemblies?

    Answer :

    Assemblies are of two types: 

    1. Private Assemblies 
    2. Shared Assemblies
  10. Question 7. Explain An Intermediate Language?

    Answer :

    Assemblies are made up of IL code modules and the metadata that describes them. Although programs may be compiled via an IDE or the command line, in fact, they are simply translated into IL, not machine code. The actual machine code is not generated until the function that requires it is called.

  11. J2EE Tutorial
    Core Java Interview Questions

  12. Question 8. What Is Assembly Language?

    Answer :

    Each personal computer has a microprocessor that manages the computer’s arithmetical, logical, and control activities.

    Each family of processors has its own set of instructions for handling various operations such as getting input from keyboard, displaying information on screen and performing various other jobs. These set of instructions are called ‘machine language instructions’.

    A processor understands only machine language instructions, which are strings of 1’s and 0’s. However, machine language is too obscure and complex for using in software development. So, the low-level assembly language is designed for a specific family of processors that represents various instructions in symbolic code and a more understandable form.

  13. Question 9. What Are The Advantages Of Assembly Language?

    Answer :

    Having an understanding of assembly language makes one aware of:

    • How programs interface with OS, processor, and BIOS;
    • How data is represented in memory and other external devices;
    • How the processor accesses and executes instruction;
    • How instructions access and process data;
    • How a program accesses external devices.

    Other advantages of using assembly language are:

    • It requires less memory and execution time;
    • It allows hardware-specific complex jobs in an easier way;
    • It is suitable for time-critical jobs;
    • It is most suitable for writing interrupt service routines and other memory resident programs.
  14. Android Interview Questions

  15. Question 10. What Are The Basic Features Of Pc Hardware?

    Answer :

    The main internal hardware of a PC consists of processor, memory, and registers. Registers are processor components that hold data and address. To execute a program, the system copies it from the external device into the internal memory. The processor executes the program instructions.

    The fundamental unit of computer storage is a bit; it could be ON (1) or OFF (0). A group of nine related bits makes a byte, out of which eight bits are used for data and the last one is used for parity. According to the rule of parity, the number of bits that are ON (1) in each byte should always be odd.

    So, the parity bit is used to make the number of bits in a byte odd. If the parity is even, the system assumes that there had been a parity error (though rare), which might have been caused due to hardware fault or electrical disturbance.

    The processor supports the following data sizes −

    • Word: a 2-byte data item
    • Doubleword: a 4-byte (32 bit) data item
    • Quadword: an 8-byte (64 bit) data item
    • Paragraph: a 16-byte (128 bit) area
    • Kilobyte: 1024 bytes
    • Megabyte: 1,048,576 bytes
  16. Core Java Tutorial

  17. Question 11. What Is Binary Number System?

    Answer :

    Every number system uses positional notation, i.e., each position in which a digit is written has a different positional value. Each position is power of the base, which is 2 for binary number system, and these powers begin at 0 and increase by 1.

    The value of a binary number is based on the presence of 1 bits and their positional value. So, the value of a given binary number is:

    1 + 2 + 4 + 8 +16 + 32 + 64 + 128 = 255

    which is same as 28 – 1.

  18. JavaServer Faces (JSF) Interview Questions

  19. Question 12. What Is Hexadecimal Number System?

    Answer :

    Hexadecimal number system uses base 16. The digits in this system range from 0 to 15. By convention, the letters A through F is used to represent the hexadecimal digits corresponding to decimal values 10 through 15.

    Hexadecimal numbers in computing is used for abbreviating lengthy binary representations. Basically, hexadecimal number system represents a binary data by dividing each byte in half and expressing the value of each half-byte. 

  20. File Maker Interview Questions

  21. Question 13. What Is Local Environment Setup?

    Answer :

    Assembly language is dependent upon the instruction set and the architecture of the processor. In this tutorial, we focus on Intel-32 processors like Pentium. To follow this tutorial, you will need :

    • An IBM PC or any equivalent compatible computer
    • A copy of Linux operating system
    • A copy of NASM assembler program

    There are many good assembler programs, such as :

    • Microsoft Assembler (MASM)
    • Borland Turbo Assembler (TASM)
    • The GNU assembler (GAS)

    We will use the NASM assembler, as it is :

    • Free. You can download it from various web sources.
    • Well documented and you will get lots of information on net.
    • Could be used on both Linux and Windows.
  22. Android Tutorial

  23. Question 14. How To Installing Nasm?

    Answer :

    If you select “Development Tools” while installing Linux, you may get NASM installed along with the Linux operating system and you do not need to download and install it separately. For checking whether you already have NASM installed, take the following steps −

    • Open a Linux terminal.
    • Type whereis nasm and press ENTER.
    • If it is already installed, then a line like, nasm: /usr/bin/nasm appears. Otherwise, you will see just nasm:, then you need to install NASM.

    To install NASM, take the following steps :

    • Check The netwide assembler (NASM) website for the latest version.
    • Download the Linux source archive nasm-X.XX.ta.gz, where X.XX is the NASM version number in the archive.
    • Unpack the archive into a directory which creates a subdirectory nasm-X. XX.
    • cd to nasm-X.XX and type ./configure. This shell script will find the best C compiler to use and set up Makefiles accordingly.
    • Type make to build the nasm and ndisasm binaries.
    • Type make install to install nasm and ndisasm in /usr/local/bin and to install the man pages.

    This should install NASM on your system. Alternatively, you can use an RPM distribution for the Fedora Linux. This version is simpler to install, just double-click the RPM file.

     

  24. Question 15. What Are The Assembly Program Sections?

    Answer :

    An assembly program can be divided into three sections −

    • The data section,
    • The bss section, and
    • The text section.
  25. Java Swing Interview Questions

  26. Question 16. What Is The Data Section?

    Answer :

    The data section is used for declaring initialized data or constants. This data does not change at runtime. You can declare various constant values, file names, or buffer size, etc., in this section.

    The syntax for declaring data section is:

    section.data

  27. JavaServer Faces (JSF) Tutorial

  28. Question 17. What Is The Bss Section?

    Answer :

    The bss section is used for declaring variables. The syntax for declaring bss section is :

    section.bss

  29. Javascript Objects Interview Questions

  30. Question 18. What Is The Text Section?

    Answer :

    The text section is used for keeping the actual code. This section must begin with the declaration global _start, which tells the kernel where the program execution begins.

    The syntax for declaring text section is:

    section.text
       global _start
    _start:

  31. J2EE Interview Questions

  32. Question 19. What Are The Assembly Language Statements?

    Answer :

    Assembly language programs consist of three types of statements −

    • Executable instructions or instructions,
    • Assembler directives or pseudo-ops, and
    • Macros.

    The executable instructions or simply instructions tell the processor what to do. Each instruction consists of an operation code (opcode). Each executable instruction generates one machine language instruction.

    The assembler directives or pseudo-ops tell the assembler about the various aspects of the assembly process. These are non-executable and do not generate machine language instructions.

    Macros are basically a text substitution mechanism.

  33. Java Swing Tutorial

  34. Question 20. What Is The Syntax Of Assembly Language Statements?

    Answer :

    Assembly language statements are entered one statement per line. Each statement follows the following format −

    [label]   mnemonic   [operands]   [;comment]

    The fields in the square brackets are optional. A basic instruction has two parts, the first one is the name of the instruction (or the mnemonic), which is to be executed, and the second are the operands or the parameters of the command.

  35. Javascript Advanced Interview Questions

  36. Question 21. What Are Memory Segments?

    Answer :

    A segmented memory model divides the system memory into groups of independent segments referenced by pointers located in the segment registers. Each segment is used to contain a specific type of data. One segment is used to contain instruction codes, another segment stores the data elements, and a third segment keeps the program stack.

    In the light of the above discussion, we can specify various memory segments as −

    • Data segment − It is represented by .data section and the .bss. The .data section is used to declare the memory region, where data elements are stored for the program. This section cannot be expanded after the data elements are declared, and it remains static throughout the program.
      The .bss section is also a static memory section that contains buffers for data to be declared later in the program. This buffer memory is zero-filled.
    • Code segment − It is represented by .text section. This defines an area in memory that stores the instruction codes. This is also a fixed area.
    • Stack − This segment contains data values passed to functions and procedures within the program.
  37. Question 22. What Are The Processor Registers?

    Answer :

    There are ten 32-bit and six 16-bit processor registers in IA-32 architecture. The registers are grouped into three categories −

    • General registers,
    • Control registers, and
    • Segment registers.

    The general registers are further divided into the following groups −

    • Data registers,
    • Pointer registers, and
    • Index registers.
  38. Javascript Objects Tutorial

  39. Question 23. What Linux System Calls?

    Answer :

    You can make use of Linux system calls in your assembly programs. You need to take the following steps for using Linux system calls in your program −

    • Put the system call number in the EAX register.
    • Store the arguments to the system call in the registers EBX, ECX, etc.
    • Call the relevant interrupt (80h).
    • The result is usually returned in the EAX register.

    There are six registers that store the arguments of the system call used. These are the EBX, ECX, EDX, ESI, EDI, and EBP. These registers take the consecutive arguments, starting with the EBX register. If there are more than six arguments, then the memory location of the first argument is stored in the EBX register.

    Most assembly language instructions require operands to be processed. An operand address provides the location, where the data to be processed is stored. Some instructions do not require an operand, whereas some other instructions may require one, two, or three operands.

    When an instruction requires two operands, the first operand is generally the destination, which contains data in a register or memory location and the second operand is the source. Source contains either the data to be delivered (immediate addressing) or the address (in register or memory) of the data. Generally, the source data remains unaltered after the operation.

  40. JavaMail API Interview Questions

  41. Question 24. What Are The Basic Modes Of Addressing ?

    Answer :

    The three basic modes of addressing are −

    1. Register addressing
    2. Immediate addressing
    3. Memory addressing

    Register Addressing

    In this addressing mode, a register contains the operand. Depending upon the instruction, the register may be the first operand, the second operand or both.

    For example,

    MOV DX, TAX_RATE ; Register in first operand
    MOV COUNT, CX  ; Register in second operand
    MOV EAX, EBX  ; Both the operands are in registers

    As processing data between registers does not involve memory, it provides fastest processing of data.

    Immediate Addressing

    An immediate operand has a constant value or an expression. When an instruction with two operands uses immediate addressing, the first operand may be a register or memory location, and the second operand is an immediate constant. The first operand defines the length of the data.

    For example,

    BYTE_VALUE  DB  150 ; A byte value is defined
    WORD_VALUE  DW  300 ; A word value is defined
    ADD  BYTE_VALUE, 65 ; An immediate operand 65 is added
    MOV AX, 45H; Immediate constant 45H is transferred to AX

    Direct Memory Addressing

    When operands are specified in memory addressing mode, direct access to main memory, usually to the data segment, is required. This way of addressing results in slower processing of data. To locate the exact location of data in memory, we need the segment start address, which is typically found in the DS register and an offset value. This offset value is also called effective address.

    In direct addressing mode, the offset value is specified directly as part of the instruction, usually indicated by the variable name. The assembler calculates the offset value and maintains a symbol table, which stores the offset values of all the variables used in the program.

    In direct memory addressing, one of the operands refers to a memory location and the other operand references a register.

  42. Core Java Interview Questions

  43. Question 25. What Is The Equ Directive?

    Answer :

    The EQU directive is used for defining constants. The syntax of the EQU directive is as follows −

    CONSTANT_NAME EQU expression

    For example: TOTAL_STUDENTS equ 50

    You can then use this constant value in your code, like −

    mov  ecx,  TOTAL_STUDENTS 
    cmp  eax,  TOTAL_STUDENTS

    The operand of an EQU statement can be an expression −

    LENGTH equ 20
    WIDTH  equ 10
    AREA   equ length * width

    Above code segment would define AREA as 200.

  44. Javascript Advanced Tutorial

HTML, GWT, Java Interview Questions & Answers

  1. Question 1. What Is Html?

    Answer :

    HTML is short for HyperText Markup Language, and is the language of the World Wide Web. It is the standard text formatting language used for creating and displaying pages on the Web. HTML documents are made up of two things: the content and the tags that formats it for proper display on pages.

  2. Question 2. What Are Tags?

    Answer :

    Content is placed in between HTML tags in order to properly format it. It makes use of the less than symbol (<) and the greater than symbol (>). A slash symbol is also used as a closing tag. For example:
    sample

  3. XML Interview Questions

  4. Question 3. Do All Html Tags Come In Pair?

    Answer :

    No, there are single HTML tags that does not need a closing tag. Examples are the  tag and tags.

  5. Question 4. How Do You Insert A Comment In Html?

    Answer :

    Comments in html begins with “
    ”.
    For example:

  6. XML Tutorial

  7. Question 5. Do All Character Entities Display Properly On All Systems?

    Answer :

    No, there are some character entities that cannot be displayed when the operating system that the browser is running on does not support the characters. When that happens, these characters are displayed as boxes.

  8. HTML 4 Interview Questions

  9. Question 6. What Is The Purpose Of Canvas In Html?

    Answer :

    Canvas is an element that is used for the graphics for the web page. It uses JavaScript to bring the graphics functionality live. It allows easy way to draw the graphics and use different types of tools to create drawing on the web page. Canvas is just a rectangular area that controls the pixel of every element that is used in the web page. Canvas uses methods like paths, circles, etc.
    The canvas element will be used as follows:

    The canvas element includes id, width and height settings and with the javascript it gets used like:

  10. Question 7. What Is The Purpose Of Iframe In Html?

    Answer :

    Iframe is called as inline frame that places one HTML document in a frame. It is different from the object element as the inline frame can be made in the target frame. The target frame consists of the links that is defined by other elements used in the web page. Iframe is used to focus on printing or viewing of the source. Iframe can be used by the user in those browser that supports it. If they have used iframe also then the incompatible browser won’t display the actual but display of the alternative text will take place.
    Syntax:

  11. HTML 4 Tutorial
    HTML Interview Questions

  12. Question 8. What Is The Main Function Of “pre” Tag In Html?

    Answer :

    “pre” tag defines the pre-formatted text that is used to display the text with the fixed width and uses a predefined fonts and it keeps both spaces and line breaks separate and show the text as it is.
    The code that can be used to display the text that can be written in whatever way the user wants is as follows:


    Text in a pre element ----//
    is displayed in a fixed-width
    font, and it preserves
    both spaces and
    line breaks

  13. Question 9. How Can Tables Be Made Nested In Html?

    Answer :

    Tables can be made nested by making it come in another table. This consists of many attributes and tags that can be used in nesting the tables.

       

         

         

    this is the first cellthis is the second cell
     

    this is the first cell second tablethis is the second cell of second table

  14. HTML 5 Interview Questions

  15. Question 10. How To Prevent The Display Of “getting Framed In Html?

    Answer :

    Getting framed refers to the document that is being displayed in someone else’s frameset in your HTML. This will be password protected and the permissions has to be taken before inserting the frameset. The framing of the document can be avoided by using TARGET=_top applied to all the links that will lead to the document that are outside the scope of a particular user without permission. A javaScript can be used that will automatically handle the request to remove the existing framesets. This can be given as:

  16. HTML Tutorial

  17. Question 11. How To Include A Frame Set Inside Another Frame Set?

    Answer :

    One frameset can be defined inside another frameset if the accessing permission are provided directly. The frameset can be stored by using the JavaScript in the document that is being written by the user and the script is as follows:

  18. HTML+XHTML Interview Questions

  19. Question 12. What Is Semantic Html?

    Answer :

    Semantic HTML is a coding style. It is the use of HTML markup to reinforce the semantics or meaning of the content. For example: In semantic HTML
     
    tag is not used for bold statement as well as
     
    tag is used for italic. Instead of these we use

    and
     
    tags.

  20. XML Interview Questions

  21. Question 13. What Is A Marquee?

    Answer :

    A marquee allows you to put a scrolling text in a web page. To do this, place whatever text you want to appear scrolling within the and tags.

  22. HTML 5 Tutorial

  23. Question 14. What Are Empty Elements?

    Answer :

    HTML elements with no content are called empty elements. For example:
    ,


     etc.

  24. Question 15. What Are The Different New Form Element Types In Html 5?

    Answer :

    Following is a list of 10 important new elements in HTML 5:

    1. Color
    2. Date
    3. Datetime-local
    4. Email
    5. Time
    6. Url
    7. Range
    8. Telephone
    9. Number
    10. Search
  25. HTML+Javascript Interview Questions

  26. Question 16. Is There Any Need To Change The Web Browsers To Support Html5?

    Answer :

    No. Almost all browsers (updated versions) support HTML 5. For example: Chrome, Firefox, Opera, Safari, IE etc.

  27. Java Tutorial

  28. Question 17. Which Video Formats Are Supported By Html5?

    Answer :

    HTML 5 supports three types of video format:

    • mp4
    • webm
    • ogg
  29. HTML DOM Interview Questions

  30. Question 18. What Is The Difference Between Progress And Meter Tag?

    Answer :

    The progress tag is used to represent the progress of the task only while the meter tag is used to measure data within a given range.

  31. HTML 4 Interview Questions

  32. Question 19. Why It Is Important To Set The Meta Information?

    Answer :

    Metadata is the data about the data or the information about the data. There is a tag that is being provided for the HTML document. This information won’t be displayed anywhere and will not be visible to the user. It will be parsable by the machine which will parse it according to the requirement. It consists of the elements that are related to the page description, keywords, document related element. The tag that is being used resides in the  section in HTML. The meta information is being used by the web browser or by the search engines to rank and let the user find the pages easily. 

  33. CSS Tutorial

  34. Question 20. Is There Any Way To Keep List Elements Straight In An Html File?

    Answer :

    By using indents, you can keep the list elements straight. If you indent each subnested list in further than the parent list that contains it, you can at a glance determine the various lists and the elements that it contains.

  35. Java Interview Questions

  36. Question 21. If You See A Web Address On A Magazine, To Which Web Page Does It Point?

    Answer :

    Every web page on the web can have a separate web address. Most of these addresses are relative to the top-most web page. The published web address that appears within magazines typically points this top-most page. From this top level page, you can access all other pages within the web site.

  37. Question 22. What Is The Use Of Using Alternative Text In Image Mapping?

    Answer :

    When you use image maps, it can easily become confusing and difficult to determine which hotspots corresponds with which links. Using alternative text lets you put a descriptive text on each hotspot link.

     

  38. XHTML Tutorial

  39. Question 23. Is It Possible To Set Specific Colours For Table Borders?

    Answer :

    You can specify a border colour using style sheets, but the colours for a table that does not use style sheets will be the same as the text colour.

  40. CSS Interview Questions

  41. Question 24. What Is The Use Of Span In Html And Give One Example?

    Answer :

    SPAN : Used for the following things:
    1. Highlight the any color text
    2. For adding colored text
    3. For adding background image to text.


    In this page we use span.

  42. HTML Interview Questions

  43. Question 25. What Is The Importance Of Doctype In Html?

    Answer :

    Doctype tag is not a HTML tag, it is just an instruction that is passed to the web browser to check for the information that is being provided by the markup language in which the page is written. Doctype is sometimes referred as Document type definition (DTD) that describes some rules that has to be followed while writing the markup language so to make the web browser understand the language and the content correctly. Doctype is very important to be placed in the beginning of the HTML and before the tag to allow easy rendering of the pages that are used.

  44. Question 26. What Do You Know About Java?

    Answer :

    Java is a high-level programming language originally developed by Sun Microsystems and released in 1995. Java runs on a variety of platforms, such as Windows, Mac OS, and the various versions of UNIX.

  45. Java Abstraction Interview Questions

  46. Question 27. What Are The Supported Platforms By Java Programming Language?

    Answer :

    Java runs on a variety of platforms, such as Windows, Mac OS, and the various versions of UNIX/Linux like HP-Unix, Sun Solaris, Redhat Linux, Ubuntu, CentOS, etc.

  47. HTML 5 Interview Questions

  48. Question 28. List Any Five Features Of Java?

    Answer :

    Some features include

    • Object Oriented
    • Platform Independent
    • Robust
    • Interpreted
    • Multi-threaded
  49. Question 29. Why Is Java Architectural Neutral?

    Answer :

    It’s compiler generates an architecture-neutral object file format, which makes the compiled code to be executable on many processors, with the presence of Java runtime system.

  50. Dynamic HTML Interview Questions

  51. Question 30. How Java Enabled High Performance?

    Answer :

    Java uses Just-In-Time compiler to enable high performance. Just-In-Time compiler is a program that turns Java bytecode, which is a program that contains instructions that must be interpreted into instructions that can be sent directly to the processor.

  52. Question 31. Why Java Is Considered Dynamic?

    Answer :

    It is designed to adapt to an evolving environment. Java programs can carry extensive amount of run-time information that can be used to verify and resolve accesses to objects on run-time.

  53. Question 32. List Two Java Ide’s?

    Answer :

    • Netbeans 
    • Eclipse
  54. XHTML Interview Questions

  55. Question 33. Variables Used In A Switch Statement Can Be Used With Which Datatypes?

    Answer :

    Variables used in a switch statement can only be a string, enum, byte, short, int, or char.

  56. HTML+XHTML Interview Questions

  57. Question 34. What Is Protected Access Modifier?

    Answer :

    Variables, methods and constructors which are declared protected in a superclass can be accessed only by the subclasses in other package or any class within the package of the protected members’ class.

  58. Question 35. What Do You Mean By Access Modifier?

    Answer :

    Java provides access modifiers to set access levels for classes, variables, methods and constructors. A member has package or default accessibility when no accessibility modifier is specified.

  59. Question 36. What Is A Static Variable?

    Answer :

    Class variables also known as static variables are declared with the static keyword in a class, but outside a method, constructor or a block.

  60. HTML+Javascript Interview Questions

  61. Question 37. When A Byte Datatype Is Used?

    Answer :

    This data type is used to save space in large arrays, mainly in place of integers, since a byte is four times smaller than an int.

  62. Question 38. What Is The Default Value Of Float And Double Datatype In Java?

    Answer :

    Default value of float and double datatype in different as compared to C/C++. For float its 0.0f and for double it’s 0.0d

  63. Question 39. What Is The Default Value Of Byte Datatype In Java?

    Answer :

    Default value of byte datatype is 0.

  64. Question 40. List The Three Steps For Creating An Object For A Class?

    Answer :

    An Object is first declared, then instantiated and then it is initialized.

  65. HTML DOM Interview Questions

  66. Question 41. What Do You Mean By Constructor?

    Answer :

    Constructor gets invoked when a new object is created. Every class has a constructor. If we do not explicitly write a constructor for a class the java compiler builds a default constructor for that class.

  67. Question 42. What Is Singleton Class?

    Answer :

    Singleton class control object creation, limiting the number to one but allowing the flexibility to create more objects if the situation changes.

  68. Java Interview Questions

  69. Question 43. What Is A Class Variable?

    Answer :

    These are variables declared with in a class, outside any method, with the static keyword.

  70. Question 44. What Is A Instance Variable?

    Answer :

    Instance variables are variables within a class but outside any method. These variables are instantiated when the class is loaded.

  71. Question 45. What Is A Local Variable?

    Answer :

    Variables defined inside methods, constructors or blocks are called local variables. The variable will be declared and initialized within the method and it will be destroyed when the method has completed.

  72. Question 46. Define Class?

    Answer :

    A class is a blue print from which individual objects are created. A class can contain fields and methods to describe the behavior of an object.

     

  73. Question 47. What Do You Mean By Object?

    Answer :

    Object is a runtime entity and it’s state is stored in fields and behavior is shown via methods. Methods operate on an object’s internal state and serve as the primary mechanism for object-to-object communication.

  74. Question 48. What Is Finalize() Method?

    Answer :

    It is possible to define a method that will be called just before an object’s final destruction by the garbage collector. This method is called finalize( ), and it can be used to ensure that an object terminates cleanly.

  75. Question 49. Which Package Is Used For Pattern Matching With Regular Expressions?

    Answer :

    java.util.regex package

  76. Question 50. What Is The Difference Between Stringbuffer And Stringbuilder Class?

    Answer :

    Use StringBuilder whenever possible because it is faster than StringBuffer. But, if thread safety is necessary then use StringBuffer objects.

  77. Question 51. Why Is Stringbuffer Called Mutable?

    Answer :

    The String class is considered as immutable, so that once it is created a String object cannot be changed. If there is a necessity to make alot of modifications to Strings of characters then StringBuffer should be used.

  78. Question 52. How Can We Run Gwt Application?

    Answer :

    Two ways of running the application:
    1) Create a war file and deploy in any app server or
    2) Run ant hosted in the command prompt. And click on the ‘Launch Default Browser’.

  79. Question 53. Can We Set Css Style In Gwt Java Code?

    Answer :

    The look and feel of a GWT application can be customized via CSS files. Each widget in GWT can be given a HTML “div” container and can therefore be individually styled by CSS. You use the Java method setStyle(String s) for this.

  80. Question 54. What Are Modules, Entry Points And Html Pages In Gwt?

    Answer :

    GWT applications are described as modules. A module “modulename” is described by a configuration file “modulename.gwt.xml”. Each module can define one or more Entry point classes.
    An entry point is the starting point for a GWT application, similar to the main method in a standard Java program. A Java class which is an entry point must implement the interface “com.google.gwt.core.client.EntryPoint” which defines the method onModuleLoad(). 
    The module is connected to a HTML page, which is called “host page”. The code for a GWT web application executes within this HTML document. 
    The HTML page can define “div” containers to which the GWT application can assign UI components or the GWT UI components are simply assigned to the body tag of the HTML page.

     

  81. Question 55. How Many Modes Are Provided By Gwt To Execute Application?

    Answer :

    There are two modes: Development mode and Web mode.
    Development Mode: allows to debug the Java code of your application directly via the standard Java debugger. 
    Web mode: the application is translated into HTML and Javascript code and can be deployed to a webserver.

  82. Question 56. How Can You Set Browser Targeted Compilation In Gwt?

    Answer :

    •To reduce the compilation time, choose favorite browser and add the user.agent property in the module configuration file.
    Values: ie6,ie8,gecko1_8,safari,opera
    module.gwt.xml:



     

  83. Question 57. How To Compile The Gwt Application?

    Answer :

    Run ant build in the root folder of the application. By default gwt compiler creates optimized JS files for some browsers. 
    : Disadvantage is it takes a lot of time to compile each change because of the permutations 
    Steps:
    1) Open command prompt
    2) Go to the application root folder
    3) Run command as “ant build”
    Then you can see compile logs are coming. If you see BUILD SUCCESSFUL it means no error in your application. If BUILD FAILED it means there is an error in your application.

  84. Question 58. How To Create A Gwt Application?

    Answer :

    •Create a folder for the application (e.g. withoutbook)
    •Run webAppCreator in the newly created folder
    –webAppCreator takes a module name (here ‘withoutbook’ is the module name with a package prefix)

  85. Question 59. What Is Gwt Rpc?

    Answer :

    • RPC, Remote Procedure Call is the mechansim used by GWT in which client code can directly executes the server side methods.
    • GWT RPC is servlet based.
    • GWT RPC is asynchronous and client is never blocked during communication.
    • Using GWT RPC Java objects can be sent directly between the client and the server (which are automatically serialized by the GWT framework).
    • Server-side servlet is termed as service.
    • Remote procedure call that is calling methods of server side servlets from client side code is referred to as invoking a service.
  86. Question 60. What Are The Core Components Of Gwt Rpc?

    Answer :

    Following are the three components used in GWT RPC communication mechanism:

    • A remote service (server-side servlet) that runs on the server.
    • Client code to invoke that service.
    • Java data objects which will be passed between client and server.
    • GWT client and server both serialize and deserialize data automatically so developers are not required to serialize/deserialize objects and data objects can travel over HTTP.

     

  87. Question 61. Which Interface A Java Data Object Should Implement So That It Can Be Transferred Over The Wire In Gwt Rpc?

    Answer :

    A java data object should implement isSerializable interface so that it can be transferred over the wire in GWT RPC.

  88. Question 62. What Is Internationalization?

    Answer :

    Internationalization is a way to show locale specific information on a website. For example, display content of a website in English language in United States and in Danish in France.

  89. Question 63. What Are The Ways Using Which You Can Internationalize A Gwt Application?

    Answer :

    GWT provides three ways to internationalize a GWT application −

    1. Static String Internationalization.
    2. Dynamic String Internationalization.
    3. Localizable Interface.
  90. Question 64. What Is Static String Internationalization Technique In Gwt?

    Answer :

    This technique is most prevalent and requires very little overhead at runtime; is a very efficient technique for translating both constant and parameterized strings;simplest to implement. Static string internationalization uses standard Java properties files to store translated strings and parameterized messages, and strongly-typed Java interfaces are created to retrieve their values.

  91. Question 65. What Is Dynamic String Internationalization Technique In Gwt?

    Answer :

    This technique is very flexible but slower than static string internationalization. Host page contains the localized strings therefore, applications are not required to be recompiled when we add a new locale. If GWT application is to be integrated with an existing server-side localization system, then this technique is to be used.

  92. Question 66. What Is Localizable Interface Internationalization Technique In Gwt?

    Answer :

    This technique is the most powerful among the three techniques. Implementing Localizable allows us to create localized versions of custom types. It’s an advanced internationalization technique.

  93. Question 67. Which Tag Of *.gwt.xml Is Used To Support Internationalization In Gwt Application?

    Answer :

    extend-property tag with attribute name set as locale and values as language specific locale, say de for german locale.

     

  94. Question 68. What Is Simpleremoteloghandler In Gwt?

    Answer :

    This handler sends log messages to the server, where they will be logged using the server side logging mechanism.

  95. Question 69. What Is Popuploghandler In Gwt?

    Answer :

    PopupLogHandler logs to the popup which resides in the upper left hand corner of application when this handler is enabled.

     

  96. Question 70. What Is Firebugloghandler In Gwt?

    Answer :

    FirebugLogHandler logs to Firebug console.

  97. Question 71. What Is Consoleloghandler In Gwt?

    Answer :

    ConsoleLogHandler logs to the javascript console, which is used by Firebug Lite (for IE), Safari and Chrome.

  98. Question 72. What Is Developmentmodeloghandler In Gwt?

    Answer :

    DevelopmentModeLogHandler logs by calling method GWT.log. These messages can only be seen in Development Mode in the DevMode window.

     

  99. Question 73. What Is Systemloghandler In Gwt?

    Answer :

    SystemLogHandler logs to stdout and these messages can only be seen in Development Mode in the DevMode window.

  100. Question 74. How Can You Create A Custom Gwt Widget?

    Answer :

    GWT provides three ways to create custom user interface elements. There are three general strategies to follow −

    • Create a widget by extending Composite Class − This is the most common and easiest way to create custom widgets. Here you can use existing widgets to create composite view with custom properties.
    • Create a widget using GWT DOM API in JAVA − GWT basic widgets are created in this way. Still its a very complicated way to create custom widget and should be used cautiously.
    • Use JavaScript and wrap it in a widget using JSNI − This should generally only be done as a last resort. Considering the cross-browser implications of the native methods, it becomes very complicated and also becomes more difficult to debug.
  101. Question 75. What Is Gwt Uibinder?

    Answer :

    • The UiBinder is a framework designed to separate Functionality and View of User Interface.
    • The UiBinder framework allows developers to build gwt applications as HTML pages with GWT widgets configured throughout them.
    • The UiBinder framework makes easier collaboration with UI designers who are more comfortable with XML, HTML and CSS than Java source code.
    • The UIBinder provides a declarative way of defining User Interface.
    • The UIBinder seperates the programmic logic from UI.
    • The UIBinder is similar to what JSP is to Servlets.