GATE Exam » GATE MCQs » MCQs on Java

MCQs on Java

Java is a general purpose programming language that is high-level and also an object oriented programming language that is mainly designed to have as few implementation dependencies as possible.

One of the top developing platforms for an organization’s choice that looks forward in tackling today’s business needs is none other than Java. It is mainly used for building a wide range of applications for a wide variety of platforms. Day to day uses of Java could be in- cell phones, desktops, servers, blu-ray players, web browsers and also in televisions. C and C++ a few similar syntaxes of Java . However, its facilities are fewer and lower in quality in either of them. It was however developed by the Oracle Corporation. James Gosling further designed it at Sun Microsystems. It first appeared 26 years ago on 23 May, 1995. Its typing discipline could be defined as strong, safe, manifest, nominative, etc. 

The latest version is Java 18 as of March 2022. Its long term support versions are as follows- Java 17, 11 and 8. The one used for commercial use is Java 8 LTS that was released in January 2019. For one’s individual use, however, Java 8 provided with public updates is being supported. Four editions of Java are being supported that have been defined by Sun with different targeting application environments. The different platforms are- Java Platform, Micro Edition (Java ME) with limited resources, Java SE (Standard Edition) for workstation environments, etc. The extension for code files of Java is .java. Any files in particular to Java will show up this code or extension.  To store a path to the installation of Java, JAVA_HOME is used. Pointers on the other hand are not a feature of Java. Some features of Java programming are as follows- Architectural neutral, robust, secure, etc. Keyword though cannot be used as a variable for Java. These are special reserved words that we cannot use to name a user-defined variable. Lastly, Truncation in Java is the floating point value assigned to a floating type. Hence, Java is a platform independent language that is mainly designed to have as a few implementation dependencies as possible. 

Multiple Choice Questions (MCQ’s)

  • In Java, what is the number of primitive data types?
  • 4
  • 6
  • 8

    Answer- There are eight fundamental data types: int type, char type, boolean type, byte type, long type, float type, short type, and double type.

  • Float and Double sizes in Java are?
  • 32 and 32
  • 32 and 64
  • 64 and 64

Answer – The size is 32 and 64.

  • In which case is the automatic type conversion possible?
  • Int to long
  • Long to Int
  • Byte to Int

    Answer- It is possible in Int to long.

  • Which one is the syntax of Java?
  • C++
  • C
  • All of the above

   Answer- Both C and C++ are used as syntax in Java.

  • Who developed Java?
  • Gennady Korotkevich
  • John Carmack
  • Oracle Corporation 

    Answer- Java was developed by Oracle Corporation. 

  • Who designed Java?
  • James Gosling
  • Linus Torvalds
  • Alan Turing

    Answer- James Gosling designed it.

  • How many years back Java appeared?
  • 10
  • 18
  • 26

 Answer- 26 years ago, Java first appeared. 

  • Which is the first year when Java came into view?
  •  23 May, 1995
  •    9 April, 2001
  •  13 August, 2007

Answer- Java first came into view in the year 1995 in 23 May.

  • Choose one of its typing disciplines. 
  • Strong
  • Weak
  • Intermediate 

 Answer- Strong could be defined as one of its typing disciplines.

  • Which is the latest version of Java?
  • Java 17
  • Java 11
  • Java 18

  Answer- The latest version of Java is Java 18.

  •  The long-term support versions of Java- 
  • Java 18
  • Java 17
  • Java 8 LTS

 Answer- Java 17 is the long-term support version of Java.

  • Which version of Java is used for commercial use?
  • Java 11
  • Java 17
  • Java 8 LTS

Answer- Java 8 LTS that had been released in January 2019 is used for commercial purpose.

  • How many Editions of Java are being supported?
  • Three 
  • Two
  • Four

 Answer- Four editions of Java are being supported. 

  • Which platform of Java is being used as limited resources?
  • Java ME
  • Java SE
  • Java 11

Answer-  Java ME is being used as limited resources. 

  • Which statement is true for Java?
  • It is a code dependent programming language 
  • It is a platform dependent programming language 
  • It is a platform independent programming language 

 Answer- Java is a platform independent language that is mainly designed to have as few implementation dependencies as possible.

  • Mention the one which is not a feature of Java.
  • Use of pointers
  • Portable
  • Object oriented

 Answer- pointers is not a feature of Java. Some features of Java programming are- Architectural neutral, Robust, Secure, etc.

  • A variable name that cannot be used for Java.
  • Keyword 
  • Identifier and Keyword 
  • None of the above

 Answer-  Keyword cannot be used as a variable for Java. These are special reserved words that we cannot use to name a user-defined variable. 

  • The extension of Java code file is?
  • .txt
  • .js
  • .java

 Answer- .java is the file extension code of Java.

  • The environment variable used to set the java path is?
  • JAVA_HOME
  • MAVEN_Path
  • JAVA

 Answer- To store a path to the installation of Java, JAVA_HOME is used.

  • Truncation in Java is?
  • Integer Value assigned to Floating type
  • Floating point value assigned to an integer type
  • Floating point value assigned to a Floating type

  Answer- Floating point value assigned to a Floating type.