Monday, October 1, 2018

300+ Java Programming Interview Questions

Java Programming Interview Questions


Page No:-1

Amazon Books Offer

                      Answer below the page

1. What is Java?
a. Object-oriented
b. Platform independent
c. Robust and
d. Security purpose programming language
e. All of the above   

2.Java was developed by.

a. Blaise Pascal
b. Larry page
c. James Gosling
d. Bill Gates

3.Java programming language is originated from?

a. Oak programming language   
c. Ruby
d. C programming language

4.Java was developed by Which company?

a. Sun Microsystems
b. Microsoft
c. TCS
d. IBM

5.'Javac' command is used for which purpose?

a. debug a java program
b. compile a java program
c. interpret a java program
d. None of the above

6.'Java' command is used for which purpose?

a. interpret a java program
b. Run a java program    
c. debug a java program
d. None of the above

7.Who provides run-time environment to execute java byte code?

a. JVM    
b. JDK
d. JRE

8. Class is a?

a. normal entity
b. Physical entity
c. logical entity
d. None of the above

9.Extension name of Java source code?

a. .java   
b. .exe
c. .class
d. .javac

10. What will be happened if we don't use 'String args[]' in the main method?

a. No error in display
b. Compilation error
c. The program won’t run
d. Program exit

11. Which of the following numerical range is correct for 'char' data type in Java?

a. -128 to 127
b. 0 to 65535 
c. 0 to 32767
d. 0 to 256 

12. The boolean variable contains only?

a. Any char value 
b. 0 & 1
c. True & False  
d. Only true

13. Which keyword is used to invoke the current class object?

a. super.
b. That
c. This
d. None of the above

14. Which operator is used to allocate memory of the array variable in Java?

a. new
b. malloc
c. new malloc
d. alloc.

15. Which of the following are not Java modifiers?

a. public
b. private
c. friendly
d. Protected

16. Abstract class contains only abstract methods?

a. yes
b. No 

17. Can we declare abstract methods as static?

a. yes
b. No 

18.Java does not support?

a. Single inheritance
b. Multilevel inheritance  
c. Multiple inheritance   
d. Hierarchical inheritance

19.Full form of JMS?

a. Java Message Service   
b. Java Monitor Service
c. Java Message Session
d. Java Monitor sequence

20.In java, Object is a?

a. logical entity
b. Physical entity
c. A and B both
d. None of the above

21. Which of the following package is used by the compiler itself?

a. java.applet
b. java.lang   
c. java.math 
d. java.awt

22.Byte code is also a?

a. machine code
b. bit code.
c. compile code.
d. None of the above

23. Which of the following is not true in java?

a. An interface can extend another interface.
b. An interface can implement another interface.  
c. An interface is a solution for multiple inheritances in java.
d. None of Above

24.Compiler What provides after compilation?

a. Assembler language 
b. Machine code  
c. Bit code 
d. Byte code   

25.flush () method belongs in which stream?

a. Input stream
b. Output Stream
c. Reader stream. 
d. Input reader stream

26.In java,ArrayList is a?

a. Non-synchronized. 
b. synchronized.
c. Both a&b
d. None of the above

27. Can you override static methods in Java?

a. Yes.
b. No. program is first ____ and then _____?

a. executed, run
b. run executed
c. compiled, run
d. None of the above

29. File class belongs in which package?

a. package 
b. java.awt package 
c. java.util.package.
d. java.lang package

30. Can you overload the main method?

a. Yes,
b. No

31. Can you override final methods?

a. Yes,
b. No    

32. What is the Thread life cycle?

a. New -> Runnable -> Running -> Non-Runnable (Blocked) -> Terminated.   
b. New -> Running -> Runnable -> Non-Runnable (Blocked) -> Terminated.
c. New -> Runnable -> Running -> Terminated -> Non-Runnable (Blocked) .
d. None of above.

33. Can you Serialize static variables?

a. Yes,
b. No    

34. Which of the following object cannot be modified after it is created?

a. double
b. int
c. string
d. short

35.Full form of RIM in java?

a. Remote Method Invocation
b. Random Memory Interface
c. Remote Memory Interface.
d. Random Method Invocation

36.Local inner class can't access non-final local variable

a. Yes,
b. No

37. Method overloading is one of the ways, Which denotes.

a. polymorphism
b. Abstraction
c. inheritance
d. encapsulation 

38. Which of the following is the wrapper class?

a. Super.
b. Byte
c. Vector
d. this

39. Which of the following is a super-class of all exception classes?

a. RuntimeException 
b. Exception
c. Throwable
d. IOException

40.XML attribute values must always be enclosed in quotes.

a. Yes,
b. NO

41. Who implies 'IS-A' relationship?

a. Inheritance
b. Aggregation
c. Polymorphism
d. Encapsulation

42.Full form of HQL?

a. Hibernate Queue Language
b. Hierarchical Query Language
c. Hiper Query Language
d. None of the above

43. Which member is accessible from anywhere of the program? 

a. private
b. public
c. protected
d. None of the above

44. Which mechanism is used to handle the run time errors, that's why the application can normally run. 

a. Event Handling
b. String Handling
c. Exception Handling
d. None of the above

45. Can we override private methods in java?

a. Yes,
b. No    

46. A package is a collection of.

a. classes and interfaces
b. editing tools
c. interfaces
d. objects

47. UN-reference object means Garbage Collection.

a. True
b. False

48. Which of the following variable declaration would NOT compile in a java program?

a. int var; 
b. int VAR; 
c. int var1; 
d. int 1_var;  

49. A constructor is invoked at the time of object creation.

a. Yes,
b. NO

50. Which of the following Boolean declaration is correct?

a. boolean b = 0;
b. boolean b = ‘false’;
c. boolean b = false;  
d. None of the above

Amazon Books Offer

[  Ans:- 1.e   2.c   3.a   4.a   5.b   6.b   7.a   8.c   9.a   10.c   11.b   12.c   13.c   14.a   15.c   16.b   17.b   18.c   19.a   20.c   21.b   22.a   23.b   24.d   25.b   26.a   27.b   28.c   29.a   30.a   31.b   32.a   33.b   34.c   35.a   36.a   37.a   38.b   39.c   40.a   41.a   42.a   43.b   44.c   45.b   46.a   47.a   48.d   49.a   50.c  ] 
Disqus Comments