Sunday, January 17, 2021

Top 30 Eclipse Interview Questions And Answers

 Q #1) What is an Eclipse IDE?

Answer: Eclipse IDE is the most widely used Java development environment. It is also used to develop applications in other programming languages like Python, C#, C++, etc.

Q #2) What are the system requirements for Eclipse IDE to run successfully on our computer system?

Answer:  A system must have the latest version of the Java run time properly installed, for Eclipse IDE to run successfully in it. You can install either ‘JRE’ or ‘JDK’ depending on the task you need to perform with Eclipse IDE.

To check if our system has a Java runtime environment installed in it or not-

Use command prompt and type in the command ”Java -version’. Please refer the below figure:

Checking Java Version

(Please note that: I have installed Java JDK file on my system).

Q #3) What is the latest version of Eclipse IDE that is released?

Answer: Eclipse oxygen 64-bit is the latest version of Eclipse IDE. It was released on 28 June 2017.

Q #4) Name different versions of Eclipse IDE?

Answer:

Eclipse Version NameVersion Number
Oxygen4.7
Neon4.6
Mars4.5
Luna4.4
Kepler4.3
Juno3.8 and 4.2
Indigo3.7
Helios3.6

Q #5) What are the types of files likely to be found in the ‘src’ and ‘bin’ folder, of your java project developed using Eclipse IDE?

Answer: If you have developed a Java project using Eclipse IDE and added codes to meet the project requirements, then you can find ‘.java’ files in the ‘src’ folder and corresponding ‘.class’ files in the ‘bin’ folder. (When we run a Java Project; ‘.java’ files are compiled to ‘.class’ files).

Q #6) What are the Operating Systems that support Eclipse IDE?

Answer: Eclipse IDE is a cross-platform, hence it can be successfully installed and used as a development environment in almost all the operating systems like Windows, Mac, Linux, Solaris, etc.

Q #7) How to create the documentation of a project using Eclipse IDE?

Answer: If we need to generate documentation for a project using Eclipse IDE, select ‘Project’ in a menu item and then select ‘Generate Javadoc’.

Then, we need to add a library (javac.jar) file to the project and specify a location in the system to save the document generated.

Generate documentation for project:

public class FirstClass{
/* Here is the statements in documentation*/
int user_name;
int user_emailID;
public int getUser_name(){
return user_name;
}
public void setUser_name(int user_name){
this.user_name=user_name;
}
public  int getUser_emailID(){
return user_emailID(){
}
public void setUser_emailID(int user_emailID){
this.user_emailID=user_emailID;
}
}

Generate JavaDoc

After generating the documentation of the project, you will get a new folder in the project explorer named as ‘doc’. Open ‘index.HTML’ within the ‘doc’ folder and there we can find the project documentation. Please refer the below figure:

Final Documentation Project

Q #8) Why is it always better to ‘Close’ a Project in Eclipse IDE than leave it ‘Open’ in the Package Explorer?

Answer: In an Eclipse IDE, we can have a number of projects in the ‘Package Explorer’. Those projects can be either in ‘Open’ or ‘Closed’ state.

An ‘Open’ project will consume a lot of memory. Also ‘Open’ projects take up build time especially when we try to ‘Clean’ the projects in the workspace. So, it is always better to ‘Close’ a project.

Q #9) If you need to ‘Reset’ a particular perspective in Eclipse IDE, how will you attain it?

Answer: The common name given to the default arrangement of views and editor area in the development environment is called a ‘perspective’ in Eclipse IDE.

 To ‘Reset’ a particular perspective in Eclipse IDE:

  • Select the ‘perspective’ icon as displayed in the image below. It is usually shown on the top right corner of Eclipse IDE.
  • Right-click on the icon.
  • Select the ‘Reset’, thus we can reset the views in perspective.

Reset Button

‘Reset’ action will put all the windows back in a position where they are supposed to be, by default.

Q #10) Explain how to add a jar file to the project build path in Eclipse IDE?

AnswerFor adding a utility ‘jar’ file to the project created in Eclipse IDE, refer below steps:

  • Select the ‘project’.
  • Right-click the project.
  • Select ‘properties’.
  • Select ‘Java build path’.
  • Select the ‘libraries’ tab.
  • Select ‘add external jar file’.
  • Find the location of the ‘jar’ file in your system and add the same to the project.

After this, we can use the functionalities and features related to the jar file in the project.

Java Build Path

Q #11) What are the tasks that you can accomplish with Eclipse IDE?

Answer: The tasks that can be accomplished are stated below:

