Home C C++ Java Python Perl PHP SQL JavaScript Linux Online Test Forum

Home » Java » 100 Java MCQs

100 Multiple Choice Questions on Java


Question: 1

Java Forum
Beginner other[Posted by: Admin | Chicago, USA]



Question: 2

Java Forum
Beginner exceptions[Posted by: Admin | Chicago, USA]



Question: 3

Java Forum
Beginner variables[Posted by: Admin | Chicago, USA]



Question: 4

Java Forum
Beginner multithreading[Posted by: Admin | Chicago, USA]



Question: 5

Java Forum
Beginner multithreading[Posted by: Admin | Chicago, USA]



Question: 6

(A) join
(B) sleep
(C) getPriority
(D) isAlive

Java Forum
Beginner multithreading[Posted by: Admin | Chicago, USA]



Question: 7

(A) Hello. How are you?Hello. How are you?
(B) Hello. How are you?
(C) Hello. How are you??
(D) Compilation/RuntimeError

Java Forum
Expert arrays[Posted by: Admin | Chicago, USA]



Question: 8

(A) 10
(B) 11
(C) 12
(D) 13

Java Forum
Practionar operators[Posted by: Admin | Chicago, USA]



Question: 9

(A) 13
(B) 12
(C) 11
(D) 10

Java Forum
Practionar operators[Posted by: Admin | Chicago, USA]



Question: 10

(A) 16 mph, lope
(B) 24 mph, lope
(C) 27 mph, lope
(D) Compilation fails

Java Forum
Practionar interfaces[Posted by: Admin | Chicago, USA]



Question: 11

(A) alpha beta
(B) beta beta
(C) gamma gamma
(D) Compilation fails

Java Forum
Practionar inheritance[Posted by: Admin | Chicago, USA]



Question: 12

(A) cougar c f
(B) feline cougar c c
(C) feline cougar c f
(D) Compilation fails

Java Forum
Practionar inheritance[Posted by: Admin | Chicago, USA]



Question: 13

(A) 100
(B) 1000
(C) 2
(D) 20

Java Forum
Practionar classesAndobjects[Posted by: Admin | Chicago, USA]



Question: 14

(A) 5 10
(B) 5 10 CppBuzz1
(C) 5 10 CppBuzz2
(D) Compilation Error

Java Forum
Expert exceptions[Posted by: Admin | Chicago, USA]



Question: 15

(A) Private
(B) Protected
(C) Public
(D) Package-Private

Java Forum
Practionar inheritance[Posted by: Admin | Chicago, USA]



Question: 16

(A) Pen Pencil Box
(B) Pen Pencil
(C) Box
(D) Compilation Error

Java Forum
Beginner datatype[Posted by: Admin | Chicago, USA]



Question: 17

(A) Reading...
(B) Reading Book
(C) Reading Code
(D) Compilation Error

Java Forum
Practionar inheritance[Posted by: Admin | Chicago, USA]



Question: 18

(A) Germany
(B) India
(C) Canada
(D) USA

Java Forum
Practionar conditional[Posted by: Admin | Chicago, USA]



Question: 19

(A) 0
(B) 10
(C) null
(D) IndexOutOfBoundsException

Java Forum
Practionar arrays[Posted by: Admin | Chicago, USA]



Question: 20

(A) 0 cpp 0 buzz 1 cpp 1 buzz
(B) 0 cpp 0 buzz 1 cpp 2 buzz
(C) 0 cpp 0 buzz 1 cpp 1 buzz 2 cpp 2 buzz
(D) 0 cpp 0 buzz 1 cpp 2 cpp 2 buzz

Java Forum
Practionar arrays[Posted by: Admin | Chicago, USA]



Question: 21

(A) [7,1,5]
(B) [7,5,1]
(C) [7, 1, 5, 1]
(D) None of the above

Java Forum
Beginner datatype[Posted by: Admin | Chicago, USA]



Question: 22

(A) true
(B) false
(C) Compilation Error
(D) None of the above

Java Forum
Practionar methods[Posted by: Admin | Chicago, USA]



Question: 23

(A) 100
(B) 1000
(C) 2
(D) 20

Java Forum
Practionar classesAndobjects[Posted by: Admin | Chicago, USA]



Question: 24

(A) 00
(B) 05
(C) 50
(D) 55

Java Forum
Practionar classesAndobjects[Posted by: Admin | Chicago, USA]



Question: 25

(A) 10
(B) 0
(C) Error in Code
(D) Nothing is printed

