Java Multiple Choice Questions and Answers | Java Quiz Questions and Answer | Java MCQ Questions and Answers
Definition: Java is an general purpose, concurrent, strongly typed, object oriented class based programming language. It removes complexity since it doesn’t use complex and difficult features of other languages like C programming and C++. Java is used to create applications and platforms for a number of devices, which including computers, laptops, gaming consoles, Blu-ray players, car navigation systems, medical monitoring devices, parking meters, lottery terminals and smartphones etc. The Java programming language can be considered as the official language for mobile application development.
Java Quiz: Candidate independently study and practice the Java Programming MCQ, this is the great way to learn this segments. In this section, we have to discuss about 30 important Java multiple choice questions are given below. Java is fairly easy to learn for beginners. Java is simple because its coding style is very clean and easy to understand. Those who are preparing interview, you must know the basic of Java. So Candidate kindly practice this Java question.
Click here for Cyber Security MCQ Questions |
Press here SQL MCQ Questions and Answer |
Click Here CSS MCQ Questions and Answer |
Press Here Ethernet Topology MCQ Questions |
Java MCQ (Multiple Choice Questions and Answer)
1. The smallest integer type is________ and its size is _________ bits.
B. short, 16
C. byte, 8
D. short, 8
Answer: byte, 8
2. Size of float and double in Java is_________
A. 32 and 32
B. 32 and 64
C. 64 and 64
D. 64 and 32
Answer: 32 and 64
3. Which of the following automatic type conversion will be possible?
B. byte to int
C. short to int
D. long to int
Answer: int to long
4. Automatic type conversion in Java takes place when___________
A. Two type are compatible and size of destination type is larger than source type
B. Two type are compatible and size of destination type is equal of source type
C. Two type are compatible and size of destination type is shorter than source type
D. All of the above
Answer: Two type are compatible and size of destination type is larger than source type
5. In Java, the word true is________________
A. A Boolean literal
B. A Java keyword
C. Same as value 1
D. Same as value 0
Answer: A Boolean literal
6. Size of int in Java is___________
A. 64 bit
B. 16 bit
C. 32 bit
D. Depends on execution environment
Answer: 32 bit
7. In Java arrays are_________
A. primitive data type
B. objects
C. object references
D. None
Answer: objects
8. Select from among the following character escape code which is not available in Java.
A. \t
B. \r
C. \a
D. \\
Answer: \a
9. When you pass an array to a method, the method receives ________
A. The reference of the array
B. A copy of the first element
C. A copy of the array
D. The length of the array
Answer: The reference of the array
10. Which one of the following is a valid statement?
A. char[] c = new char[5];
B. char[] c = new char();
C. char[] c = new char(4);
D. char[] c = new char[];
Answer: char[] c = new char[5];
11. In Java byte, short, int and long all of these are___________
A. unsigned
B. signed
C. Both A & B
D. None
Answer: signed
12. Which of the following for loops will be an infinite loop?
A. for(i=0 ; i<1; i–)
B. for(; 😉
C. for(i=0; ; i++)
D. All of the above
Answer: All of the above
13. The object is created with new keyword___________
A. At Compile-time
B. Depends on the code
C. At run-time
D. None of these
Answer: At run-time
14. A package is a collection of__________
A. Interfaces
B. Classes
C. Editing tools
D. Classes and Interfaces
Answer: Classes and Interfaces
15. How many primitive data types are there in Java?
A. 7
B. 8
C. 6
D. 9
Answer: 8
16. Java is a _________ language.
A. strongly typed
B. weakly typed
C. moderate typed
D. None
Answer: strongly typed
17. A method within a class is only accessible by classes that are defined within the same package as the class of the method. Which one of the following is used to enforce such restriction?
B. Declare the method with the keyword public
C. Declare the method with the keyword protected
D. Do not declare the method with any accessibility modifiers
Answer: Do not declare the method with any accessibility modifiers
18. Name the keyword that makes a variable belong to a class, rather than being defined for each instance of the class.
A. abstract
B. static
C. final
D. native
Answer: static
19. toString() method is defined in__________
A. java.lang
B. java.lang.util
C. java.lang.String
D. java.lang.Object
Answer: java.lang.Object
20. The String method compareTo() returns
A. true
B. false
C. an int value
D. 1
Answer: an int value
21. The class string belongs to ________ package.
A. java.applet
B. java.awt
C. java.lang
D. java.string
Answer: java.lang
22. How many Constructor String class have?
A. 7
B. 13
C. 2
D. 5
Answer: 13
23. What will be the return type of a method that not returns any value?
A. Char
B. double
C. void
D. int
Answer: void
24. What is Math.floor(3.6)?
A. 4
B. 3
C. 3.0
D. 4.0
Answer: 3.0
25. Which of the following options is the best for generating random integer 0 or 1?
A. (int)Math.random()
B. (int)Math.random() + 1
C. (int)(Math.random() + 0.5)
D. (int)(Math.random() + 0.2)
Answer: (int)(Math.random() + 0.5)
26. In which area of memory, the system stores parameters and local variables whenever a method is invoked?
B. Heap
C. Storage Area
D. Stack
Answer: Stack
27. The finalize() method is called just prior to____________
A. An object, variable or method goes out of scope
B. Before garbage collection
C. An object or variable goes out of scope
D. A variable goes out of scope
Answer: Before garbage collection
28. The implicit return type of a constructor is__________
A. There is no return type
B. void
C. A class object in which it is defined
D. None
Answer: A class object in which it is defined
29. The variables declared in a class for the use of all methods of the class are called________
A. instance variables
B. objects
C. reference variables
D. None
Answer: instance variables
30. Which of the modifier can’t be used for constructors?
A. public
B. static
C. private
D. protected
Answer: stat
Aspirants who are searching for Java MCQ(Multiple choice Questions and Answer), Java MCQ Questions are provided above. We have regularly update in more general knowledge (GK) Quiz in our dailyrecruitment site.
Govt Jobs by Qualifications
Education & Vacancies | Salary | Apply Link |
---|---|---|
12th Pass Govt Jobs - 18,000+ Vacancies | Rs. 5,200 - 92,300 | Apply Now |
ITI Pass Jobs - 3,500 Vacancies | Rs. 5,200 - 35,000 | Apply Now |
Any Graduate Jobs - 19,100 Vacancies | Rs. 5,200 - 92,300 | Apply Now |
Central Govt Jobs | Rs. 5,200 - 17,000 | Apply Now |
Bank Jobs - 1,000 Vacancies | Rs. 5,200 - 29,200 | Apply Now |
Diploma Jobs - 9,300 Vacancies | Rs. 5,200 - 35,000 | Apply Now |
BTech/BE Jobs - 18,000 Vacancies | Rs. 15,000 - 1,00,000 | Apply Now |
Data Entry Jobs - 1,300 Vacancies | Rs. 5,200 - 29,200 | Apply Now |
Private Jobs | Rs. 10,000 - 67,700 | Apply Now |