Java (Paper - 5 )internal Important Questions
I. Multiple Choice Questions
1. Which one of the following is not an object oriented language?
(a) Simula (b) Java (c) C++ (d) C
2. The concept of derived classes is involved in
(a) Inheritance (b) Encapsulation
(c) Data hiding (d) Abstract data types
3. Which keyword is used for accessing the features of a package?
(a) package (b) import (c) extends (d) export
The import keyword is used to access the classes and interfaces of a particular package to the
current file.
4. What will be the output of the following program?
public class Test2
{
public static void main(String[] args) {
StringBuffer s1 = new StringBuffer("Avanthi");
[Link](1,'j');
[Link](6,'a');
[Link](s1);
}
}
(a) Avanthi (b) Ajanthi (c) Ajantha (d) Avantha
5. Which of these data types is used to store command line arguments?
(a) Array (b) Stack (c) String (d) Integer
7. How many arguments can be passed to main()?
(a) Infinite (b) Only 1 (c) System Dependent (d) None
8. What is the process of defining more than one method in a class differentiated by
parameters?
(a) Function overriding (b) Function overloading
(c) Function doubling (d) None of the mentioned
9. Which of these data type can be used for a method having a return statement in it?
a) void b) int c) float d) both int and float
10. What is the return type of Constructors?
(a) int (b) float (c) void (d) none of the mentioned
11. Which keyword is used by the method to refer to the object that invoked it?
(a) import (b) catch (c) abstract (d) this
12. Which of the following is a method having same name as that of its class?
(a) finalize (b) delete (c) class (d) constructor
13. Which of these keywords are used to define an abstract class?
(a) abst (b) abstract (c) Abstract (d) abstract class
14. Which of this keyword must be used to inherit a class?
(a) super (b) this (c) extent (d) extends
15. Using which of the following, multiple inheritance in Java can be implemented?
(a) Interfaces ( b) Multithreading
(c) Protected methods (d) Private methods
16. If Parent class and Child class have same variable name, which keyword should be
used to use Parent class?
(a) super (b) this (c) upper (d) classname
17. Which of the following is used for implementing inheritance through an interface?
(a) inherited (b) using (c) extends (d) implements
18. Which of these operators can be used to concatenate two or more String objects?
( a) + (b) += (c) & ( d) ||
19. Which of these method of class String is used to extract a single character from a
String object?
(a) CHARAT() (b) chatat() (c) charAt() (d) CharAt()
20. Which of this method of class String is used to obtain a length of String object?
(a) get() (b) Sizeof() (c) lengthof() (d) length()
21. Which of this method of class StringBuffer is used to concatenate the string
representation to the end of invoking string?
(a) concat() (b) append() (c) join() (d) concatenate()
22. What is the string contained in s after following lines of Java code?
StringBuffer s new StringBuffer("Hello");
[Link](0);
a) Hell b) ello c) Hel d) llo
23. Which of the following are incorrect form of StringBuffer class constructor?
(a) StringBuffer() (b) StringBuffer(int size)
(c) StringBuffer(String str) (d) StringBuffer(int size , String str)
24. Which of these is a wrapper for data type int?
(a) Integer (b) Long (c) Byte (d) Double
25. Which of these packages contain all the Java’s built in exceptions?
(a) [Link] (b) [Link] (c) [Link] (d) [Link]
II. Fill in the Blanks
1. Garbage collection makes Java programs more secure and robust by automatically
freeing memory.
2. To create an instance of a class, the ‘new’ operator is used .
3. A class is a template. An object is defined as an instance of the class.
4. Java was developed by Sun Microsystems.
5. Variables are names to identify the address memory cell where the data are stored.
6. wrapper class allows you to have a class object that corresponds to a value of a
primitive type.
7. The constructor of a derived class can access the constructor of its base class by using
the reserved word super.
8. The part of the code that tells what to do when an exception occurs is called the catch-
block.
9. A class defined within another class is called Inner Class
10. The Stream is defined in the [Link] package.
11. a class prefixed with abstract keyword is known as an abstract class.
12. An abstract class may contain abstract methods and non-abstract methods.
13. All the members of an interface are public by default.
14. The interface in java enables java to support multiple-inheritance.
15. An interface may extend only one interface, but a class may implement any number of
interfaces.
16. The string created using a character array can not be extended
17. A thread is a light weight process.
18. A thread is a subpart of a process that can run individually.
19. In java, the exception handling mechanism uses five keywords
namely try, catch, finally, throw, and throws.
20. In java, exceptions have categorized into two types, and they are Checked Exception and
Unchecked Exception
21. In java, the final is a keyword and it is used with the variable , method and Class.
22. When a variable defined with the final keyword, it becomes a constant, and it does not
allow us to modify the value.
23. a package is a container of classes, interfaces, and sub-packages.
24. The access modifiers define the accessibility of the class and its members.
25. The public members can be accessed everywhere, the private members can be accessed
only inside the same class , The protected members are accessible to every child class
(same package or other packages) .
26. The default members are accessible within the same package but not outside the
package.
27. The Parent class is the class which provides features to another class. The parent class is
also known as Base class or Superclass.
28. The Child class is the class which receives features from another class. The child class is
also known as the Derived Class or Subclass.
29. The Scanner is a built-in class in java used for read the input from the user in java
programming.
III. Short Answer Questions
1. JVM (Java Virtual Machine)
2. List out java Features
3. Differences between java & C++
4. Type conversion and it types
5. For each loop with syntax
6. Difference between class & Object
7. Define Method Overloading
8. Constructor and its types
9. Finalize() method
10. Instance & static variable
11. this keyword
12. command line arguments
13. inheritance & types
14. method overriding
15. super & final keywords
16. abstract class
17. interface with syntax
18. package and it types
19. string buffer class and object creation syntax
20. boxing and unboxing