Java MCQ Questions with Answers pdf
Hello friends in this article you can find your query related to Java mcq questions with answers pdf, core java mcq questions and answers pdf, java programming questions pdf, java coding questions and answers pdf, java interview questions pdf,
Java interview questions and answers pdf, java mcq questions for interview, java interview questions for freshers, java programming question paper pdf, java viva questions and answers pdf, java questions for practice, java questions asked in interview
Java Interview Questions and Answers pdf
Core java mcq questions and answers pdf, java programming questions pdf, java coding questions and answers pdf, java interview questions pdf, java questions and answers, java questions for freshers, core java mcq pdf
Core Java MCQ Questions and Answers pdf
1. Who is known as father of Java Programming Language?
рдЬрд╛рд╡рд╛ рдкреНрд░реЛрдЧреНрд░рд╛рдорд┐рдВрдЧ рд▓реИрдВрдЧреНрд╡реЗрдЬ рдХреЗ рдкрд┐рддрд╛ рдХреЗ рд░реВрдк рдореЗрдВ рдХрд┐рд╕реЗ рдЬрд╛рдирд╛ рдЬрд╛рддрд╛ рд╣реИ?
- James Gosling
- Charel Babbage
- P Java
- Blais Pascal
2. What is the size of float and double in java?
рдЬрд╛рд╡рд╛ рдореЗрдВ рдлреНрд▓реЛрдЯ рдФрд░ рдбрдмрд▓ рдХрд╛ рдЖрдХрд╛рд░ рдХреНрдпрд╛ рд╣реИ?
- 32 and 64
- 64 and 32
- 64 and 64
- 32 and 32
3. Number of primitive data types in Java is?
рдЬрд╛рд╡рд╛ рдореЗрдВ primitive data рдкреНрд░рдХрд╛рд░реЛрдВ рдХреА рд╕рдВрдЦреНрдпрд╛ рд╣реИ?
- 6
- 7
- 8
- 9
4. Automatic type conversion is possible in which of the possible cases?
рд╕рдВрднрд╛рд╡рд┐рдд рдорд╛рдорд▓реЛрдВ рдореЗрдВ рд╕реЗ рдХрд┐рд╕рдореЗрдВ рд╕реНрд╡рдЪрд╛рд▓рд┐рдд рдкреНрд░рдХрд╛рд░ рдХрд╛ рд░реВрдкрд╛рдВрддрд░рдг рд╕рдВрднрд╡ рд╣реИ?
- Byte to int
- Int to long
- Long to int
- Short to int
5. Select the valid statement.
рдорд╛рдиреНрдп рдХрдерди рдХрд╛ рдЪрдпрди рдХрд░реЗрдВред
- char[] ch = new char()
- char[] ch = new char[5]
- char[] ch = new char(5)
- char[] ch = new char[]
6. Select the valid statement to declare and initialize an array.
Array рдШреЛрд╖рд┐рдд рдХрд░рдиреЗ рдФрд░ рдЖрд░рдВрдн рдХрд░рдиреЗ рдХреЗ рд▓рд┐рдП рдорд╛рдиреНрдп рдХрдерди рдХрд╛ рдЪрдпрди рдХрд░реЗрдВред
- int[] A = (1, 2, 3)
- int[] A = {1, 2, 3}
- int[] A = {}
- int[][] A = {1,2,3}
7. When an array is passed to a method, what does the method receive?
рдЬрдм рдХрд┐рд╕реА method рдХреЛ рдПрдХ array рдкрд╛рд╕ рдХреА рдЬрд╛рддреА рд╣реИ, рддреЛ method рдХреЛ рдХреНрдпрд╛ рдкреНрд░рд╛рдкреНрдд рд╣реЛрддрд╛ рд╣реИ?
- The reference of the array
- Copy of first element
- Length of the array
- A copy of the array
8. Arrays in java are-
рдЬрд╛рд╡рд╛ рдореЗрдВ Array рд╣реИрдВ-
- Primitive data type
- Objects
- Object references
- None
9. Identify the corrected definition of a package.
рдкреИрдХреЗрдЬ рдХреА рд╕рд╣реА рдкрд░рд┐рднрд╛рд╖рд╛ рдХреЛ рдкрд╣рдЪрд╛рдиреЗрдВред
- A package is a collection of editing tools
- A package is a collection of interfaces
- A package is a collection of classes and interfaces
- A package is a collection of classes
10. When is the object created with new keyword?
рдирдП рдХреАрд╡рд░реНрдб рдХреЗ рд╕рд╛рде рдСрдмреНрдЬреЗрдХреНрдЯ рдХрдм рдмрдирд╛рдпрд╛ рдЬрд╛рддрд╛ рд╣реИ?
- At run time
- Depends on the code
- At compile time
- None
Java MCQ Questions with Answers pdf
11. Identify the correct restriction on static methods.
рд╕реНрдерд┐рд░ рд╡рд┐рдзрд┐рдпреЛрдВ рдкрд░ рд╕рд╣реА рдкреНрд░рддрд┐рдмрдВрдз рдХреА рдкрд╣рдЪрд╛рди рдХрд░реЗрдВред
- They must access only static data
- They can only call other static methods.
- They cannot refer to this or super.
- I and II
- II and III
- Only III
- I, II and III
12. In which of the following is toString() method defined?
рдирд┐рдореНрдирд▓рд┐рдЦрд┐рдд рдореЗрдВ рд╕реЗ рдХрд┐рд╕рдореЗрдВ toString () рд╡рд┐рдзрд┐ рдкрд░рд┐рднрд╛рд╖рд┐рдд рд╣реИ?
- lang.Object
- lang.util
- lang.String
- None
13. Identify the keyword among the following that makes a variable belong to a class, rather than being defined for each instance of the class.
рдирд┐рдореНрдирд▓рд┐рдЦрд┐рдд рдореЗрдВ рд╕реЗ рдЙрд╕ рдХреАрд╡рд░реНрдб рдХреА рдкрд╣рдЪрд╛рди рдХрд░реЗрдВ рдЬреЛ рдПрдХ рдЪрд░ рдХреЛ рд╡рд░реНрдЧ рд╕реЗ рд╕рдВрдмрдВрдзрд┐рдд рдмрдирд╛рддрд╛ рд╣реИ, рди рдХрд┐ рд╡рд░реНрдЧ рдХреЗ рдкреНрд░рддреНрдпреЗрдХ рдЙрджрд╛рд╣рд░рдг рдХреЗ рд▓рд┐рдП рдкрд░рд┐рднрд╛рд╖рд┐рдд рдХрд┐рдпрд╛ рдЬрд╛рддрд╛ рд╣реИред
- Volatile
- Static
- Final
- Abstract
14. compareTo() returns
compareTo() рд░рд┐рдЯрд░реНрди
- True
- False
- An int value
- None
15. What does the following string do to given string str1.
рджрд┐рдП рдЧрдП рд╕реНрдЯреНрд░рд┐рдВрдЧ str1 рдХреЗ рд▓рд┐рдП рдирд┐рдореНрди рд╕реНрдЯреНрд░рд┐рдВрдЧ рдХреНрдпрд╛ рдХрд░рддреА рд╣реИред
String str1 = тАЬInterviewbitтАЭ.replace(тАШeтАЩ,тАЩsтАЩ);
- Replaces single occurrence of тАШsтАЩ to тАШeтАЩ.
- Replaces all occurrences of тАШeтАЩ to тАШsтАЩ.
- Replaces single occurrence of тАШeтАЩ to тАШsтАЩ.
- None
16. Identify the output of the following program.
рдирд┐рдореНрдирд▓рд┐рдЦрд┐рдд рдкреНрд░реЛрдЧреНрд░рд╛рдо рдХреЗ рдЖрдЙрдЯрдкреБрдЯ рдХреЛ рдкрд╣рдЪрд╛рдиреЗрдВред
String str = тАЬabcdeтАЭ;
System.out.println(str.substring(1, 3));
- bcd
- bc
- Abc
- cd
17. To which of the following does the class string belong to.
Class рд╕реНрдЯреНрд░рд┐рдВрдЧ рдирд┐рдореНрди рдореЗрдВ рд╕реЗ рдХрд┐рд╕рд╕реЗ рд╕рдВрдмрдВрдзрд┐рдд рд╣реИред
- java.lang
- java.applet
- java.awt
- java.string
18. Identify the return type of a method that does not return any value.
рдПрдХ method рдХреЗ return рдкреНрд░рдХрд╛рд░ рдХреА рдкрд╣рдЪрд╛рди рдХрд░реЗрдВ рдЬреЛ рдХреЛрдИ рдорд╛рди рдирд╣реАрдВ рд▓реМрдЯрд╛рддрд╛ рд╣реИред
- double
- void
- Int
- None
19. Total constructor string class have?
рдХреБрд▓ рдХрдВрд╕реНрдЯреНрд░рдХреНрдЯрд░ рд╕реНрдЯреНрд░рд┐рдВрдЧ рдХреНрд▓рд╛рд╕ рд╣реИ?
- 3
- 7
- 13
- 20
20. Output of Math.floor(3.6)?
Math.floor(3.6) рдХрд╛ рдЖрдЙрдЯрдкреБрдЯ?
- 3
- 3.0
- 4
- 0
Java MCQ Questions with Answers pdf
21. Identify the modifier which cannot be used for constructor.
рдЙрд╕ modifier рдХреА рдкрд╣рдЪрд╛рди рдХрд░реЗрдВ рдЬрд┐рд╕рдХрд╛ рдЙрдкрдпреЛрдЧ рдХрдВрд╕реНрдЯреНрд░рдХреНрдЯрд░ рдХреЗ рд▓рд┐рдП рдирд╣реАрдВ рдХрд┐рдпрд╛ рдЬрд╛ рд╕рдХрддрд╛ рд╣реИред
- private
- protected
- public
- static
22. Where does the system stores parameters and local variables whenever a method is invoked?
рдЬрдм рднреА рдХреЛрдИ рд╡рд┐рдзрд┐ рд▓рд╛рдЧреВ рдХреА рдЬрд╛рддреА рд╣реИ рддреЛ рд╕рд┐рд╕реНрдЯрдо рдкреИрд░рд╛рдореАрдЯрд░ рдФрд░ рд╕реНрдерд╛рдиреАрдп рдЪрд░ рдХрд╣рд╛рдБ рд╕рдВрдЧреНрд░рд╣реАрдд рдХрд░рддрд╛ рд╣реИ?
- Array
- Stack
- Heap
- Tree
23. What is the variables declared in a class for the use of all methods of the class called?
Class рдХреЗ рд╕рднреА рддрд░реАрдХреЛрдВ рдХреЗ рдЙрдкрдпреЛрдЧ рдХреЗ рд▓рд┐рдП class рдореЗрдВ рдШреЛрд╖рд┐рдд variables рдХреНрдпрд╛ рдХрд╣рд▓рд╛рддреЗ рд╣реИрдВ?
- Reference variable
- Instance variables
- Object
- None
24. When is the finalize() method called?
finalize() method рдХреЛ рдХрдм call рдХрд┐рдпрд╛ рдЬрд╛рддрд╛ рд╣реИ?
- Before garbage collection
- Before a variable goes out of scope
- Before an object goes out of scope
- None
25. What is the implicit return type of constructor?
рдХрдВрд╕реНрдЯреНрд░рдХреНрдЯрд░ рдХрд╛ рдирд┐рд╣рд┐рдд рд░рд┐рдЯрд░реНрди рдкреНрд░рдХрд╛рд░ рдХреНрдпрд╛ рд╣реИ?
- void
- A class object in which it is defined
- No return type
- None
26. Identify the prototype of the default constructor.
рдбрд┐рдлрд╝реЙрд▓реНрдЯ рдХрдВрд╕реНрдЯреНрд░рдХреНрдЯрд░ рдХреЗ рдкреНрд░реЛрдЯреЛрдЯрд╛рдЗрдк рдХреА рдкрд╣рдЪрд╛рди рдХрд░реЗрдВред
Public class Solution {}
- public Solution(void)
- Solution()
- Solution(void)
- public Solution()
27. Identify the infinite loop.
рдЕрдирдВрдд рд▓реВрдк рдХреЛ рдкрд╣рдЪрд╛рдиреЗрдВред
- for(int i = 0; ;i++)
- for(int i = 0; i < 1; i–)
- for(; ; )
- All of the above
28. Identify the correct way of declaring constructor.
рдХрдВрд╕реНрдЯреНрд░рдХреНрдЯрд░ рдШреЛрд╖рд┐рдд рдХрд░рдиреЗ рдХрд╛ рд╕рд╣реА рддрд░реАрдХрд╛ рдкрд╣рдЪрд╛рдиреЗрдВред
Public class Solution {}
- Solution(void){}
- public Solution(){}
- Solution(){}
- Both (A) and (B)
29. What is Runnable?
рд░рдирдиреЗрдмрд▓ рдХреНрдпрд╛ рд╣реИ?
- Class
- Interface
- Abstract class
- Method
30. Which of the following exception is thrown when divided by zero statement is executed?
рдирд┐рдореНрдирд▓рд┐рдЦрд┐рдд рдореЗрдВ рд╕реЗ рдХреМрди рд╕рд╛ exception рддрдм рдлреЗрдВрдХрд╛ рдЬрд╛рддрд╛ рд╣реИ рдЬрдм divided by zero рдХрдерди execute рдХрд┐рдпрд╛ рдЬрд╛рддрд╛ рд╣реИ?
- NumberFormatException
- NullPointerException
- ArithmeticException
- None
Java MCQ Questions with Answers pdf
31. Excepted created by try block is caught in which block.
рдЯреНрд░рд╛рдИ рдмреНрд▓реЙрдХ рджреНрд╡рд╛рд░рд╛ рдмрдирд╛рдпрд╛ рдЧрдпрд╛ “рдПрдХреНрд╕реЗрдкреНрдЯреЗрдб” рдХрд┐рд╕ рдмреНрд▓реЙрдХ рдореЗрдВ рдкрдХрдбрд╝рд╛ рдЬрд╛рддрд╛ рд╣реИред
- catch
- final
- throw
- none
32. Where is System class defined?
рд╕рд┐рд╕реНрдЯрдо рдХреНрд▓рд╛рд╕ рдХреЛ рдХрд╣рд╛рдВ рдкрд░рд┐рднрд╛рд╖рд┐рдд рдХрд┐рдпрд╛ рдЧрдпрд╛ рд╣реИ?
- java.lang.package
- java.io.package
- java.util.package
- None
33. Which of the following statements are true about finalize() method?
Finalize() method рдХреЗ рдмрд╛рд░реЗ рдореЗрдВ рдирд┐рдореНрдирд▓рд┐рдЦрд┐рдд рдореЗрдВ рд╕реЗ рдХреМрди рд╕рд╛ рдХрдерди рд╕рддреНрдп рд╣реИ?
- It can be called Zero or one times
- It can be called Exactly once
- It can be called Zero or more times
- It can be called One or more times
34. Identify the interface which is used to declare core methods in java?
рдЙрд╕ рдЗрдВрдЯрд░рдлрд╝реЗрд╕ рдХреА рдкрд╣рдЪрд╛рди рдХрд░реЗрдВ рдЬрд┐рд╕рдХрд╛ рдЙрдкрдпреЛрдЧ рдЬрд╛рд╡рд╛ рдореЗрдВ рдореБрдЦреНрдп рд╡рд┐рдзрд┐рдпреЛрдВ рдХреЛ рдШреЛрд╖рд┐рдд рдХрд░рдиреЗ рдХреЗ рд▓рд┐рдП рдХрд┐рдпрд╛ рдЬрд╛рддрд╛ рд╣реИ?
- Set
- EventListener
- Comparator
- Collection
35. What does the operator >>>> do?
рдСрдкрд░реЗрдЯрд░ >>>> рдХреНрдпрд╛ рдХрд░рддрд╛ рд╣реИ?
- Zero fill left shift
- Left shift operator
- Right shift operator
- Zero fill right shift
36. Which of the following is used to find and fix bugs in the program?
рдкреНрд░реЛрдЧреНрд░рд╛рдо рдореЗрдВ рдмрдЧ рдХреЛ рдЦреЛрдЬрдиреЗ рдФрд░ рдареАрдХ рдХрд░рдиреЗ рдХреЗ рд▓рд┐рдП рдирд┐рдореНрди рдореЗрдВ рд╕реЗ рдХрд┐рд╕рдХрд╛ рдЙрдкрдпреЛрдЧ рдХрд┐рдпрд╛ рдЬрд╛рддрд╛ рд╣реИ?
- JVM
- JRE
- JDK
- JDB
37. Identify the incorrect Java feature.
рдЧрд▓рдд рдЬрд╛рд╡рд╛ feature рдХреА рдкрд╣рдЪрд╛рди рдХрд░реЗрдВред
- Dynamic
- Use of pointers
- Object oriented
- Architectural neural
38. Which of these components are used in a Java program for compilation, debugging, and execution?
рдЬрд╛рд╡рд╛ рдкреНрд░реЛрдЧреНрд░рд╛рдо рдореЗрдВ compilation, debugging рдФрд░ execution рдХреЗ рд▓рд┐рдП рдЗрдирдореЗрдВ рд╕реЗ рдХреМрди рд╕реЗ рдШрдЯрдХ рдХрд╛ рдЙрдкрдпреЛрдЧ рдХрд┐рдпрд╛ рдЬрд╛рддрд╛ рд╣реИ?
- JDK
- JRE
- JVM
- JIT
┬а
39. What is BigDecimal.ONE?
BigDecimal.ONE рдХреНрдпрд╛ рд╣реИ?
- it is a custom-defined statement
- it is a wrong statement
- it is a static variable that has a value of 1 on a scale of 0
- it is a static variable that has a value of 1 on a scale of 10
┬а
40. Which of these literals can be contained in a float data type variable?
рдЗрдирдореЗрдВ рд╕реЗ рдХреМрди рд╕рд╛ рдЕрдХреНрд╖рд░ рдПрдХ рдлреНрд▓реЛрдЯ рдбреЗрдЯрд╛ рдкреНрд░рдХрд╛рд░ рдЪрд░ рдореЗрдВ рд╕рдорд╛рд╣рд┐рдд рдХрд┐рдпрд╛ рдЬрд╛ рд╕рдХрддрд╛ рд╣реИ?
- -3.4e+050
- -1.7e+308
- -3.4e+038
- +1.7e+308
Java MCQ Questions with Answers pdf
41. When an expression consists of int, double, long, float, then the entire expression will get promoted into a data type that is:
рдЬрдм рдПрдХ рдПрдХреНрд╕рдкреНрд░реЗрд╢рди рдореЗрдВ int, double, long, float рд╣реЛрддрд╛ рд╣реИ, рддреЛ рдкреВрд░реЗ рдПрдХреНрд╕рдкреНрд░реЗрд╢рди рдХреЛ рдбреЗрдЯрд╛ рдЯрд╛рдЗрдк рдореЗрдВ promote рдХрд┐рдпрд╛ рдЬрд╛рдПрдЧрд╛ рдЬреЛ рд╣реИ:
- int
- double
- float
- long
┬а
42. Out of these statements, which ones are incorrect?
рдЗрди рдХрдердиреЛрдВ рдореЗрдВ рд╕реЗ рдХреМрди-рд╕реЗ рдХрдерди рдЧрд▓рдд рд╣реИрдВ?
- The addition operator + and the subtraction operator тАУ have an equal precedence
- The equal to = operator has the lowest precedence
- The Brackets () have the highest precedence
- The division operator / has comparatively higher precedence as compared to a multiplication operator
┬а
43. Which of the following operators can operate on a boolean variable?
рдирд┐рдореНрдирд▓рд┐рдЦрд┐рдд рдореЗрдВ рд╕реЗ рдХреМрди рд╕рд╛ рдСрдкрд░реЗрдЯрд░ рдмреВрд▓рд┐рдпрди рд╡реИрд░рд┐рдПрдмрд▓ рдкрд░ рдХрд╛рдо рдХрд░ рд╕рдХрддрд╛ рд╣реИ?
A. &&
B. ==
C. ?:
D. +=
- C & B
- A & D
- A, B & D
- A, B & C
44. What will be the output of the following Java code snippet?
рдирд┐рдореНрдирд▓рд┐рдЦрд┐рдд рдЬрд╛рд╡рд╛ рдХреЛрдб рд╕реНрдирд┐рдкреЗрдЯ рдХрд╛ рдЖрдЙрдЯрдкреБрдЯ рдХреНрдпрд╛ рд╣реЛрдЧрд╛?
class P
{
}
enum Enums extends P
{
PQR, QRS, RST, STU;
}
- Compilation Error
- It runs successfully
- EnumNotDefined Exception
- Runtime Error
┬а
45. What is it called when the child object also gets killed when the parent object is killed in the program?
рдкреНрд░реЛрдЧреНрд░рд╛рдо рдореЗрдВ рдкреИрд░реЗрдВрдЯ рдСрдмреНрдЬреЗрдХреНрдЯ рдХреЗ рдорд╛рд░реЗ рдЬрд╛рдиреЗ рдкрд░ рдЪрд╛рдЗрд▓реНрдб рдСрдмреНрдЬреЗрдХреНрдЯ рднреА рдорд╛рд░реЗ рдЬрд╛рдиреЗ рдкрд░ рдЗрд╕реЗ рдХреНрдпрд╛ рдХрд╣рд╛ рдЬрд╛рддрд╛ рд╣реИ?
- Aggregation
- Association
- Encapsulation
- Composition
46. When does Overloading not occur?
рдУрд╡рд░рд▓реЛрдбрд┐рдВрдЧ рдХрдм рдирд╣реАрдВ рд╣реЛрддреА рд╣реИ?
- When more than a single method have the same name, yet different types or number of parameters and different method signature
- When more than a single method have the same signature, same name, and the same number of parameters have different types
- When more than a single method have the same name, the same signature, but have different numbers of signature
- When more than a single method have the same name, the same number and types of parameters, and yet different signatures
┬а
47. How does one identify if a compilation unit is an interface or class from a .class file?
рдПрдХ .class рдлрд╝рд╛рдЗрд▓ рд╕реЗ рдПрдХ рд╕рдВрдХрд▓рди рдЗрдХрд╛рдИ рдПрдХ рдЗрдВрдЯрд░рдлрд╝реЗрд╕ рдпрд╛ рд╡рд░реНрдЧ рд╣реИ рдпрд╛ рдирд╣реАрдВ, рдЗрд╕рдХреА рдкрд╣рдЪрд╛рди рдХреИрд╕реЗ рдХреА рдЬрд╛рддреА рд╣реИ?
- Extension of the compilation unit
- Java source file header
- The class and interface cannot be differentiated
- The unit type must be used to postfix interface or class name
48. What would happen to the thread whenever the garbage collection kicks off?
рдЬрдм рднреА garbage collection рд╢реБрд░реВ рд╣реЛрддрд╛ рд╣реИ рддреЛ thread рдХрд╛ рдХреНрдпрд╛ рд╣реЛрдЧрд╛?
- The garbage collection and the thread donтАЩt interfere with each other
- The thread would continue its operation
- The garbage collection wonтАЩt happen until the running of the thread
- The thread would be paused while the running of the garbage collection
┬а
49. Out of these methods of the String class, which one can be used for testing the strings for equality?
рд╕реНрдЯреНрд░рд┐рдВрдЧ рдХреНрд▓рд╛рд╕ рдХреА рдЗрди рд╡рд┐рдзрд┐рдпреЛрдВ рдореЗрдВ рд╕реЗ, рд╕рдорд╛рдирддрд╛ рдХреЗ рд▓рд┐рдП рд╕реНрдЯреНрд░рд┐рдВрдЧреНрд╕ рдХреЗ рдкрд░реАрдХреНрд╖рдг рдХреЗ рд▓рд┐рдП рдХрд┐рд╕рдХрд╛ рдЙрдкрдпреЛрдЧ рдХрд┐рдпрд╛ рдЬрд╛ рд╕рдХрддрд╛ рд╣реИ?
- isequals()
- equal()
- equals()
- isequal()
50. Out of these, which one is the correct way of calling a constructor that has no parameters of the superclass A by the subclass B?
рдЗрдирдореЗрдВ рд╕реЗ рдХреМрди рд╕рд╛ рдПрдХ рдРрд╕реЗ рдХрдВрд╕реНрдЯреНрд░рдХреНрдЯрд░ рдХреЛ рдХреЙрд▓ рдХрд░рдиреЗ рдХрд╛ рд╕рд╣реА рддрд░реАрдХрд╛ рд╣реИ рдЬрд┐рд╕рдореЗрдВ рдЙрдкрд╡рд░реНрдЧ B рджреНрд╡рд╛рд░рд╛ рд╕реБрдкрд░рдХреНрд▓рд╛рд╕ A рдХрд╛ рдХреЛрдИ рдкреИрд░рд╛рдореАрдЯрд░ рдирд╣реАрдВ рд╣реИ?
- super(void);
- superA();
- super();
- superclass();
Also Read: Java MCQ Questions and Answers pdf in Hindi English
51. Out of these packages, which one contains an abstract keyword?
рдЗрди рдкреИрдХреЗрдЬреЛрдВ рдореЗрдВ рд╕реЗ рдХрд┐рд╕рдореЗрдВ рдПрдХ рдЕрдореВрд░реНрдд рдХреАрд╡рд░реНрдб рд╣реИ?
- java.system
- java.lang
- java.util
- java.io
52. Out of these methods of the Object class, which one can clone an object?
рдСрдмреНрдЬреЗрдХреНрдЯ рдХреНрд▓рд╛рд╕ рдХреЗ рдЗрди рддрд░реАрдХреЛрдВ рдореЗрдВ рд╕реЗ рдХреМрди рдХрд┐рд╕реА рдСрдмреНрдЬреЗрдХреНрдЯ рдХреЛ рдХреНрд▓реЛрди рдХрд░ рд╕рдХрддрд╛ рд╣реИ?
- Object clone()
- copy()
- Object copy()
- clone()
53. Out of these methods, which one can be used for converting all the characters present in a String into an Array of characters?
рдЗрди рд╡рд┐рдзрд┐рдпреЛрдВ рдореЗрдВ рд╕реЗ рдХрд┐рд╕рдХрд╛ рдЙрдкрдпреЛрдЧ рд╕реНрдЯреНрд░рд┐рдВрдЧ рдореЗрдВ рдореМрдЬреВрдж рд╕рднреА рд╡рд░реНрдгреЛрдВ рдХреЛ рд╡рд░реНрдгреЛрдВ рдХреА рдПрдХ рд╕рд░рдгреА рдореЗрдВ рдкрд░рд┐рд╡рд░реНрддрд┐рдд рдХрд░рдиреЗ рдХреЗ рд▓рд┐рдП рдХрд┐рдпрд╛ рдЬрд╛ рд╕рдХрддрд╛ рд╣реИ?
- both getChars() & toCharArray()
- charAt()
- both charAt() & getChars()
- all of the mentioned
┬а
54. Out of these exceptions, which one is thrown by the compareTo() method that is defined in a double wrapper?
рдЗрди exceptions рдореЗрдВ рд╕реЗ, рдХреМрди рд╕рд╛ рдПрдХ double wrapper рдореЗрдВ рдкрд░рд┐рднрд╛рд╖рд┐рдд compareTo() method рджреНрд╡рд╛рд░рд╛ рдлреЗрдВрдХрд╛ рдЧрдпрд╛ рд╣реИ?
- IOException
- ClassCastException
- SystemException
- CastException
┬а
55. What value is returned by the compareTo() function in case the invoking string happens to be greater than the compared string?
рдпрджрд┐ рдЗрдирд╡реЛрдХрд┐рдВрдЧ рд╕реНрдЯреНрд░рд┐рдВрдЧ, рддреБрд▓рдирд╛ рдХреА рдЧрдИ рд╕реНрдЯреНрд░рд┐рдВрдЧ рд╕реЗ рдЕрдзрд┐рдХ рд╣реЛрддреА рд╣реИ, рддреЛ рддреБрд▓рдирд╛ рдХрд░рдиреЗ рдХреЗ рд▓рд┐рдП () рдлрд╝рдВрдХреНрд╢рди рджреНрд╡рд╛рд░рд╛ рдХреНрдпрд╛ рдорд╛рди рд▓реМрдЯрд╛рдпрд╛ рдЬрд╛рддрд╛ рд╣реИ?
- zero
- a value that is less than zero
- a value that is greater than zero
- none of the above
56. Where does the String Pool get stored?
рд╕реНрдЯреНрд░рд┐рдВрдЧ рдкреВрд▓ рдХрд╣рд╛рдБ рд╕рдВрдЧреНрд░рд╣реАрдд рдХрд┐рдпрд╛ рдЬрд╛рддрд╛ рд╣реИ?
- Metaspace
- Permanent Generation
- Java Heap
- Java Stack
57. Out of these methods, which one makes the raw MIME formatted string?
рдЗрди рд╡рд┐рдзрд┐рдпреЛрдВ рдореЗрдВ рд╕реЗ рдХреМрди raw MIME рд╕реНрд╡рд░реВрдкрд┐рдд рд╕реНрдЯреНрд░рд┐рдВрдЧ рдмрдирд╛рддрд╛ рд╣реИ?
- toString()
- parseString()
- parse()
- getString()
58. Out of these data members of the HttpResponse class, which one is used for the storage of the response that is from an http server?
HttpResponse рд╡рд░реНрдЧ рдХреЗ рдЗрди рдбреЗрдЯрд╛ рд╕рджрд╕реНрдпреЛрдВ рдореЗрдВ рд╕реЗ рдХрд┐рд╕рдХрд╛ рдЙрдкрдпреЛрдЧ http рд╕рд░реНрд╡рд░ рд╕реЗ рдкреНрд░рд╛рдкреНрдд рдкреНрд░рддрд┐рдХреНрд░рд┐рдпрд╛ рдХреЗ рднрдВрдбрд╛рд░рдг рдХреЗ рд▓рд┐рдП рдХрд┐рдпрд╛ рдЬрд╛рддрд╛ рд╣реИ?
- address
- statusResponse
- statusCode
- status
59. The remover() method throws which of these exceptions:
рд░рд┐рдореВрд╡рд░ () рд╡рд┐рдзрд┐ рдЗрдирдореЗрдВ рд╕реЗ рдХреМрди рд╕рд╛ рдЕрдкрд╡рд╛рдж рдлреЗрдВрдХрддрд╛ рд╣реИ:
- IOException
- IllegalStateException
- ObjectNotFoundException
- SystemException
60. What happens when we call two threads that have the same priority to process simultaneously?
рдХреНрдпрд╛ рд╣реЛрддрд╛ рд╣реИ рдЬрдм рд╣рдо рджреЛ рдереНрд░реЗрдбреНрд╕ рдХреЛ рдХреЙрд▓ рдХрд░рддреЗ рд╣реИрдВ рдЬрд┐рдирдХреА рдПрдХ рд╕рд╛рде рдкреНрд░реЛрд╕реЗрд╕ рдХрд░рдиреЗ рдХреА рдкреНрд░рд╛рдердорд┐рдХрддрд╛ рд╕рдорд╛рди рд╣реЛрддреА рд╣реИ?
- Both of the threads will be simultaneouslyexecuted
- There will be no execution of threads
- Itdepends on the OS
- Any one of the threads can be executed first lexicographically
Java MCQ Questions with Answers pdf
61. Out of the following, which one is a superclass of all the exception type classes?
рдирд┐рдореНрдирд▓рд┐рдЦрд┐рдд рдореЗрдВ рд╕реЗ рдХреМрди-рд╕рд╛ рдПрдХ рдЕрдкрд╡рд╛рдж рдкреНрд░рдХрд╛рд░ рдХреЗ рд╕рднреА рд╡рд░реНрдЧреЛрдВ рдХрд╛ рд╕реБрдкрд░рдХреНрд▓рд╛рд╕ рд╣реИ?
- String
- Catchable
- RuntimeExceptions
- Throwable
62. Out of these classes, which one is used for reading strings and characters in Java from the console?
рдЗрди classes рдореЗрдВ рд╕реЗ рдХрд┐рд╕рдХрд╛ рдЙрдкрдпреЛрдЧ рдЬрд╛рд╡рд╛ рдореЗрдВ рдХрдВрд╕реЛрд▓ рд╕реЗ рд╕реНрдЯреНрд░рд┐рдВрдЧреНрд╕ рдФрд░ рдХреИрд░реЗрдХреНрдЯрд░ рдкрдврд╝рдиреЗ рдХреЗ рд▓рд┐рдП рдХрд┐рдпрд╛ рдЬрд╛рддрд╛ рд╣реИ?
- InputStreamReader
- BufferedReader
- StringReader
- BufferedStreamReader
63. Out of these classes, which one allows a user to define their own formatting pattern for time and dates?
рдЗрди рд╡рд░реНрдЧреЛрдВ рдореЗрдВ рд╕реЗ рдХреМрди рд╕рд╛ рдПрдХ рдЙрдкрдпреЛрдЧрдХрд░реНрддрд╛ рдХреЛ рд╕рдордп рдФрд░ рддрд┐рдерд┐рдпреЛрдВ рдХреЗ рд▓рд┐рдП рдЕрдкрдиреЗ рд╕реНрд╡рдпрдВ рдХреЗ рд╕реНрд╡рд░реВрдкрдг рдкреИрдЯрд░реНрди рдХреЛ рдкрд░рд┐рднрд╛рд╖рд┐рдд рдХрд░рдиреЗ рдХреА рдЕрдиреБрдорддрд┐ рджреЗрддрд╛ рд╣реИ?
- UsersDateFormat
- ComplexDateFormat
- SimpleDateFormat
- DefinedDateFormat
64. Out of these operators, which one can be used to get the run time info about an object?
рдЗрди рдСрдкрд░реЗрдЯрд░реЛрдВ рдореЗрдВ рд╕реЗ, рдХрд┐рд╕реА рд╡рд╕реНрддреБ рдХреЗ рдмрд╛рд░реЗ рдореЗрдВ рд░рди рдЯрд╛рдЗрдо рдХреА рдЬрд╛рдирдХрд╛рд░реА рдкреНрд░рд╛рдкреНрдд рдХрд░рдиреЗ рдХреЗ рд▓рд┐рдП рдХрд┐рд╕рдХрд╛ рдЙрдкрдпреЛрдЧ рдХрд┐рдпрд╛ рдЬрд╛ рд╕рдХрддрд╛ рд╣реИ?
- getinfoof
- getInfo
- Info
- instanceof
65. Which method can we use in an applet to output a string?
рдПрдХ рд╕реНрдЯреНрд░рд┐рдВрдЧ рдХреЛ рдЖрдЙрдЯрдкреБрдЯ рдХрд░рдиреЗ рдХреЗ рд▓рд┐рдП рд╣рдо рдПрдкреНрд▓реЗрдЯ рдореЗрдВ рдХрд┐рд╕ рд╡рд┐рдзрд┐ рдХрд╛ рдЙрдкрдпреЛрдЧ рдХрд░ рд╕рдХрддреЗ рд╣реИрдВ?
- transient()
- drawString()
- display()
- print()
66. Which one is a superclass of the ContainerEvent class out of the following?
рдирд┐рдореНрдирд▓рд┐рдЦрд┐рдд рдореЗрдВ рд╕реЗ рдХреМрди рд╕рд╛ рдХрдВрдЯреЗрдирд░рдПрд╡реЗрдВрдЯ рдХреНрд▓рд╛рд╕ рдХрд╛ рд╕реБрдкрд░рдХреНрд▓рд╛рд╕ рд╣реИ?
- ComponentEvent
- ItemEvent
- InputEvent
- WindowEvent
67. The public int start() returns what?
рд╕рд╛рд░реНрд╡рдЬрдирд┐рдХ int start() рдХреНрдпрд╛ рд▓реМрдЯрд╛рддрд╛ рд╣реИ?
- the start index of the previous match
- the start index of the input string
- the start index of the current match
- None of the above
68. _______ is a superclass of all the Adapter classes.
_______ рд╕рднреА рдПрдбреЗрдкреНрдЯрд░ рд╡рд░реНрдЧреЛрдВ рдХрд╛ рдПрдХ рд╕реБрдкрд░рдХреНрд▓рд╛рд╕ рд╣реИред
- InputEvent
- Applet
- ComponentEvent
- Event
69. Which class produces objects with respect to their geographical locations?
рдХреМрди рд╕рд╛ рд╡рд░реНрдЧ рд╡рд╕реНрддреБрдУрдВ рдХреЛ рдЙрдирдХреЗ рднреМрдЧреЛрд▓рд┐рдХ рд╕реНрдерд╛рдиреЛрдВ рдХреЗ рд╕рдВрдмрдВрдз рдореЗрдВ рдЙрддреНрдкрдиреНрди рдХрд░рддрд╛ рд╣реИ?
- Simple TimeZone
- Date
- Locale
- TimeZone
70. Which method in Java generates boolean random values?
рдЬрд╛рд╡рд╛ рдореЗрдВ рдХреМрди рд╕реА рд╡рд┐рдзрд┐ рдмреВрд▓рд┐рдпрди рдпрд╛рджреГрдЪреНрдЫрд┐рдХ рдорд╛рди рдЙрддреНрдкрдиреНрди рдХрд░рддреА рд╣реИ?
- generateBoolean()
- nextBoolean()
- randomBoolean()
- previousBoolean()
Java MCQ Questions with Answers pdf
71. Which method is used for notifying the observer about the change in the observed object?
рдкреНрд░реЗрдХреНрд╖рд┐рдд рд╡рд╕реНрддреБ рдореЗрдВ рдкрд░рд┐рд╡рд░реНрддрди рдХреЗ рдмрд╛рд░реЗ рдореЗрдВ рдкреНрд░реЗрдХреНрд╖рдХ рдХреЛ рд╕реВрдЪрд┐рдд рдХрд░рдиреЗ рдХреЗ рд▓рд┐рдП рдХрд┐рд╕ рд╡рд┐рдзрд┐ рдХрд╛ рдЙрдкрдпреЛрдЧ рдХрд┐рдпрд╛ рдЬрд╛рддрд╛ рд╣реИ?
- observed()
- update()
- notify()
- check()
72. What are the uses of generics?
рдЬреЗрдирд░рд┐рдХ рдХреЗ рдЙрдкрдпреЛрдЧ рдХреНрдпрд╛ рд╣реИрдВ?
- The generics add stability to a code. They do so by making more bugs detectable at the runtime
- The generics make a code faster
- The generics make a code more readable and optimised
- The generics add stability to a code. They do so by making more bugs detectable at the compile time
┬а
73. Which package is used to remotely invoke a method?
рдХрд┐рд╕реА рд╡рд┐рдзрд┐ рдХреЛ рджреВрд░рд╕реНрде рд░реВрдк рд╕реЗ рд▓рд╛рдЧреВ рдХрд░рдиреЗ рдХреЗ рд▓рд┐рдП рдХрд┐рд╕ рдкреИрдХреЗрдЬ рдХрд╛ рдЙрдкрдпреЛрдЧ рдХрд┐рдпрд╛ рдЬрд╛рддрд╛ рд╣реИ?
- java.applet
- java.rmi
- java.awt
- java.util
74. Which mechanism helps in the process of naming as well as visibility control of the classes and their content?
рдХрдХреНрд╖рд╛рдУрдВ рдФрд░ рдЙрдирдХреА рд╕рд╛рдордЧреНрд░реА рдХреЗ рдирд╛рдордХрд░рдг рдХреЗ рд╕рд╛рде-рд╕рд╛рде рджреГрд╢реНрдпрддрд╛ рдирд┐рдпрдВрддреНрд░рдг рдХреА рдкреНрд░рдХреНрд░рд┐рдпрд╛ рдореЗрдВ рдХреМрди рд╕рд╛ рддрдВрддреНрд░ рдорджрдж рдХрд░рддрд╛ рд╣реИ?
- Packages
- Object
- Interfaces
- None of the above
75. The primary use of Files.lines(Path path) is that it:
Files.lines(Path path) рдХрд╛ рдкреНрд░рд╛рдердорд┐рдХ рдЙрдкрдпреЛрдЧ рдпрд╣ рд╣реИ рдХрд┐:
- reads the lines that are from a file as the Stream
- counts the total number of lines for the files at the specified path
- reads the filenames at the specified path
- reads the files that are at the path specified as the String
76. The configuration is stored in which of the file database tables:
рдХреЙрдиреНрдлрд╝рд┐рдЧрд░реЗрд╢рди рдХреЛ рдХрд┐рд╕ рдлрд╝рд╛рдЗрд▓ рдбреЗрдЯрд╛рдмреЗрд╕ рддрд╛рд▓рд┐рдХрд╛ рдореЗрдВ рд╕рдВрдЧреНрд░рд╣реАрдд рдХрд┐рдпрд╛ рдЬрд╛рддрд╛ рд╣реИ:
- .sql
- .dbm
- .hbm
- .ora
77. Which keywords for the purpose of upper bound a wildcard?
рд╡рд╛рдЗрд▓реНрдбрдХрд╛рд░реНрдб рдХреЗ рдКрдкрд░реА рд╣рд┐рд╕реНрд╕реЗ рдХреЗ рд▓рд┐рдП рдХреМрди рд╕реЗ рдХреАрд╡рд░реНрдб рд╣реИрдВ?
- bound
- implements
- stop
- extends
78. What does the abbreviation MVC pattern stand for?
рд╕рдВрдХреНрд╖рд┐рдкреНрдд рдирд╛рдо “рдПрдорд╡реАрд╕реА” рдкреИрдЯрд░реНрди рдХрд╛ рдХреНрдпрд╛ рдЕрд░реНрде рд╣реИ?
- Model View Class
- Mock View Controller
- Mock View Class
- Model View Control
79. Out of the following statements, which one is not true about the Java beans?
рдирд┐рдореНрдирд▓рд┐рдЦрд┐рдд рдореЗрдВ рд╕реЗ рдХреМрди рд╕рд╛ рдХрдерди рдЬрд╛рд╡рд╛ рдмреАрдиреНрд╕ рдХреЗ рдмрд╛рд░реЗ рдореЗрдВ рд╕рд╣реА рдирд╣реАрдВ рд╣реИ?
- It extends the java.io.Serializable class
- It provides getter and setter methods for its properties
- It implements the java.io.Serializable interface
- It provides us with no argument constructor
80. The advantage of using the PreparedStatement in Java is:
рдЬрд╛рд╡рд╛ рдореЗрдВ ” PreparedStatement ” рдХрд╛ рдЙрдкрдпреЛрдЧ рдХрд░рдиреЗ рдХрд╛ рд▓рд╛рдн рд╣реИ:
- Encourages SQL injection
- Prevents SQL injection
- More memory usage
- Slow performance
Java MCQ Questions with Answers pdf
81. What would happen if the IP Address of the host canтАЩt be determined?
- IOException is thrown
- Temporary IP Address will be assigned
- The system will exit with no message
- UnknownHostException is thrown
82. How does one move from some desired step to another one?
рдХреЛрдИ рд╡рд╛рдВрдЫрд┐рдд рдХрджрдо рд╕реЗ рджреВрд╕рд░реЗ рдХрджрдо рдкрд░ рдХреИрд╕реЗ рдЬрд╛рддрд╛ рд╣реИ?
- logger.error
- System.out.println
- logger.log
- breakpoints
83. The storage capacity of a single cookie is:
рдПрдХ рдХреБрдХреА рдХреА рднрдВрдбрд╛рд░рдг рдХреНрд╖рдорддрд╛ рд╣реИ:
- 2048 bytes
- 4095 bytes
- 4095 MegaBytes
- 2048 MegaBytes
84. ______ file defines dependency in maven.
______ рдлрд╝рд╛рдЗрд▓ рдорд╛рд╡реЗрди рдореЗрдВ рдирд┐рд░реНрднрд░рддрд╛ рдХреЛ рдкрд░рд┐рднрд╛рд╖рд┐рдд рдХрд░рддреА рд╣реИред
- dependency.xml
- version.xml
- build.xml
- pom.xml
85. Which action variable helps in including a file in the JSP?
рдЬреЗрдПрд╕рдкреА рдореЗрдВ рдлрд╛рдЗрд▓ рдХреЛ рд╢рд╛рдорд┐рд▓ рдХрд░рдиреЗ рдореЗрдВ рдХреМрди рд╕рд╛ рдПрдХреНрд╢рди рд╡реЗрд░рд┐рдПрдмрд▓ рдорджрдж рдХрд░рддрд╛ рд╣реИ?
- jsp:getProperty
- jsp:include
- jsp:plugin
- jsp:setProperty
86. The main difference between AutoCloseable and Closeable is that:
AutoCloseable рдФрд░ Closeable рдХреЗ рдмреАрдЪ рдореБрдЦреНрдп рдЕрдВрддрд░ рдпрд╣ рд╣реИ рдХрд┐:
- AutoCloseable throws IOException; Closeable throws Exception
- AutoCloseable is a concrete class and Closeable is an interface
- AutoCloseable throws Exception; Closeable throws IOException
- AutoCloseable is an implementation; Closeable is a concept
87. In java control statements break, continue, return, try-catch-finally and assert belongs to?
рдЬрд╛рд╡рд╛ рдХрдВрдЯреНрд░реЛрд▓ рд╕реНрдЯреЗрдЯрдореЗрдВрдЯ рдореЗрдВ рдмреНрд░реЗрдХ, рдЬрд╛рд░реА, рд░рд┐рдЯрд░реНрди, рдЯреНрд░рд╛рдИ-рдХреИрдЪ-рдЖрдЦрд┐рд░рдХрд╛рд░ рдФрд░ рдПрд╕реНрдЯрд░ рдХрд╛ рд╕рдВрдмрдВрдз рд╣реИ?
- Selection statements
- Pause Statement
- Transfer statements
- Loop Statements
88. What is byte code in Java?
рдЬрд╛рд╡рд╛ рдореЗрдВ рдмрд╛рдЗрдЯ рдХреЛрдб рдХреНрдпрд╛ рд╣реИ?
- Code generated by a Java compiler
- Name of Java source code file
- Code generated by a Java Virtual Machine
- Block of code written inside a class
89. Which provides runtime environment for java byte code to be executed?
рдЬреЛ рдЬрд╛рд╡рд╛ рдмрд╛рдЗрдЯ рдХреЛрдб рдХреЛ рдирд┐рд╖реНрдкрд╛рджрд┐рдд рдХрд░рдиреЗ рдХреЗ рд▓рд┐рдП рд░рдирдЯрд╛рдЗрдо рд╡рд╛рддрд╛рд╡рд░рдг рдкреНрд░рджрд╛рди рдХрд░рддрд╛ рд╣реИ?
- JRE
- JVM
- JDK
- JAVAC
90. Which of the following are not Java keywords?
рдирд┐рдореНрдирд▓рд┐рдЦрд┐рдд рдореЗрдВ рд╕реЗ рдХреМрди рдЬрд╛рд╡рд╛ рдХреАрд╡рд░реНрдб рдирд╣реАрдВ рд╣реИрдВ?
- Double
- Instanceof
- Then
- Switch
So friends I hope you enjoy this article related to java mcq questions with answers pdf, java coding questions and answers pdf, java interview questions and answers pdf, java mcq questions for interview, java programming question paper pdf
Java Interview Questions and Answers pdf
┬аFile Name | ┬аJava MCQ Questions with Answers pdf |
┬аFile Size | ┬а862 KB |
┬аNo. of Pages | ┬а19 |
┬аLanguage | ┬аHindi and English |
┬аDownload | ┬аClick Here |
Related Searches: java mcq questions with answers pdf, core java mcq questions and answers pdf, java coding questions and answers pdf, java viva questions and answers pdf, java questions for practice, java questions and answers in hindi english, java questions for freshers