Core Java MCQs

 1) Java is an object-oriented programming language developed by __________.

A) Motorola B) apple C) IBM D) Sun Microsystems

Correct Ans: Sun Microsystems


2) ______________ is a program’s capability of moving easily from one computer system to another.

A) Platform-independence B) Object oriented C) robustness D) flexibility

Correct Ans: Platform-independence


3) A _________ is a template for multiple objects with similar features. 

A) program B) class C) object D) file

Correct Ans: class


4) An ____________ of a class is another word for an actual object.

A) instance B) file C) code D) program

Correct Ans: instance


5) ____________ are functions defined inside classes that operate on instances of classes.

A) instance variable B) class variable C) class D) Methods

Correct Ans: Methods 


6) _____________ inherit all the methods and variables from their superclasses.

A) parent classes B) subclass C) single class D) root

Correct Ans: subclass


7) ___________ a method is creating a method in a subclass that has the same signature as a method in a superclass.

A) Overriding B) recursive C) constructor D) None of these

Correct Ans: Overriding


8) An _________ is a collection of method names, without actual definitions.

A) inheritance B) package C) interface D) class

Correct Ans: interface


9) __________ in Java are a way of grouping together related classes and interfaces. 

A) inheritance B) package C) interface D) class

Correct Ans: package


10) __________ are locations in memory in which values can be stored. 

A) tokens B) keywords C) Variables D) data types

Correct Ans: Variables


11) _________ variables are declared and used inside method definitions.

A) Local B) Global C) instance D) keywords

Correct Ans: Local


12) __________ are used to indicate simple values in your Java programs.

A) tokens B) keywords C) Variables D) Literals

Correct Ans: Literals


13) __________ are statements that return a value.

A) operators B) Expressions C) operands D) algorithm

Correct Ans: Expressions


14) _____________ are special methods for creating and initializing new instances of classes.

A) interfaces B)packages C) Constructors D) functions

Correct Ans: Constructors


15) ___________ is a mechanism of converting the value of an object or primitive type into another type.

A) Casting B) inheritance C)interface D) expressions

Correct Ans: Casting 


16) __________  Classes to implement a graphical user interface, including classes for Window, Menu, Button, Font, CheckBox, and so on.

A) java.net B) java.awt C) java.io D) java.lang

Correct Ans: java.awt


17) The ____________, as in C, repeats a statement or block of statements some number of times until a condition is matched.

A) for loop B) if statement C) switch D) nested if

Correct Ans: for loop


18) A ________________ is a variable whose value never change.

A) local variable B) instance variable C) constant variable D) global variable

Correct Ans: Constant variable


19)  To refer to the current object in these cases, you can use the ___________ keyword.

A) super B) abstract C) this D) new

Correct Ans: this 


20) ________ is how an applet actually draws something on the screen, be it text, a line, a colored  background, or an image.

A) initialization B) Painting C) starting  D) Destroying

Correct Ans: Painting 

Comments