Java-Programming (Set 1)
Java-Programming (Set 1)
Java-Programming (Set 1)
1 of 7 sets
o m
B. Both Procedural and Object Oriented Programming are supported in Java
. c
C. Java supports only Object Oriented Programming approach
D. None of the Above
te
Answer:B a
q M
3. JRE stands for
c
A. Java Realtime Environment
B. Java Rapid Enterprise
M
C. Java Runtime Environment
D. None of the above
Answer:C
9. Which of these coding types is used for data type char in Java?
A. ASCII
B. ISO-LATIN-1
C. UNICODE
D. None of the mentioned
Answer:C
14. 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
15. Which of the following loops will execute the body of loop even when condition
controlling the loop is initially false?
A. do-while
16. Which of these is necessary condition for automatic type conversion in Java?
A. The destination type is smaller than source type.
B. The destination type is larger than source type.
C. The destination type can be larger or smaller than source type.
D. None of the mentioned
Answer:B
21. Which of these jump statements can skip processing remainder of code in its
body for a particular iteration?
A. break
B. return
C. exit
D. continue
Answer:D
25. What is stored in the object obj in following lines of code? box obj;
A. Memory address of allocated memory of object.
27. Name the keyword that makes a variable belong to a class, rather than being
defined for each instance of the class.
A. static
B. final
C. abstract
D. public
Answer:A
30. Defining methods with same name and different no. of parameters are called
A. Method overriding
33. Which of the following is a method having same name as that of its class?
A. finalize
B. delete
C. class
D. constructor
Answer:D
34. Which operator is used by Java run time implementations to free the memory
of an object when it is no longer needed?
A. delete
B. free
C. new
D. None of the mentione
Answer:D
35. Which of these access specifiers must be used for main() method?
A. private
36. Which of these is used to access member of class before object of that class is
created?
A. public
B. private
C. static
D. protected
Answer:C
43. Identify the type of inheritance when two or more subclasses inherit the
properties of a super class.
A. Multiple inheritance
B. Single inheritance
C. Multilevel inheritance
D. Hierarchical inheritance
Answer:D
44. The keyword used inside a class to refer to its immediate super class is
A. super
B. parent
C. base
D. none of these
Answer:A
47. If a class inheriting an abstract class does not define all of its function then it
will be known as?
A. abstract
B. A simple class
C. Static class
D. None of the mentioned
Answer:A
49. Which method defined in Integer class can be used to convert a whole number
in string type to primitive int type.
A. valueOf()
B. intValue()
C. parseInt()
D. getInteger()
Answer:C
52. Which of these is used as default for a member of a class if no access specifier is
used for it?
A. private
B. public
C. public, within its own package
D. protected
Answer:C
53. Which of these keywords is used to refer to member of base class from a sub
class?
A. upper
B. super
C. this
D. None of the mentioned
Answer:B
57. Which of these can be used to fully abstract a class from its implementation?
A. Objects
B. Packages
C. Interfaces
D. None of the Mentione
Answer:C
62. The modifier which specifies that the member can only be accessed in its own
class is
A. public
B. private
C. protected
D. none
Answer:B
63. Which of the following package stores all the standard java classes? a) jav
A. lang
B. java
C. java.util
D. java.packages
Answer:A
64. Which of these is a mechanism for naming and visibility control of a class and
its content?
A. Object
B. Packages
C. Interfaces
D. None of the Mentioned
65. Which of this access specifies can be used for a class so that its objects can be
created by a different class in another package?
A. Public
B. Protected
C. No Modifier
D. All of the mentioned
Answer:A
66. 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:C
68. 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. ChatAt()
Answer:C
69. Which of these method of class String is used to obtain length of String object?
A. get()
B. Sizeof()
C. lengthof()
71. The code within the ----------- block will always be executed whether or not an
exception is thrown.
A. try..catch
B. finally
C. throw
D. throws
Answer:B
74. Which of these classes is related to all the exceptions that can be caught by
using catch?
A. Error
B. Exception
75. Which of these classes is related to all the exceptions that cannot be caught?
A. Error
B. Exception
C. None of these
D. a & b
Answer:A
78. Which class is the super class of all classes of the java.lang package?
A. Object
B. System
C. Super
D. Class
Answer:A
79. Which of the following exception is raised when a number is divided by zero
A. NumberFormatException
B. ArithmeticException
81. Which of these exceptions will occur if we try to access the index of an array
beyond its length?
A. ArithmeticException
B. ArrayException
C. ArrayIndexException
D. ArrayIndexOutOfBoundsException
Answer:D
82. Runnable is a
A. Class
B. Method
C. Variable
D. Interface
Answer:D
86. Which of these method of Thread class is used to find out the priority given to a
thread?
A. get()
B. ThreadPriority()
C. getPriority()
D. getThreadPriority()
Answer:C
87. Which of this method of Thread class is used to change the state of a thread to
blocked state?
A. sleep()
B. terminate()
C. stop()
D. block()
Answer:A
88. Which method in Thread class is used to check weather a thread is still
running?
A. isAlive()
B. Join()
C. isRunning()
D. Alive()
Answer:A
91. Which of these is used to read a string from the input stream?
A. get()
B. getLine()
C. read()
D. readLine()
Answer:D
92. Which of these classes is used to read characters and strings in Java from
console?
A. BufferedReader
B. StringReader
C. BufferedStreamReader
D. InputStreamReader
Answer:D
93. Which of these classes are used by Byte streams for input operation?
A. InputStream
B. InputOutputStream
C. Reader
D. All of the mentioned
Answer:A
94. Which of these class contains the methods print() & println()?
96. Which of these classes are used by character streams output operations?
A. OutputStream
B. Writer
C. ReadStream
D. InputOutputStream
Answer:B
97. Which refers to a channel through which data flow from the source to the
destination:
A. String
B. Character
C. Stream
D. Buffer
Answer:C