Java Forum
Beginner datatype[Posted by: Admin | Chicago, USA]



Question: 26

(A) 10
(B) Compilation Error
(C) Undefind
(D) 0

Java Forum
Practionar variables[Posted by: Admin | Chicago, USA]



Question: 27

(A) a
(B) b
(C) a and both
(D) Neither a nor b

Java Forum
Beginner other[Posted by: Arvind | Navi Mumbai India]



Question: 28

(A) 0
(B) garbage value
(C) runtime error
(D) compile time error

Java Forum
Beginner other[Posted by: Arvind | Navi Mumbai India]



Question: 29

(A) Anonymous inner class
(B) Interface
(C) Inner class
(D) All of the mentioned

Java Forum
Expert classesAndobjects[Posted by: Arvind | Navi Mumbai India]



Question: 30

(A) java.io
(B) java.util
(C) java.lang
(D) java.net

Java Forum
Beginner exceptions[Posted by: Arvind | Navi Mumbai India]



Question: 31

(A) finally
(B) catch
(C) finally & catch
(D) none of the mentioned

Java Forum
Beginner exceptions[Posted by: Arvind | Navi Mumbai India]



Question: 32

(A) throws
(B) finally
(C) catch
(D) throw

Java Forum
Beginner exceptions[Posted by: Arvind | Navi Mumbai India]



Question: 33

(A) The main thread waits for other threads to finish
(B) The main thread is finished first then other threads
(C) Other threads will sleep until main is complete
(D) All of these

Java Forum
Practitioner other[Posted by: Admin | Chicago, USA]



Question: 34

(A) Heap
(B) Stack
(C) Cache
(D) Register

Java Forum
Beginner referencevar[Posted by: Admin | Chicago, USA]



Question: 35

(A) abstract is a keyword
(B) abstract is a method
(C) abstract is a class
(D) All of these

Java Forum
Beginner interfaces[Posted by: Admin | Chicago, USA]



Question: 36

(A) It is not allowed. Compilation Error
(B) It is allowed. CppBuzz
(C) It is allowed. Compilation Error
(D) None of the above

Java Forum
Practitioner interfaces[Posted by: Admin | Chicago, USA]



Question: 37

(A) Compilation Error
(B) Hello CppBuzz
(C) 13
(D) Hello CppBuzz13

Java Forum
Practitioner interfaces[Posted by: Admin | Chicago, USA]



Question: 38

(A) Yes
(B) No

Java Forum
Practitioner interfaces[Posted by: Admin | Chicago, USA]



Question: 39

Java Forum
Beginner exceptions[Posted by: Admin | Chicago, USA]



Question: 40

(A) NumberFormatException
(B) IllegalArgumentException
(C) RuntimeException
(D) ParseException

Java Forum
Expert exceptions[Posted by: Admin | Chicago, USA]



Question: 41

(A) NullPointerException
(B) NumberFormatException
(C) ClassCastException
(D) ParseException

Java Forum
Beginner exceptions[Posted by: Admin | Chicago, USA]



Question: 42

(A) Thread
(B) Object
(C) Runnable
(D) Class

Java Forum
Practitioner interfaces[Posted by: Admin | Chicago, USA]



Question: 43

(A) Exception
(B) Throwable
(C) JavaBase
(D) Error

Java Forum
Expert exceptions[Posted by: Admin | Chicago, USA]



Question: 44

(A) Singletons
(B) Java Beans
(C) Transactions
(D) None of the above

Java Forum
Expert classesAndobjects[Posted by: Admin | Chicago, USA]



Question: 45

(A) True
(B) False

Java Forum
Practitioner packages[Posted by: Admin | Chicago, USA]



Question: 46

