Unit-I
1. How many keywords are there in Java and the key must start with______
A) 58 and capital letter
B) 68 and small letter
C)57 and capital letter
D) 48 and small letter
ANSWER: B
2. In Math.sqrt() ,Math is a ________
A) class
B) package
C)method
D) function
ANSWER: A
3. In which language array size is not declared a[ ]
A) c
B)c++
C)Python
D)Java
ANSWER: D
4. Which statement is true about Java?
A) Java is a sequence- dependent programming language
B) Java is a code dependent programming language
C) Java is a platform- dependent programming language
D) Java is a platform independent programming language
ANSWER: D
5. In switch case,case values should be _____ or ____
A) integer or character
B) float or double
C) integer and float
D) double & character
ANSWER: A
6. Which one of the following is not a Java feature?
A) Object-oriented
B) Use of pointers
C) Portable
D) Dynamic & Extensible
ANSWER: B
7. What are entry control loops?
A) while and do while
B) for and do while
C)do while
D) for and while
ANSWER: D
8. Which component is used to compile, debug and execute the java programs?
A)JRE
B)JIT
C)JDK
D)JVM
ANSWER: C
9. trim( ) method is use for
A) to remove spaces
B) to remove space in string
C) to remove spaces before and after string
D) to remove spaces in between string
ANSWER: C
10. Which one of the following is not an access modifier?
A) Protected
B) Void
C) Public
D) Private
ANSWER:B
11. String is a______
A)class
B)package
C)function
D)method
ANSWER:A
12. 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
ANSWER: D
13. Which of these operators is used to allocate memory to array variable in Java?
A)malloc
B)alloc
C)new
D)new malloc
ANSWER: C
14. How many types of user-defined Methods are there?
A)5
B)6
C)4
D)3
ANSWER: C
15. In Java, add a ___ to a constructor to convert it into a method.
A) if statement
B) static
C) return type
D) semicolon
ANSWER: C
16. Mutliple-inheritance uses _______
A)classes
B)methods
C)packages
D)interface
ANSWER: D
17. Which of this keyword must be used to inherit a class?
A) super
B) this
C) extent
D) extends
ANSWER: D
18. class is a collection of ____________.
A)instance variables and instance methods
B)instance variables
C)instance methods
D)variable and methods
ANSWER: A
19. Method overloading generates error when
A) method name same
B) no.of parameters are same
C) type of parameters and order of parameters are same
D) all the above
ANSWER: D
20. How Polymorphism is achieved in Java
A) Overloading and Overriding
B) Static Function
C) Final Class
D)None of these
ANSWER: A
Unit-1
1. -----------operators is used to allocate memory for an object?
Ans new
2. ----------- is the return type of a method that does not returns any value?
Ans void
3. -------------- is a method having same name as that of its class?
Ans constructor
4. -------------- is used by method to refer to the object that invoked it?
Ans this
5. ---------------is used to perform some action when the object is to be
destroyed?
Ans finalize()
6. --------------- is the process of defining a method that calls itself?
Ans Recursion
7. --------------- is used to access member of class before object of that class
is created?
Ans static
8. ------------- cannot be declared static?
Ans object
9. ------------- is used to obtain character at specified index?
Ans charAt()
10. --------------must be used to inherit a class?
Ans extends
Unit-II
1.Which of these can be used to fully abstract a class from its implementation?
A)Objects
B)Packages
C)Interfaces
D)None of the Mentioned
ANSWER: C
2.Which of these keywords is used by a class to use an interface defined
previously?
A)Import
B)import
C)implements
D)Implements
ANSWER: C
3.Which one is correct declaration for implementing two interfaces?
A)class C implements A,B
B)class C implements A, implements B
C)class C implements A extends B
D)None of the Mentioned
ANSWER: A
4.Which of this access specifies can be used for a class so that its members can be
accessed by a different class in the same package?
A)public
B)protected
C)No modifier
D)All of the Mentioned
ANSWER: D
5.Which of the following is correct way of importing an entire package ‘pkg’?
A)import pkg.
B)import pkg.
C)Import pkg.*
D)import pkg.*
ANSWER: D
6.Which of the following package stores all the standard java classes?
A)lang
B)util
C)awt
D)io
ANSWER: A
7.The first statement in java source file
A)import statement
B)package statement
C)main statement
D)try{}catch{}
ANSWER:B
8.Which of these class is not related to input and output stream in terms of
functioning?
A)File
B)InputStream
C)Reader
D)OutputStream
ANSWER: A
9.Which of these interface is not a member of java.io package
A)DataInput
B)ObjectInput
C)ObjectFilter
D)FileFilter
ANSWER: C
10.Which of these is a method to clear all the data present in output buffers?
A)clear()
B)fflush()
C)flush()
D)close()
ANSWER: C
11.___________ access specifiers can be used for an interface
A)private
B)Public
C)protected
D)void
ANSWER: B
12.The variable in interface is ___________________
A)public static void
B)Public static method
C)public static final
D)None of the above
ANSWER: C
13._____________ keyword is used to define packages in Java.
A)static
B)final
C)super
D)package
ANSWER: D
14._________________________________ is the syntax to create subpackage in java.
A)package subpackagename
B)package packagename.subpackagename
C)subpackagename
D)packagename.
ANSWER: B
15._________________method is used for writing bytes to an outputstream?
A)print()
B)write()
C)Both A&B
D)None of the above
ANSWER: C
16.____________ package contains classes and interfaces for networking.
A)java.scanner
B)java.util
C)java.lang
D)java.net
ANSWER: D
17.Command used to compile package containg java source code is ________________
A)javac -d . filename.java
B)javac -a . filename.java
C)javac +d . filename.java
D)javac .filename.java
ANSWER: A
18.Converting an object of a wrapper type to its corresponding primitive value is
called ___________________
A)uniboxing
B)unboxing
C)Boxing
D)None of the above
ANSWER: B
19._________________ is a process of writing the state of an object to a byte
stream.
A)unserialization
B)sterilization
C)encapsulation
D)serialization
ANSWER: D
20.syntax to declare enum constant in java is ________________
A)enum enumname{constants….}
B)enumname{constants….}
C)enum {constants….}
D)Enum Enumname{constants….}
ANSWER: A
Unit-III
1.Which of these keywords is not a part of exception handling?
A)try
B)catch
C)finally
D)thrown
ANSWER : D
2.Which of these keywords is used to manually throw an exception?
A)try
B)finally
C)throw
D)catch
ANSWER : C
3.Which part of code gets executed whether exception is caught or not?
A)finally
B)try
C)catch
D)throw
ANSWER : A
4.Which of these is a super class of all exceptional type classes?
A)String
B)RuntimeExceptions
C)Throwable
D)Cacheable
ANSWER : C
5.Which of these methods is used to print stack trace?
A)obtainStackTrace()
B)printStackTrace()
C)getStackTrace()
D)displayStackTrace()
ANSWER : B
6._________ class is used to define exceptions.
A)Exception
B)try
C)catch
D)None of the above
ANSWER : A
7.A single try block must be followed by _______
A)catch
B)finally
C)catch&finally
D)All the above
ANSWER : D
8._____________ handles the divide by zero error exception.
A)ArrayIndexOutBoundsException
B)ArithmeticException
C)NullPointerException
D)None of these
ANSWER : B
9.Exception class is available in ________ package
A)java.lang
B)java.awt
C)java.util
D)All the above
ANSWER : A
10._________ keyword is used to generate an exception explicitly.
A)throws
B)thrown
C)throw
D)None of the above
ANSWER : C
1. Java does not support multiple inheritance, but some of the abilities of
multiple inheritance are available by ______________________.
Ans Implementing interfaces
2. In order to determine the type that a polymorphic variable refers to, the
decision is made by the ____________________.
Ans Java run-time environment at run time.
3. The relationship between a parent class and a child class is referred to as
a(n) __________ relationship.
Ans is-a
4. _______ is the process by which object of one class acquires the properties
of object of another class.
Ans Inheritance
5. The concept of inheritance provides the idea of ______________.
Ans reusability
6. The derived class is known as _________________.
Ans subclass
7. The class from which the subclass derives the properties is called as
_______________.
Ans superclass
8. The property or the ability to take more than one form is called as
____________.
Ans polymorphism
9. Java achieves dynamic polymorphism using ____________.
Ans method overriding
10. ------------- keywords is used to define interfaces in Java?
Ans interface