  • We can create a generic project using Eclipse IDE. A generic project is a set of guidelines, tricks, rules, tasks, and tips that help you to create the product and market your product, in a faster and efficient way.
  • Edit files in the generic text editor.
  • Share files using CVS (Concurrent Version System) server.

Q #12) What is the Eclipse IDE Modelling framework?

Answer: While creating a project using some IDE we may add ‘class’ files, create a model for the project and create an XML schema for the same. If we have a better modeling framework, we need to create only one of these entities and the rest of them will get created along. This is done by EMF (Eclipse Modelling Framework).

So, EMF is a set of Eclipse plug-ins, which can be used to model a data model and to generate code from it. This framework is a Java /XML framework.

Q #13) How to generate code automatically with the Eclipse IDE?

Answer: Consider an example where you have a class file and some attributes inside the class.

You need to generate ‘get’ methods and ‘set’ methods for the value of an attribute in the class. We can use the ‘Generate Getters and Setters’ feature of Eclipse. Eclipse IDE can automatically generate getters and setters methods for the attributes as shown in below image:

.Generate Code Automatically

Q #14) Explain about ‘Builders’ associated with the projects in Eclipse IDE?

Answer: Projects created in Eclipse IDE have zero or more ‘builders’ associated with it. A builder is responsible for compiling the source code and generating classes for the associated project.  A Java project is associated with a java builder.

To find the builders associated with a project:

  • Select the ‘Project’.
  • Right-click on the ‘Project’ in the Package Explorer.
  • Select ‘Properties’.
  • A window named ‘Properties for sample’ is shown, in the left-hand side tree check for ‘Builders’. Select it.

Builders

Q #15) What is the Rich Client Platform?

Answer: A minimal set of plugins that you need to build a rich client application is known as the Rich Client Platform.

Creating a sample application Eclipse IDE needs only two plugins like ‘org.eclipse.ui’ and ‘org.eclipse.core.runtime’.

Q #16) What is Workspace?

Answer: Workspace is the actual location of a project developed using Eclipse IDE. It contains source files, images and other artifacts like preference settings, plug-in, specific metadata, logs, etc.

To change the workspace location:

  1. Click ‘File’ in the menu bar.
  2. Select the ‘Switch Workspace’.
  3. Select a new location to create/open a new project.

Switch Workspace

Q #17) How to install a new plug-in and run it at the start of Eclipse IDE?

Answer: We can install third-party plug-ins in Eclipse IDE using ‘Help’ –> ‘Install Software’.

Install New Plug-in

Usually, a plug-in has two parts, a declarative part, and a code part. The declarative part is in a plugin.XML and is loaded when the platform starts running and is available regardless of whether a plug-in has started.

When the user starts coding, the plugins functionality is explicitly invoked by the user.

Q #18) How is Refactoring done in Eclipse IDE?

Answer: Re-factoring is the method of reconstructing the code without behavior changes. One of the examples of refactoring is ‘rename’ a class or a method. If you need to change the name of a class or method, you can right-click on your class and select ‘rename’ and then we can type in the desired name.

Eclipse IDE will make sure that the name is changed everywhere without any further effort.

Q #19) Where can we find the log file in Eclipse IDE?

Answer: When a problem is encountered, we will have the reports of them documented in the workspace log file. The location where the log file stored is in the workspace/.metadata/.log. In Eclipse IDE error log view will show all the captured errors.

In Eclipse IDE, error log is available under Windows -> Show view -> Error log.

Log File

Q #20) While a User is running the Eclipse IDE, the following error occurred? Error: “Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available in order to run eclipse”.

JRE error pop up

How to solve the issue?

Answer: If the issue is raised, we must verify whether we have added the Java location in ‘environment variables’ for the system properties correctly.

In order to verify if ‘environment variables’ has been added to System Property correctly, follow the below steps:

  • Select ‘My computer’.
  • Select ‘properties’.
  • Select ‘advance system settings’.
  • Select the ‘advance’ tab.
  • Select ‘environment variable’.
  • Click the ‘new’ button under the user variable and enter a variable name as ‘path’.
  • Copy the location of Java bin and paste it in the starting of the variable value and click ‘ok’.
  • After completing the process, run the Eclipse IDE.

Edit System Variable

Q #21) How to format the codes in Eclipse IDE?

Answer: Control+Shift+F is the shortcut for formatting statements. But if we want to format the entire project, use ‘autoformat’ functionality IDE.

Format the code

