Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
3 views

JAVA PROGRAMMING QUIZ QUESTIONS

The document contains a series of questions and answers related to Java programming concepts, including constructors, packages, inheritance, and keywords. It covers topics such as the definition of a default constructor, the use of the 'super' keyword, and the characteristics of Java as a programming language. Additionally, it addresses various Java features, variable naming conventions, and the structure of classes and objects.

Uploaded by

kondaiappaswamy
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

JAVA PROGRAMMING QUIZ QUESTIONS

The document contains a series of questions and answers related to Java programming concepts, including constructors, packages, inheritance, and keywords. It covers topics such as the definition of a default constructor, the use of the 'super' keyword, and the characteristics of Java as a programming language. Additionally, it addresses various Java features, variable naming conventions, and the structure of classes and objects.

Uploaded by

kondaiappaswamy
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

JAVA PROGRAMMING

Constructor without parameters is called _______constructor.

a) Default Constructor
b) Parameterized Constructor
c) Both a and b
d) None of the above

A package is a group of similar types of?

A) Interfaces
B) Classes
C) Sub-packages
D) All Mentioned above.

Which of the following is true?

a. Java uses only interpreter.


b. Java uses only compiler.
c. Java uses both interpreter and compiler.
d. None of the above.

Which of the following is a Class in Java?


a. int
b. String
c. short
d. double

Which of this keyword can be used in a sub class to call the constructor of super class?
a. super
b. this
c. extent
d. extends

The keyword final is used for


(a) Declaring Constants
(b) Not to override the methods
(c) Not to inherit the class
(d)All the above

Which inheritance in Java programming is not supported?

a. Multiple inheritance using classes.


b. Multiple inheritance using interfaces.
c. Multilevel inheritance.
d. Single inheritance.

_________ is a feature that allows one interface to be used for general class of
actions.

(a) Polymorphism
(b) Inheritance
(c) Encapsulation
(d) Abstraction

Which of the following is called when a method having the same name as that the name of the
class where it is defined?
a. abstract
b. this
c. constructor
d. final

Java file with extension ‘.class’ contains

a. Java source code


b. HTML tags
c. Java Byte code
d. A program file written in Java programming language

Which of the following cannot be used for a variable name in Java?


a. identifier
b. final
c. malloc
d. calloc
A platform is the hardware or software environment in which a program runs. Which of the
following is/are Java platform component(s)?

a. HTML
b. Java Virtual Machine
c. Java Application Programming Interface (API)
d. HotJava

Who invented Java Programming?


a) Guido van Rossum
b) James Gosling
c) Dennis Ritchie
d) Bjarne Stroustrup

Which component is used to compile, debug and execute the java programs?
a) JRE
b) JIT
c) JDK
d) JVM

Which of these cannot be used for a variable name in Java?


a) identifier & keyword
b) identifier
c) keyword
d) none of the mentioned

Which operator dynamically allocates memory for an object?


a) Super
b) return
c) Constructor
d) new

What is the extension of java code files?


a) .js
b) .txt
c) .class
d) .java

What is the extension of compiled java classes?


a) .txt
b) .js
c) .class
d) .java

Which of these keywords is used to define interfaces in Java?


a) intf
b) Intf
c) interface
d) Interface

Scanner class is present in ________ package

a) java.io
b) java.util
c) java.applet
d) java.lang

Which cannot be used for variable name?

a) Main
b) final
c) While
d) Try

Which of these keywords is used to define packages in Java?


a) pkg
b) Pkg
c) package
d) Package

Which of the following is the correct way of importing an entire package ‘pkg’?
a) import pkg.
b) Import pkg.
c) import pkg.*
d) Import pkg.*

Which of the following is not a Java features?

a) Dynamic
b) Architecture Neutral
c) Use of pointers
d) Object-oriented

A class can inherit the properties of another class using _______ keyword

a) extend
b) extends
c) extents
d) Extends

What is the process of defining a method in a subclass having same name & type signature as a
method in its superclass?
a) Method overloading
b) Method overriding
c) Method hiding
d) None of the mentioned

What is the process of defining two or more methods within same class that have same name but
different parameters declaration?
a) method overloading
b) method overriding
c) method hiding
d) none of the mentioned

What is the process of defining a method in terms of itself, that is a method that calls itself?
a) Polymorphism
b) Abstraction
c) Encapsulation
d) Recursion

The ____________can be defined as the concept of having more than one constructor with
different parameters so that every constructor can perform a different task.
Answer : Constructor Overloading

________ is an instance of a class.


Answer :Object

A _______ is a blueprint or prototype that defines the variables and methods common to all
objects of a certain kind.
Answer : Class

A _______defines the structure and behavior (data and code) that will be shared by a set of
objects.
Answer : Class

______ class is a class that cannot be instantiated by itself, it needs to be subclassed by another
class to use its properties.
Answer : abstract

A _______ in Java is a special method that is used to initialize objects.


Answer : Constructor

An _______ is defined as an abstract type used to specify the behavior of a class.

You might also like