(A) void methodA(){} int methodA(){}
(B) void methodA(){} void methodA(int a){}
(C) void methodA(){} int methodB(int a){}
(D) int methodA(){} int methodAA(i{}

Java Forum
Practitioner polymorphism[Posted by: Admin | Chicago, USA]



Question: 47

(A) class-A class-A
(B) class-B class-B
(C) class-B class-A
(D) class-A class-B

Java Forum
Practitioner polymorphism[Posted by: Admin | Chicago, USA]



Question: 48

(A) Autoboxing
(B) Morphing
(C) Unboxing
(D) Typecasting

Java Forum
Expert other[Posted by: Admin | Chicago, USA]



Question: 49

(A) HashTable
(B) EnumSet
(C) Vector
(D) ArrayList

Java Forum
Expert collection[Posted by: Admin | Chicago, USA]



Question: 50

(A) cppbuzz-11
(B) cppbuzz-11.0
(C) hello-11
(D) hello-11.0

Java Forum
Practitioner overriding[Posted by: Admin | Chicago, USA]



Question: 51

(A) Yes
(B) No

Java Forum
Beginner overriding[Posted by: Admin | Chicago, USA]



Question: 52

(A) True
(B) False

Java Forum
Beginner packages[Posted by: Admin | Chicago, USA]



Question: 53

(A) True
(B) False

Java Forum
Beginner packages[Posted by: Admin | Chicago, USA]



Question: 54

(A) True
(B) False

Java Forum
Beginner packages[Posted by: Admin | Chicago, USA]



Question: 55

(A) 1
(B) Depends on the calling program
(C) Depends on class creating object of Singleton class
(D) 256

Java Forum
Practitioner singleton[Posted by: Admin | Chicago, USA]



Question: 56

(A) O(n)
(B) O(1)
(C) O(log(n))
(D) None of these

Java Forum
Expert collection[Posted by: Admin | Chicago, USA]



Question: 57

(A) O(1)
(B) O(n)
(C) O(log(n))
(D) None of these

Java Forum
Expert collection[Posted by: Admin | Chicago, USA]



Question: 58

(A) True
(B) False

Java Forum
Practitioner collection[Posted by: Admin | Chicago, USA]



Question: 59

(A) 22
(B) 12
(C) 11
(D) 21

Java Forum
Beginner collection[Posted by: Admin | Chicago, USA]



Question: 60

(A) True
(B) False

Java Forum
Beginner collection[Posted by: Admin | Chicago, USA]



Question: 61

(A) 331
(B) 3321
(C) 310
(D) 321

Java Forum
Practitioner collection[Posted by: Admin | Chicago, USA]



Question: 62

(A) true
(B) -2
(C) Compilation Error
(D) 0

Java Forum
Practitioner collection[Posted by: Admin | Chicago, USA]



Question: 63

(A) -1
(B) 0
(C) IndexOutOfBoundsException
(D) None of the above

Java Forum
Practitioner collection[Posted by: Admin | Chicago, USA]



Question: 64

(A) Nothing is printed
(B) 5
(C) 0
(D) true

Java Forum
Practitioner collection[Posted by: Admin | Chicago, USA]



Question: 65

(A) Nothing is printed
(B) Compilation Error
(C) Exception
(D) 5

Java Forum
Practitioner collection[Posted by: Admin | Chicago, USA]



Question: 66

(A) Nothing is printed
(B) IndexOutOfBoundsException
(C) Compilation Error
(D) 0

Java Forum
Practitioner collection[Posted by: Admin | Chicago, USA]



Question: 67

(A) Compilation Error
(B) Exception
(C) 1
(D) 0

Java Forum
Beginner collection[Posted by: Admin | Chicago, USA]



Question: 68

(A) It reads first line of cppbuzz.txt file
(B) It reads first character of cppbuzz.txt file
(C) It reads all the contents of cppbuzz.txt file
(D) None of these

Java Forum
Practitioner filehandling[Posted by: ASISH ARAVIND | Des Moines USA]



Question: 69

(A) Yes
(B) No

Java Forum
Practitioner abstractclass[Posted by: Admin | Chicago, USA]



Question: 70

(A) Yes
(B) No

Java Forum
Expert abstractclass[Posted by: Admin | Chicago, USA]



Question: 71

(A) It is an Keyword
(B) Its is a Data type
(C) It is a Class
(D) None of the above

Java Forum
Beginner abstractclass[Posted by: Admin | Chicago, USA]



Question: 72

(A) Yes
(B) No

Java Forum
Beginner abstractclass[Posted by: Admin | Chicago, USA]



Question: 73

(A) Arrays are passed by Value
(B) Arrays are passed by Reference
(C) It depends on type of array
(D) It depends on Compiler

Java Forum
Beginner arrays[Posted by: Admin | Chicago, USA]



Question: 74

(A) Compilation Error
(B) 12345
(C) 246810
(D) Exception

Java Forum
Practitioner arrays[Posted by: Admin | Chicago, USA]



Question: 75

(A) 20
(B) 10
(C) Compilation Error
(D) None of the above

Java Forum
Practitioner methods[Posted by: Admin | Chicago, USA]



Question: 76

(A) 12345
(B) 1234
(C) Compilation Error
(D) ArrayIndexOutOfBoundsException

Java Forum
Expert arrays[Posted by: Admin | Chicago, USA]



Question: 77

(A) Compilation Error
(B) Exception
(C) Hi
(D) Hello

Java Forum
Practitioner methods[Posted by: Admin | Chicago, USA]



Question: 78

(A) Hello
(B) Compilation Error
(C) Exception
(D) None of these

Java Forum
Practitioner classesAndobjects[Posted by: Admin | Chicago, USA]



Question: 79

(A) -100null
(B) -100
(C) null
(D) Compilation Error - unreachable statement at line 8

Java Forum
Practitioner exceptions[Posted by: Admin | Chicago, USA]



Question: 80

(A) -100
(B) null
(C) -100null
(D) null-100

Java Forum
Practitioner exceptions[Posted by: Admin | Chicago, USA]



Question: 81

(A) Yes
(B) No It is compilation error

Java Forum
Beginner exceptions[Posted by: Admin | Chicago, USA]



Question: 82

(A) -100
(B) Compilation Error
(C) Exception since catch is missing
(D) Exception since finally is missing

Java Forum
Beginner exceptions[Posted by: Admin | Chicago, USA]



Question: 83

(A) Yes
(B) No

Java Forum
Beginner exceptions[Posted by: Admin | Chicago, USA]



Question: 84

(A) 99
(B) 67
(C) Unpredictable Value
(D) NumberFormatException

Java Forum
Practitioner typecasting[Posted by: Admin | Chicago, USA]



Question: 85

(A) 'a'
(B) a
(C) 65
(D) 97

Java Forum
Practitioner datatype[Posted by: Admin | Chicago, USA]



Question: 86

(A) 65 & Infinite loop
(B) 65
(C) Nothing is printed
(D) Compilation Error

Java Forum
Expert methods[Posted by: Admin | Chicago, USA]



Question: 87

(A) 6565
(B) 65
(C) "65"
(D) None of the above

Java Forum
Practitioner methods[Posted by: Admin | Chicago, USA]



Question: 88

(A) AT&T Lab65
(B) AT&T Lab 65
(C) AT&T Lab
(D) Compilation Error

Java Forum
Practitioner methods[Posted by: Admin | Chicago, USA]



Question: 89

(A) Ash
(B) Ashxyz
(C) Nothing is printed
(D) AshxyzabcImn

Java Forum
Expert conditional[Posted by: ASISH ARAVIND | Des Moines USA]



Question: 90

(A) null
(B) Nothing is printed
(C) Compilation Error
(D) ArrayIndexOutOfBoundsException

Java Forum
Practitioner methods[Posted by: Admin | Chicago, USA]



Question: 91

(A) null
(B) Nothing is printed
(C) Exception
(D) Compilation Error

Java Forum
Expert classesAndobjects[Posted by: Admin | Chicago, USA]



Question: 92

(A) 10203040
(B) 10203040Hello
(C) Hello
(D) Nothing is printed

Java Forum
Expert classesAndobjects[Posted by: ASISH ARAVIND | Des Moines USA]



Question: 93

(A) 10203040
(B) 10203040Hello
(C) Hello
(D) None of these

Java Forum
Expert classesAndobjects[Posted by: ASISH ARAVIND | Des Moines USA]



Question: 94

(A) Yes
(B) No

Java Forum
Practitioner classesAndobjects[Posted by: ASISH ARAVIND | Des Moines USA]



Question: 95

(A) Cap Cog
(B) Cap Cap
(C) Cog Cog
(D) Cap Cog Cap Cog

Java Forum
Expert classesAndobjects[Posted by: Admin | Chicago, USA]



Question: 96

(A) Cap Cog
(B) Cap Cap
(C) Cog Cog
(D) Cap Cog Cap Cog

Java Forum
Expert classesAndobjects[Posted by: Admin | Chicago, USA]



Question: 97

(A) 1
(B) 2
(C) 3
(D) 0

Java Forum
Beginner datatype[Posted by: Admin | Chicago, USA]



Question: 98

(A) 1
(B) 2
(C) 3
(D) Max 256

Java Forum
Beginner classesAndobjects[Posted by: Admin | Chicago, USA]



Question: 99

(A) It is visible to same project
(B) It is visible to same package
(C) It is visible to same file
(D) All of these

Java Forum
Beginner modifiers[Posted by: Admin | Chicago, USA]



Question: 100

(A) Private members can be accessed within a same package
(B) Private members can be accessed within class only
(C) Private members can be accessed within sub classes of same package
(D) All of the above

Java Forum
Practitioner modifiers[Posted by: Admin | Chicago, USA]