Here are 1000 Java Programming MCQ (Chapterwise).
1. Who invented Java Programming?
a) Guido van Rossum
b) James Gosling
c) Dennis Ritchie
d) Bjarne Stroustrup
View Answer
Answer: b
Explanation: Java programming was developed by James Gosling at Sun Microsystems in 1995. James Gosling is well known as the father of Java.
2. 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
View Answer
Answer: d
Explanation: Java is called 'Platform Independent Language' as it primarily works on the principle of 'compile once, run everywhere'.
3. Which component is used to compile, debug and execute the java programs?
a) JRE
b) JIT
c) JDK
d) JVM
View Answer
Answer: c
Explanation: JDK is a core component of Java Environment and provides all the tools, executables and binaries required to compile, debug and execute a Java Program.
4. Which one of the following is not a Java feature?
a) Object-oriented
b) Use of pointers
c) Portable
d) Dynamic and Extensible
View Answer
Answer: b
Explanation: Pointers is not a Java feature. Java provides an efficient abstraction layer for developing without using a pointer in Java. Features of Java Programming are Portable, Architectural Neutral, Object-Oriented, Robust, Secure, Dynamic and Extensible, etc.
5. Which of these cannot be used for a variable name in Java?
a) identifier & keyword
b) identifier
c) keyword
d) none of the mentioned
View Answer
Answer: c
Explanation: Keywords are specially reserved words that can not be used for naming a user defined variable, for example: class, int, for, etc.
6. What is the extension of java code files?
a) .js
b) .txt
c) .class
d) .java
View Answer
Answer: d
Explanation: Java files have .java extension.
7. What will be the output of the following Java code?
-
class increment {
-
public static void main( String args[ ] )
-
{
-
int g = 3 ;
-
System.out.print ( ++g * 8 ) ;
-
}
-
}
a) 32
b) 33
c) 24
d) 25
View Answer
Answer: a
Explanation: Operator ++ has more preference than *, thus g becomes 4 and when multiplied by 8 gives 32.
output:
$ javac increment.java $ java increment 32
8. Which environment variable is used to set the java path?
a) MAVEN_HOME
b) CLASSPATH
c) JAVA
d) JAVA_HOME
View Answer
Answer: d
Explanation: JAVA_HOME is used to store a path to the java installation.
9. What will be the output of the following Java code?
-
class output {
-
public static void main( String args[ ] )
-
{
-
double a, b,c;
-
a = 3.0 / 0 ;
-
b = 0 / 4.0 ;
-
c= 0 / 0.0 ;
-
System.out.println (a) ;
-
System.out.println (b) ;
-
System.out.println (c) ;
-
}
-
}
a) NaN
b) Infinity
c) 0.0
d) all of the mentioned
View Answer
Answer: a
Explanation: For floating point literals, we have constant value to represent (10/0.0) infinity either positive or negative and also have NaN (not a number for undefined like 0/0.0), but for the integral type, we don't have any constant that's why we get an arithmetic exception.
10. Which of the following is not an OOPS concept in Java?
a) Polymorphism
b) Inheritance
c) Compilation
d) Encapsulation
View Answer
Answer: c
Explanation: There are 4 OOPS concepts in Java. Inheritance, Encapsulation, Polymorphism and Abstraction.
11. What is not the use of "this" keyword in Java?
a) Referring to the instance variable when a local variable has the same name
b) Passing itself to the method of the same class
c) Passing itself to another method
d) Calling another constructor in constructor chaining
View Answer
Answer: b
Explanation: "this" is an important keyword in java. It helps to distinguish between local variable and variables passed in the method as parameters.
12. What will be the output of the following Java program?
-
class variable_scope
-
{
-
public static void main( String args[ ] )
-
{
-
int x;
-
x = 5 ;
-
{
-
int y = 6 ;
-
System.out.print (x + " " + y) ;
-
}
-
System.out.println (x + " " + y) ;
-
}
-
}
a) Compilation error
b) Runtime error
c) 5 6 5 6
d) 5 6 5
View Answer
Answer: a
Explanation: Second print statement doesn't have access to y , scope y was limited to the block defined after initialization of x.
output:
$ javac variable_scope.java Exception in thread "main" java.lang.Error : Unresolved compilation problem: y cannot be resolved to a variable
13. What will be the error in the following Java code?
a) b cannot contain value 50
b) b cannot contain value 100, limited by its range
c) No error in this code
d) * operator has converted b * 50 into int, which can not be converted to byte without casting
View Answer
Answer: d
Explanation: While evaluating an expression containing int, bytes or shorts, the whole expression is converted to int then evaluated and the result is also of type int.
14. What will be the output of the following Java program?
-
class evaluate
-
{
-
public static void main( String args[ ] )
-
{
-
int arr[ ] = new int [ ] { 0 , 1, 2, 3, 4, 5, 6, 7, 8, 9 } ;
-
int n = 6 ;
-
n = arr[arr[n] / 2 ] ;
-
System.out.println (arr[n] / 2 ) ;
-
}
-
}
a) 2
b) 1
c) 4
d) 0
View Answer
Answer: b
Explanation: Array arr contains 10 elements. n contains 6 thus in next line n is given value 3 printing arr[3]/2 i:e 3/2 = 1 because of int Value, by int values there is no rest. If this values would be float the result would be 1.5.
output:
$ javac evaluate.java $ java evaluate 1
15. Which of the following is a type of polymorphism in Java Programming?
a) Multiple polymorphism
b) Compile time polymorphism
c) Multilevel polymorphism
d) Execution time polymorphism
View Answer
Answer: b
Explanation: There are two types of polymorphism in Java. Compile time polymorphism (overloading) and runtime polymorphism (overriding).
16. What will be the output of the following Java program?
-
class leftshift_operator
-
{
-
public static void main( String args[ ] )
-
{
-
byte x = 64 ;
-
int i;
-
byte y;
-
i = x << 2 ;
-
y = ( byte ) (x << 2 )
-
System.out.print (i + " " + y) ;
-
}
-
}
a) 0 256
b) 0 64
c) 256 0
d) 64 0
View Answer
Answer: c
Explanation: None.
output:
$ javac leftshift_operator.java $ java leftshift_operator 256 0
17. What will be the output of the following Java code?
-
class Output
-
{
-
public static void main( String args[ ] )
-
{
-
int x=y=z= 20 ;
-
}
-
}
a) compile time error
b) run time error
c) 20
d) compile and runs fine
View Answer
Answer: a
Explanation: None.
18. Which of the following package is used for text formatting in Java programming language?
a) java.io
b) java.awt.text
c) java.awt
d) java.text
View Answer
Answer: d
Explanation: java.text allows formatting, searching and manipulating text.
19. Which of the following is not a segment of memory in java?
a) Code Segment
b) Register Segment
c) Stack Segment
d) Heap Segment
View Answer
Answer: b
Explanation: There are only 3 types of memory segment. Stack Segment, Heap Segment and Code Segment.
20. What will be the output of the following Java program?
-
class box
-
{
-
int width;
-
int height;
-
int length;
-
}
-
class mainclass
-
{
-
public static void main( String args[ ] )
-
{
-
box obj = new box( ) ;
-
obj.width = 10 ;
-
obj.height = 2 ;
-
obj.length = 10 ;
-
int y = obj.width * obj.height * obj.length ;
-
System.out.print (y) ;
-
}
-
}
a) 100
b) 400
c) 200
d) 12
View Answer
Answer: c
Explanation: None.
output:
$ javac mainclass.java $ java mainclass 200
21. What is Truncation in Java?
a) Floating-point value assigned to a Floating type
b) Floating-point value assigned to an integer type
c) Integer value assigned to floating type
d) Integer value assigned to floating type
View Answer
Answer: b
Explanation: None.
22. What will be the output of the following Java program?
-
class Output
-
{
-
public static void main( String args[ ] )
-
{
-
int arr[ ] = { 1, 2, 3, 4, 5 } ;
-
for ( int i = 0 ; i < arr.length - 2 ; ++i)
-
System.out.println (arr[i] + " " ) ;
-
}
-
}
a) 1 2 3 4 5
b) 1 2 3 4
c) 1 2
d) 1 2 3
View Answer
Answer: d
Explanation: arr.length() is 5, so the loop is executed for three times.
output:
$ javac Output.java $ java Output 1 2 3
23. What will be the output of the following Java code snippet?
-
class abc
-
{
-
public static void main( String args[ ] )
-
{
-
if (args.length > 0 )
-
System.out.println (args.length ) ;
-
}
-
}
a) The snippet compiles and runs but does not print anything
b) The snippet compiles, runs and prints 0
c) The snippet compiles, runs and prints 1
d) The snippet does not compile
View Answer
Answer: a
Explanation: As no argument is passed to the code, the length of args is 0. So the code will not print.
24. What is the extension of compiled java classes?
a) .txt
b) .js
c) .class
d) .java
View Answer
Answer: c
Explanation: The compiled java files have .class extension.
25. Which exception is thrown when java is out of memory?
a) MemoryError
b) OutOfMemoryError
c) MemoryOutOfBoundsException
d) MemoryFullException
View Answer
Answer: b
Explanation: The Xms flag has no default value, and Xmx typically has a default value of 256MB. A common use for these flags is when you encounter a java.lang.OutOfMemoryError.
26. What will be the output of the following Java program?
-
class Alligator
-
{
-
public static void main( String [ ] args)
-
{
-
int [ ]x[ ] = { { 1,2 }, { 3,4,5 }, { 6,7,8,9 } } ;
-
int [ ] [ ]y = x;
-
System.out.println (y[ 2 ] [ 1 ] ) ;
-
}
-
}
a) Compilation Error
b) 2
c) 3
d) 7
View Answer
Answer: d
Explanation: Both x,and y are pointing to the same array.
27. What will be the output of the following Java code?
-
class A
-
{
-
int i;
-
void display( )
-
{
-
System.out.println (i) ;
-
}
-
}
-
class B extends A
-
{
-
int j;
-
void display( )
-
{
-
System.out.println (j) ;
-
}
-
}
-
class method_overriding
-
{
-
public static void main( String args[ ] )
-
{
-
B obj = new B( ) ;
-
obj.i = 1 ;
-
obj.j = 2 ;
-
obj.display ( ) ;
-
}
-
}
a) 1
b) 2
c) 0
d) Error
View Answer
Answer: b
Explanation: class A & class B both contain display() method, class B inherits class A, when display() method is called by object of class B, display() method of class B is executed rather than that of Class A.
output:
$ javac method_overriding.java $ java method_overriding 2
28. Which of these are selection statements in Java?
a) break
b) continue
c) for()
d) if()
View Answer
Answer: d
Explanation: Continue and break are jump statements, and for is a looping statement.
29. Which of these coding types is used for data type characters in Java?
a) ISO-LATIN-1
b) UNICODE
c) ASCII
d) None of the mentioned
View Answer
Answer: b
Explanation: Unicode defines fully international character set that can represent all the characters found in all human languages. Its range is from 0 to 65536.
30. What will be the output of the following Java code?
-
class String_demo
-
{
-
public static void main( String args[ ] )
-
{
-
char chars[ ] = { 'a', 'b', 'c' } ;
-
String s = new String (chars) ;
-
System.out.println (s) ;
-
}
-
}
a) abc
b) a
c) b
d) c
View Answer
Answer: a
Explanation: String(chars) is a constructor of class string, it initializes string s with the values stored in character array chars, therefore s contains "abc".
output:
$ javac String_demo.java $ java String_demo abc
31. What will be the output of the following Java program?
-
class recursion
-
{
-
int func ( int n)
-
{
-
int result;
-
if (n == 1 )
-
return 1 ;
-
result = func (n - 1 ) ;
-
return result;
-
}
-
}
-
class Output
-
{
-
public static void main( String args[ ] )
-
{
-
recursion obj = new recursion( ) ;
-
System.out.print (obj.func ( 5 ) ) ;
-
}
-
}
a) 1
b) 120
c) 0
d) None of the mentioned
View Answer
Answer: a
Explanation: None.
Output:
$ javac Output.javac $ java Output 1
32. What will be the output of the following Java code?
-
class output
-
{
-
public static void main( String args[ ] )
-
{
-
String c = "Hello i love java" ;
-
boolean var;
-
var = c.startsWith ( "hello" ) ;
-
System.out.println (var) ;
-
}
-
}
a) 0
b) true
c) 1
d) false
View Answer
Answer: d
Explanation: startsWith() method is case sensitive "hello" and "Hello" are treated differently, hence false is stored in var.
Output:
$ javac output.java $ java output false
33. Which of these keywords is used to define interfaces in Java?
a) intf
b) Intf
c) interface
d) Interface
View Answer
Answer: c
Explanation: None.
34. What will be the output of the following Java program?
-
class output
-
{
-
public static void main( String args[ ] )
-
{
-
StringBuffer s1 = new StringBuffer ( "Hello" ) ;
-
StringBuffer s2 = s1.reverse ( ) ;
-
System.out.println (s2) ;
-
}
-
}
a) HelloolleH
b) olleHHello
c) Hello
d) olleH
View Answer
Answer: d
Explanation: reverse() method reverses all characters. It returns the reversed object on which it was called.
Output:
$ javac output.java $ java output olleH
35. What will be the output of the following Java code?
-
class Output
-
{
-
public static void main( String args[ ] )
-
{
-
Integer i = new Integer ( 257 ) ;
-
byte x = i.byteValue ( ) ;
-
System.out.print (x) ;
-
}
-
}
a) 257
b) 256
c) 1
d) 0
View Answer
Answer: a
Explanation: i.byteValue() method returns the value of wrapper i as a byte value. i is 257, range of byte is 256 therefore i value exceeds byte range by 1 hence 1 is returned and stored in x.
Output:
$ javac Output.java $ java Output 1
36. What will be the output of the following Java program?
-
class Output
-
{
-
public static void main( String args[ ] )
-
{
-
double x = 2.0 ;
-
double y = 3.0 ;
-
double z = Math.pow ( x, y ) ;
-
System.out.print (z) ;
-
}
-
}
a) 9.0
b) 8.0
c) 4.0
d) 2.0
View Answer
Answer: b
Explanation: Math.pow(x, y) methods returns value of y to the power x, i:e x ^ y, 2.0 ^ 3.0 = 8.0.
Output:
$ javac Output.java $ java Output 8.0
37. Which of these class is a superclass of every class in Java?
a) ArrayList class
b) Abstract class
c) Object class
d) String class
View Answer
Answer: c
Explanation: Object class is superclass of every class in Java.
38. What will be the output of the following Java code?
-
class Output
-
{
-
public static void main( String args[ ] )
-
{
-
double x = 3.14 ;
-
int y = ( int ) Math.ceil (x) ;
-
System.out.print (y) ;
-
}
-
}
a) 3
b) 0
c) 4
d) 3.0
View Answer
Answer: c
Explanation: ciel(double X) returns the smallest whole number greater than or equal to variable x.
Output:
$ javac Output.java $ java Output 4
39. What will be the output of the following Java code?
-
class Output
-
{
-
public static void main( String args[ ] )
-
{
-
int a = Character.MIN_VALUE ;
-
System.out.print ( ( char )a) ;
-
}
-
}
a) @
b) Space
c) <
d) !
View Answer
Answer: b
Explanation: Character.MIN_VALUE returns the smallest character value, which is of space character ' '.
Output:
$ javac Output.java $ java Output
40. What will be the output of the following Java program?
-
import java.net.* ;
-
class networking
-
{
-
public static void main( String [ ] args) throws Exception
-
{
-
URL obj = new URL ( "https://www.sanfoundry.com/javamcq" ) ;
-
URLConnection obj1 = obj.openConnection ( ) ;
-
int len = obj1.getContentLength ( ) ;
-
System.out.print (len) ;
-
}
-
}
Note: Host URL is having length of content 127.
a) 127
b) 126
c) Runtime Error
d) Compilation Error
View Answer
Answer: a
Explanation: None.
Output:
$ javac networking.java $ java networking 127
41. Which of the below is not a Java Profiler?
a) JProfiler
b) Eclipse Profiler
c) JVM
d) JConsole
View Answer
Answer: c
Explanation: Memory leak is like holding a strong reference to an object although it would never be needed anymore. Objects that are reachable but not live are considered memory leaks. Various tools help us to identify memory leaks.
42. What will be the output of the following Java program?
-
import java.net.* ;
-
class networking
-
{
-
public static void main( String [ ] args) throws MalformedURLException
-
{
-
URL obj = new URL ( "https://www.sanfoundry.com/javamcq" ) ;
-
System.out.print (obj.toExternalForm ( ) ) ;
-
}
-
}
a) www.sanfoundry.com
b) https://www.sanfoundry.com/javamcq
c) sanfoundry
d) sanfoundry.com
View Answer
Answer: b
Explanation: toExternalForm() is used to know the full URL of an URL object.
Output:
$ javac networking.java $ java networking https: //www.sanfoundry.com/javamcq
43. Which of these keywords can be used to prevent Method overriding in Java?
a) final
b) protected
c) static
d) constant
View Answer
Answer: a
Explanation: To disallow a method from being overridden, specify final as a modifier at the start of its declaration. Methods declared as final cannot be overridden.
44. What will be the output of the following Java code snippet?
-
import java.util.* ;
-
class Arraylist
-
{
-
public static void main( String args[ ] )
-
{
-
ArrayList obj = new ArrayList ( ) ;
-
obj.add ( "A" ) ;
-
obj.add ( "B" ) ;
-
obj.add ( "C" ) ;
-
obj.add ( 1, "D" ) ;
-
System.out.println (obj) ;
-
}
-
}
a) [A, D, C]
b) [A, B, C]
c) [A, B, C, D]
d) [A, D, B, C]
View Answer
Answer: d
Explanation: obj is an object of class ArrayList hence it is an dynamic array which can increase and decrease its size. obj.add("X") adds to the array element X and obj.add(1,"X") adds element x at index position 1 in the list, Hence obj.add(1,"D") stores D at index position 1 of obj and shifts the previous value stored at that position by 1.
Output:
$ javac Arraylist.java $ java Arraylist [A, D, B, C].
45. What will be the output of the following Java code?
-
import java.util.* ;
-
class date
-
{
-
public static void main( String args[ ] )
-
{
-
Date obj = new Date ( ) ;
-
System.out.print (obj) ;
-
}
-
}
a) Any Garbage Value
b) Prints Present Time & Date
c) Runtime Error
d) Prints Present Date
View Answer
Answer: b
Explanation: None.
Output:
$ javac date.java $ java date Tue Jun 11 11 : 29 : 57 PDT 2013
46. Which of these packages contains the exception Stack Overflow in Java?
a) java.io
b) java.system
c) java.lang
d) java.util
View Answer
Answer: c
Explanation: None.
47. What will be the output of the following Java program?
-
import java.util.* ;
-
class Collection_iterators
-
{
-
public static void main( String args[ ] )
-
{
-
LinkedList list = new LinkedList ( ) ;
-
list.add ( new Integer ( 2 ) ) ;
-
list.add ( new Integer ( 8 ) ) ;
-
list.add ( new Integer ( 5 ) ) ;
-
list.add ( new Integer ( 1 ) ) ;
-
Iterator i = list.iterator ( ) ;
-
Collections.reverse (list) ;
-
Collections.sort (list) ;
-
while (i.hasNext ( ) )
-
System.out.print (i.next ( ) + " " ) ;
-
}
-
}
a) 1 2 5 8
b) 2 1 8 5
c) 1 5 8 2
d) 2 8 5 1
View Answer
Answer: a
Explanation: Collections.sort(list) sorts the given list, the list was 2->8->5->1 after sorting it became 1->2->5->8.
Output:
$ javac Collection_iterators.java $ java Collection_iterators 1 2 5 8
48. Which of these keywords are used for the block to be examined for exceptions?
a) check
b) throw
c) catch
d) try
View Answer
Answer: d
Explanation: try is used for the block that needs to checked for exception.
49. What will be the output of the following Java code?
-
class multithreaded_programing
-
{
-
public static void main( String args[ ] )
-
{
-
Thread t = Thread.currentThread ( ) ;
-
t.setName ( "New Thread" ) ;
-
System.out.println (t) ;
-
}
-
}
a) Thread[main,5,main]
b) Thread[New Thread,5,main]
c) Thread[5,main]
d) Thread[New Thread,5]
View Answer
Answer: b
Explanation: None.
Output:
$ javac multithreaded_programing.java $ java multithreaded_programing Thread [ New Thread,5,main]
50. Which one of the following is not an access modifier?
a) Protected
b) Void
c) Public
d) Private
View Answer
Answer: b
Explanation: Public, private, protected and default are the access modifiers.
51. What will be the output of the following Java program?
-
class output
-
{
-
public static void main( String args[ ] )
-
{
-
StringBuffer s1 = new StringBuffer ( "Hello" ) ;
-
StringBuffer s2 = s1.reverse ( ) ;
-
System.out.println (s2) ;
-
}
-
}
a) olleH
b) olleHHello
c) Hello
d) HelloolleH
View Answer
Answer: a
Explanation: reverse() method reverses all characters. It returns the reversed object on which it was called.
Output:
$ javac output.java $ java output olleH
52. What is the numerical range of a char data type in Java?
a) 0 to 256
b) -128 to 127
c) 0 to 65535
d) 0 to 32767
View Answer
Answer: c
Explanation: Char occupies 16-bit in memory, so it supports 216 i:e from 0 to 65535.
53. What will be the output of the following Java code?
-
class newthread extends Thread
-
{
-
Thread t;
-
newthread( )
-
{
-
t1 = new Thread ( this,"Thread_1" ) ;
-
t2 = new Thread ( this,"Thread_2" ) ;
-
t1.start ( ) ;
-
t2.start ( ) ;
-
}
-
public void run( )
-
{
-
t2.setPriority ( Thread.MAX_PRIORITY ) ;
-
System.out.print (t1.equals (t2) ) ;
-
}
-
}
-
class multithreaded_programing
-
{
-
public static void main( String args[ ] )
-
{
-
new newthread( ) ;
-
}
-
}
a) truetrue
b) falsefalse
c) true
d) false
View Answer
Answer: b
Explanation: This program was previously done by using Runnable interface, here we have used Thread class. This shows both the method are equivalent, we can use any of them to create a thread.
Output:
$ javac multithreaded_programing.java $ java multithreaded_programing falsefalse
54. Which class provides system independent server side implementation?
a) Server
b) ServerReader
c) Socket
d) ServerSocket
View Answer
Answer: d
Explanation: ServerSocket is a java.net class which provides system independent implementation of server side socket connection.
55. What will be the output of the following Java code?
-
class overload
-
{
-
int x;
-
double y;
-
void add( int a , int b)
-
{
-
x = a + b;
-
}
-
void add( double c , double d)
-
{
-
y = c + d;
-
}
-
overload( )
-
{
-
this.x = 0 ;
-
this.y = 0 ;
-
}
-
}
-
class Overload_methods
-
{
-
public static void main( String args[ ] )
-
{
-
overload obj = new overload( ) ;
-
int a = 2 ;
-
double b = 3.2 ;
-
obj.add (a, a) ;
-
obj.add (b, b) ;
-
System.out.println (obj.x + " " + obj.y ) ;
-
}
-
}
a) 6.4 6.4
b) 6 6
c) 4 6.4
d) 6.4 6
View Answer
Answer: c
Explanation: For obj.add(a,a); ,the function in line number 4 gets executed and value of x is 4. For the next function call, the function in line number 7 gets executed and value of y is 6.4
output:
$ javac Overload_methods.java $ java Overload_methods 4 6.4
56. Which of the following is true about servlets?
a) Servlets can use the full functionality of the Java class libraries
b) Servlets execute within the address space of web server, platform independent and uses the functionality of java class libraries
c) Servlets execute within the address space of web server
d) Servlets are platform-independent because they are written in java
View Answer
Answer: b
Explanation: Servlets execute within the address space of a web server. Since it is written in java it is platform independent. The full functionality is available through libraries.
57. What will be the output of the following Java program?
-
class string_class
-
{
-
public static void main( String args[ ] )
-
{
-
String obj = "I LIKE JAVA" ;
-
System.out.println (obj.length ( ) ) ;
-
}
-
}
a) 11
b) 12
c) 10
d) 9
View Answer
Answer: a
Explanation: None.
output:
$ javac string_class.java $ java string_class 11
Chapterwise Multiple Choice Questions on Java Programming
Our 1000+ MCQs focus on all topics of the Java subject, covering 100+ topics. This will help you to prepare for exams, contests, online tests, quizzes, viva-voce, interviews, and certifications. You can practice these MCQs chapter by chapter starting from the 1st chapter or you can jump to any chapter of your choice.
- Java Data Types, Variables and Arrays
- Java Operators and Control Statements
- Java Environment & OOPS Concepts
- Java Classes and Methods
- Java Inheritance
- String Handling in Java
- Exploring java.lang & java.io
- Java Serialization & Networking
- java.util – Collections Framework
- Exception Handling in Java
- Java Multithreading
- Java I/O & Applets
- Java Regular Expressions
- Event Handling in Java
- java.util – More Utility Classes
- Java Interfaces & Packages
- Java Autoboxing
- Generics in Java
- Java Beans & JDBC
- Java Server Technologies & Servlet
- Session Management, JSP & API
- Application Lifecycle & Annotations
1. Java MCQ on Data Types, Variables and Arrays
The section contains Java multiple choice questions and answers on integer, character, floating and boolean data types, variables, type casting and conversions and properties of arrays.
2. Java MCQ on Operators and Control Statements
The section contains Java questions and answers on arithmetic, bitwise, relational, boolean and assignment operators. The section also contains questions on control statements.
3. Multiple Choice Questions on Java Environment & OOPS Concepts
The section contains Java MCQs on oops concepts, jdk, jre, jit and jvm.
4. Java MCQ on Classes and Methods
The section contains Java multiple choice questions and answers on fundamentals of classes, methods basics, heap and garbage collection, object creation, constructors, access control, string class, method overloading and static keyword, command line arguments and recursion.
5. Java MCQ on Inheritance
The section contains Java questions and answers on the concepts of objects, method overriding, inheritance, abstract class and super.
6. Multiple Choice Questions on String Handling in Java
The section contains Java MCQs on the character extraction, string handling functions like stringbuffer class and methods, stringjoiner class and other string comparison functions.
7. MCQ on Exploring java.lang & java.io
The section contains Java multiple choice questions and answers on various concepts of java.lang like data types, types of classes, character and byte streams, builtin exceptions, rounding functions, system class, byte, short, double and float wrappers, character and boolean wrappers and environment properties.
8. Java MCQ on Serialization & Networking
The section contains Java questions and answers on networking basics, server, sockets and httpd class, serialization, deserialization, url class, networking datagrams, htttpresponse and urlconnection class.
9. Multiple Choice Questions on java.util – Collections Framework
The section contains Java MCQs on aspects of java.util like maps, array list, hash set, tree set, linked list, stacks, vectors, dictionary and hash table, rmi, iterators, collection framework overview, collection interface and algorithms.
10. Java MCQ on Exception Handling
The section contains Java multiple choice questions and answers on basics of exception handling, exception types like throw, throws and nested try.
11. Java MCQ on Multithreading
The section contains Java questions and answers on basics of multithreading, thread basics, thread creation, isAlive(), join() and thread synchronization basics.
12. Java MCQ on I/O & Applets
The section contains Java MCQs on applets fundamentals, static import, basics of I/O, file reading and writing and reading console i/p and writing console o/p.
13. Java MCQ on Regular Expressions
The section contains Java multiple choice questions and answers on regular expressions and text formatting.
14. MCQ on Event Handling in Java
The section conatins Java questions and answers on basics of event handling, different types of event handling classes like actionevent, componentevent, containerevent, textevent, mouseevent, windowevent and other event listener interfaces.
15. Multiple Choice Questions on java.util – More Utility Classes
The section contains Java MCQs on locale, random number and classes, timer class, formatter, internationalization, i18n with date, number, currency and time.
16. Multiple Choice Questions on Java Interfaces & Packages
The section contains Java questions and answers on packages, core java api packages, interfaces and its types.
17. Java MCQ on Autoboxing
The section contains Java MCQs on junits, java 8 features, hibernate, file and directory, liskovs principle, aggregration, inference, autoboxing and unboxing.
18. Java MCQ on Generics
The section contains Java multiple choice questions and answers on generics and its methods, wildcards, restrictions and reflecting generics.
19. Multiple Choice Questions on Java Beans & JDBC
The section contains Java questions and answers on java beans, jdbc and design patterns.
20. MCQ on Java Server Technologies & Servlet
The section contains Java MCQs on eclipse debugging, web application, servlet, client and server.
21. Java MCQ on Session Management, JSP & API
The section contains Java multiple choice questions and answers on session management, jsp and its elements, reflection api, autocloseable, closable and flushable interfaces.
22. Java MCQ on Application Lifecycle & Annotations
The section contains Java questions and answers on annotations, application lifecycle like ant, maven and jenkins.
If you would like to learn "Java" thoroughly, you should attempt to work on the complete set of 1000+ MCQs - multiple choice questions and answers mentioned above. It will immensely help anyone trying to crack an exam or an interview.
Wish you the best in your endeavor to learn and master Java!
Important Links:
- C Multiple Choice Questions
- C++ Multiple Choice Questions
- C# Multiple Choice Questions
- Data Structures Multiple Choice Questions
- Junit Multiple Choice Questions
- Spring Multiple Choice Questions
- Python Multiple Choice Questions
- Computer Science Multiple Choice Questions
Source: https://www.sanfoundry.com/java-questions-answers-freshers-experienced/
Posted by: thurmanthurmanalsinge0270789.blogspot.com