  • Select “Windows”.
  • Select “Preferences”.
  • Then type in “format “ as displayed in the above image.
  • Then search for “Java -Code Style –formatter”. Here, we will have a default format style. We can change it by edit option.

Indentation Screen

For Example, ‘braces’.

We can put ‘braces’ on the same line or the next line according to our convenience and the coding standards that are chosen. You can configure all types of formatting here. If you are working on a team project, you can export the preferences of format and share it with the other members of the team.

Q #22) What is Hot Code Replace?

Answer: ‘Hot Code Replace’ is a debugging technique, which means it is possible to alter the codes in Java files (if needed) while debugging the codes on a run-time workbench. For Eclipse IDE, restart is not required to accomplish the task.

The debugger will replace the code in the Virtual Machine while it is running.

Q #23) How can you run an eclipse IDE in a clean mode?

Answer: If you can install a new plugin or remove the unused plugins from Eclipse IDE, then it is recommended to run the development environment in a clean mode. The process will clear all the cached information and will not affect any workspace related data.

To run an eclipse IDE in clean mode there are two methods:

a) Start the IDE using the command line in cmd prompt ‘eclipse -clean’

Run IDE in clean mode

OR

b) Edit the eclipse.ini file by inserting the line ‘-clean’ as the first line in the file. Make sure to remove the same line from ini file, as it causes Eclipse to re-evaluate all of the plugins every time it starts up and increases the startup time.

Q #24) If Eclipse IDE throws an error, ‘Missing R.java file’, how can we solve the issue?

Answer: The R.java file is an auto-generated file that contains references to all the resources used in a project.

Possible fixes for the error is:

  • Make sure that in ‘Eclipse IDE ‘–in menu item ‘Project’ -> “Build automatically” is checked.
  • Then ‘Clean’ your project and ‘Build’ it again.
  • Make sure that there are no errors in your XML files.

 Q #25) Explain the Debug Configuration in Eclipse IDE?

Answer: Users can change the ‘Debug Configuration’ for a Java project created using Eclipse IDE.

To change the ‘Debug Configuration’:

  • Select the ‘Run’ menu item.
  • Select “Debug Configurations”.
  • Select the “Java Application” from the list on the left-hand side (if we need to create debug configuration for Java application) and click on the New button. A dialog box comes up.

Debug Configuration

Q #26) Describe few frequently used shortcuts that are used in Eclipse IDE.

Answer:

a) Press Ctrl + Shift + L, it will open a widget that shows all the shortcut keys.Shortcuts used in Eclipse IDE

b) In Java editor press Ctrl+ Space to see the list of suggested auto-completion available in Eclipse IDE.

List of Suggested Auto Completions

c) When the cursor is positioned inside the method argument in a class, then press Ctrl + Shift + Space in a keyboard to see a list of the suggested parameters.

List of Suggested Parameter

d) Type ‘/**’ and press Enter key. It will automatically be added to the commands that we can include in the Javadoc document.

Javadoc document

Q #27) What are the views of an Eclipse IDE Workbench?

Answer: The major visible parts of an Eclipse IDE are:

  • Views
  • Editors (all appear in one editor area)
  • Menu Bar
  • Toolbar

Q #28) Name the Menu items that are available on the Menu Bar of an Eclipse IDE.

Answer: Menu items shown on the Menu Bar of IDE depend on the installed plug-ins in the Eclipse IDE. Customization of the Menu items can also be done using the Customize Perspective dialog box to show the desired menu items.

Menu Bar of an Eclipse IDE

  • File menu
  • Edit menu
  • Source menu
  • Refactor menu
  • Diagram menu
  • Navigate menu
  • Search menu
  • Project menu
  • Run menu
  • Window menu
  • Help menu

Q #29) If you encounter the following error while launching the Eclipse IDE, What will you do to fix the Issue?

Error while launching the Eclipse IDE

Errors: “could not create a Java Virtual Machine. A fatal exception has occurred. The program will exit”. Explain?

Answer: Error you have encountered now is an ‘Exit’ error. To fix this issue, we need to add the ‘Virtual Machine Path’ in the ‘eclipse.ini’ file.

Virtual Machine Path

Open eclipse.ini file and make sure that you add the path before vmargs (as shown in the above figure). Save the eclipse.ini file and try to launch Eclipse IDE again.

Q #30) How can we know the details about plug-ins installed in Eclipse IDE?

Answer: Eclipse is considered to be an extensible IDE as we can install several plug-ins in the IDE which in turn makes it so popular for development purposes.

To know the details about the list of plug-ins installed in Eclipse IDE:

  • Select ‘Help’
  • Select ‘About Eclipse’

In the ‘About Eclipse’ Window, we can find all the “Installation Details” of it.

List of plug-ins installed

If we click on the ‘Installation Details’, we can see the details of all the plug-ins installed in IDE.

Eclipse Plugins

No comments:

Post a Comment

Get max value for identity column without a table scan

  You can use   IDENT_CURRENT   to look up the last identity value to be inserted, e.g. IDENT_CURRENT( 'MyTable' ) However, be caut...