basicJavamcqRandom

Java Classes and Objects Interview MCQ Questions and Answers 1 | MCQ Questions and Answers on Java Classes and Objects

blog.softwaretechit.com
home.softwaretechit.com

Study and learn Interview MCQ Questions and Answers on Java Classes and Objects. Attend job interviews easily with these Multiple Choice Questions. You can print these Questions in default mode to conduct exams directly. You can download these MCQs in PDF format by Choosing Print Option first and Save as PDF option next using any Web Browser.

Go through Java Theory Notes Classes and Java Theory Notes on Objects before reading these objective questions.

1) Java is a ___ programming language.

A) Functional

B) Object-Oriented

C) Theoretical

D) All the above

Answer [=]

B

Explanation:

Everything in Java is implemented using Object-Oriented principles.

2) In Java programming language, the code is placed inside ___.

A) Classes, Interfaces

B) Methods

C) Blocks

D) All the above

Answer [=]

D

3) Properties are implemented using ___ in Java.

A) Methods

B) Variables

C) Interfaces

D) All the above

Answer [=]

B

4) A Class in Java is like a ____.

A) Prototype

B) Instruction Sheet

C) Blueprint

D) All the above

Answer [=]

D

5) Which is the file extension used for a public Java class source code?

A) .j

B) .class

C) .java

D) None

Answer [=]

C

6) Which is the file extension used for a compiled Java class file?

A) .j

B) .java

C) .class

D) .cls

Answer [=]

C

7) State TRUE or FALSE. The source-code of An Abstract-Class or Interface is kept inside a .java file.

A) FALSE

B) TRUE

C) –

D) –

Answer [=]

B



8) After compilation, an Interface or Abstract-Class is kept in a ___ file in Java programming.

A) .java

B) .cls

C) .class

D) .interface

Answer [=]

C

Explanation:

All compiled Java classes, interfaces and abstract classes are kept in a .class file only. All source files are kept in .java files.

9) State TRUE or FALSE. In Java, a public class or abstract-class or interface must be kept in a separate .java file.

A) FALSE

B) TRUE

C) –

D) –

Answer [=]

B

10) In a .java file, how many numbers of public types namely class, interface or abstract can be managed?

A) 1

B) 2

C) 3

D) Any number

Answer [=]

A

Explanation:

Only one public type is allowed per .java file.

11) In Java, the keyword used to declare a class is ___.

A) Class

B) Java

C) class

D) java

Answer [=]

C

12) A Java class can contain___.

A) Variables

B) Methods, Constructors

C) Inner Classes (A class inside another class)

D) All the above

Answer [=]

D

13) How many maximum numbers of objects can be created from a single Class in Java?

A) 32

B) 64

C) 256

D) None

Answer [=]

D

Explanation:

There is no limit on the number of objects being created from a class.

14) Creating an object from a class is also called ____.

A) Initializing

B) Instantiating

C) Interfacing

D) None of the above

Answer [=]

B



15) The keyword used to create a new object in Java is ___.

A) class

B) java

C) new

D) create

Answer [=]

C

16) Choose the correct statements about choosing a name for a class in Java.

A) The class name can start with only a letter or underscore or dollar sign.

B) The class name can contain numbers

C) The class name can not start with a number

D) All the above

Answer [=]

D

Explanation:

These are also called Java naming rules.

17) An object is created at __ time in Java.

A) Compile-time

B) Run time

C) Assembling time

D) None of the above

Answer [=]

B

18) Choose the correct statement about Java main method.

A) The main method is not a required method

B) The main method must be declared public static void.

C) you can define program flow using the main method. The Java virtual machine calls the main method directly.

D) All the above

Answer [=]

D

Explanation:

Java compiler does not complain about a missing main method.

19) Choose the correct syntax for declaring a Java class below.

A)

class CLASSNAME

{

 

}

B)

CLASSNAME class

{

 

}

C)

class CLASSNAME;

{

 

}

D)

Class CLASSNAME

{

 

}

Answer [=]

A

Explanation:

Use the keyword class but not Class.

20) Choose the correct way of creating an object of the below class.

class Table

{

  Table(){System.out.println(“Table Created”);}

}

A)

Table t = new Table;

B)

Table t = new Table();

C)

Table() t = new Table();

D) None of the above

Answer [=]

B

 

Leave a Reply

10 Best Artificial Intelligence Software|artificial intelligence tools 5 nft games to earn money | Best NFT games for earn crypto Earn Money From Minting NFTs| How to mint NFT for free Top 10 Things You Need To Know About Python List | python lists functions 10 Popular PHP frameworks for web developers| best php frameworks 12 Tips On How To Become a Python Developer | python For beginner 12 Best Nodejs Frameworks for App Development in 2022 how to create google web stories, Steps to create web stories Top 10 Features in Angular 13 Every Developer Should Know | Angular 13 Features 10 Best Angular UI Libraries | angular ui components | angular Project 10 Best Web Development Frameworks in 2022 Frontend & Backend 18 Best Open-Source and Free Database Software | best database software for beginners Top 10+ Best Java IDEs & Online Java Compilers | best java ide for beginners top 10 besic to andvance java books |java books for beginer Top 5 Themes For Blogger, professional blogger theme download BEST Python Courses Online,Top 10 Courses to Learn Python in 2022 Top 13 python libraries for data science