Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

Combined Set of Questions

1. Which of the following is not primitive data type defined in java?

a) Byte

b) long

c) Boolean

d) String

2. Which of the following is not valid declaration of for loop?

a) for(int a=7; a<=77; a+=7)

b) for(int a=99; a>0; a/9)

c) for(int a=2; a<=20; a=2*a)

d) for(int a=20; a2; a)

3. What is process by which one object acquires all the properties and behaviors of another
objects?

a) Inheritance

b) Polymorphism

c) Abstraction

d) Encapsulation

4. Which of the following is unchecked exception in java?

a) IOException

b) SQLException

c) NullPointerException

d) FileNotFoundException
5. Which of the following keyword is used to derive child interface from parent interface?

a) Package

b) import

c) extends

d) implements

6. What is process when two or more threads need to access share resource, they need some way
to ensure that resource will used by only one thread at a time?

a) Deadlock

b) Synchronization

c) Interthread communication

d) Starvation

7. Which of the following class is used to read data from file in character Stream?

a) FileInputStream

b) FileOutputStream

c) FileReader

d) FileWriter

8. Which of the following is not method of iteration?

a) hasNext()

b) next()

c) remove()

d) empty()

9. What is name of swing control that is normally display one entry and act as dropdown list?

a) JList

b) JComboBox

c) JRadioButto

d) JCheckBox
10. Which of the following JDBC component is used to handle communication with database
server?

a) DriverManager

b) Driver

c) Connection

d) SQLException

11. Which one of the following is not a valid java bitwise operator?

a) >>

b) <<

c) >>>

d) <<<

12. Which one of the following keyword is used to declare an exception?

a) throws

b) thow

c) try

d) catch

13. Which of these is an incorrect array declaration?

a) int ary[] = new int[5];

b) int[] ary = new int[5];

c) int ary = int[5] new;

d) int ary[]; ary=new int[5];


14. Which one of the following access modifier is appropriate for members of superclass to access
only from subclass?

a) private

b) protected

c) public

d) default

15. Which one of the following is not a collection class defined in java?

a) LinkedList

b) HashSet

c) TreeSet

d) GraphSet

16. Which of the following inheritance is best implanted using interface in java?

a) Single inheritance

b) Multilevel inheritance

c) Multiple inheritance

d) Hierarchical inheritance

17. Which of the following method is called only once during the run time of your applet?

a) stop()

b) paint()

c) init

d) start()

18. Which of these method of class String is used to compare two String object for their equality?

a) equals()

b) Equals()

c) isEquals()

d) IsEqual()
19. What is the default value of priority variable MIN_PRIORITY and MAX_PRIORITY?

a) 0 & 63

b) 1 & 10

c) 0 & 1

d) 1 & 32

20. Which of the following is not java swing container?

a) Panel

b) Tabbed Pane

c) Scroll Pane

d) Scroll bar

21. Which of the following is a ternary operator?

a) >>

b) >>>

c) ++

d) ?:

22. Which keyword is used to make a variable constant in java?

a) super

b) constant

c) global

d) final

23. Which of the following is not a keyword in java?

a) Boolean

b) default

c) this

d) implicit
24. Which of these operators can skip evaluating right hand operand?

a) ^

b) |

c) &

d) &&

25. Which of these keywords is not a part of exception handling?

a) try

b) finally

c) throw

d) catch

26. The method that returns a string associated with GUI Button is ......

a) getSource() method

b) setSource() method

c) getActionCommand() method

d) setActionCommand() method

27. Which of the following is the container that doesn't contain a title bar and menu bar but it can
have other GUI components such as buttons and text fields.

a) Window

b) Frame

c) Panel

d) Menu
28. Which of the following classes is defined in javax.swing package?

a) Button

b) JButton

c) Applet

d) Frame

29. Which method is automatically called after browser calls the init method?

a) start

b) stop

c) destroy

d) paint

30. In which of the following package integer class exist?

a) java.util

b) java.file

c) java.io

d) java.lang

31. Which of these features of OOP would indicate code reusability?

a) Polymorphism

b) Abstraction

c) Inheritance

d) Encapsulation

32. Which of these specifiers would be applied to the constructors only?

a) explicit

b) implicit

c) protected

d) public
33. A constructor ...

a) may consist of a return type

b) doesn’t consist of any return type

c) has some return type

d) of a derived class has a return type

34. A derived class is also called a ...

a) small class

b) subclass

c) noticeable class

d) big class

35. Which of these attributes can we use if we want to get the actual size of any array?

a) Array_name.length

b) Size.array

c) length_Array_name

d) Array.Size

36. Which function is used to get any character that is present at a certain index of a string?

a) char charIn(String name)

b) char charAt(index)

c) char charIn(index)

d) char charAt(StringName)

37. What is character encoding scheme used for char type in java?

a) TSCII

b) ASCII

c) UNICODE

d) EBCDIC
38. Which is the super class of all java classes?

a) Class

b) Object

c) System

d) JVM

39. Which keyword is used for refer current object in java?

a) this

b) super

c) final

d) main

40. Which exception is raised when access illegal index of String?

a) StringIndexOutOfBounds

b) NullPointer

c) IllegalIndexAccess

d) InvalidIndex

41. ... is process of storing object contents into a file.

a) Serialization

b) Deserialization

c) synchronization

d) none of these

42. Which of these classes is used to read file in the form of byte sequence?

a) FileInputStream

b) FileOutputStream

c) FileReader

d) FileWriter
43. A package is a collection of ...

a) class

b) interface

c) class and interface

d) java programs

44. All classes and interfaces of event are defined in ... package.

a) java.awt.*

b) java.awt.event.*;

c) java.event.*

d) java.swing.*

45. Which of these methods of thread class is used to suspend a thread for a period of time?

a) sleep()

b) terminate()

c) suspend()

d) stop()

46. ... Layout used to arrange the components in a line one after the other?

a) FlowLayout

b) BorderLayout

c) GridLayout

d) GridBackLayout

47. Which operator is used to test if an object belongs to a class or not?

a) ==

b) equals

c) instanceof

d) object
48. ... type exception caused when a conversion between string & number fails.

a) ArithmeticException

b) NumberFormatException

c) IOException

d) InterruptedException

49. Which is valid declaration of a float?

a) float f=1.0f

b) float f=1.0

c) float f="1"

d) float f=1.0d

You might also like