MCQ for Java | Java MCQ Questions – Java Multiple Choice Questions with answers for preparation of IT exams of various regular and distance mode courses.
Are you a Java enthusiast looking to test your knowledge and skills? Look no further! In this article, we have compiled a comprehensive set of Multiple Choice Questions (MCQs) for Java, complete with answers.
Whether you are preparing for an interview or simply want to gauge your understanding of the language, these MCQs will challenge and sharpen your Java expertise. So, gear up and get ready to dive into the world of Java with our exciting quiz!
MCQs for Java Programming with Answers
1. The earlier name of Java was ___ ___.
Ans. Oak
2. The members of the Green Project were ___, ___ and ___.
Ans. Patrick Naughton, Mike Sheridan, James Gosling
3. ___ is the first graphical browser.
Ans. Mosaic
4. ___ is the process of converting typed code to machine code.
Ans. Compilation
5. Java code is ___ so that it can easily run on any systems.
Ans. Portable
6. Java is ___ than other interpreted language.
Ans. Secure
7. ___ is the ability of an application to perform multiple tasks at a time.
Ans. Multithreading
8. Java is tuned for ___.
Ans. Web
9. Java is both ___ and ___.
Ans. Compiled and Interpreted
10. ___ is used to create and manage public keys, private keys and security certificates.
Ans. Keytool
11. All information which is managed by the key tool is stored in a database called___.
Ans. Keystore
12. Sun Microsystems includes a default key store that uses a new file format called___.
Ans. JKS (Java Key Store)
13. Java archival tool used for packaging all java programs and resource files into a single archive file is___.
Ans. Jar
14. ___ was the first programming language that could be used to send interactive programs over the World Wide Web.
Ans. Java.
15. A ___ is an encrypted file or files that accompany a program, indicating exactly from whom the file came.
Ans. Digital signature
16. The document that represents this digital signature is called a ___.
Ans. Certificate Ans
17. An applet provider must verify its identity using a group called a ___.
Ans. Certificate Authority.
18. A compiler converts the Java program into an intermediate language representation called ___.
Ans. bytecode
19. The concept of ___ is possible in Java.
Ans. write once, run anywhere
20. The third type of comment is used by a tool called ___ for automatic generation of documentation.
Ans. Javadoc
21. Give the symbol for the modulus operator.
Ans. %
22. Give the symbol for logical AND operator.
Ans. &
23. If-else is a looping statement. (True or False)
Ans. False
24. String is a ___ data type in Java.
Ans. abstract / derived
25. Keywords can be used as a variable name. (True or False.)
Ans. false
26. A ___ access specifier allows the method to be executed from another class.
Ans. public
27. ___ operator is used to creating an object.
Ans. new
28. ___ is the extension for Java source code files.
Ans. java
29. ___ command is used to compile the Java source code.
Ans. Javac
30. ___ command is used to execute the Java class file.
Ans. java
31. The general form of a one-dimensional array declaration is ___.
Ans. type var-name [ ];
32. In Java, multidimensional arrays are actually arrays of ___.
Ans. arrays
33. Java implements strings as objects of type ___.
Ans. String
34. Both the String and StringBuffer classes are defined in ___ package.
Ans. java.lang
35. ___ represents a number of variables which occupy contiguous spaces in the memory.
Ans. array
36. Each element in the array is distinguished by its ___.
Ans. index
37. In Java, a ___ is a sequence of characters.
Ans. String
38. To extract a single character from a String, you can refer directly to an individual character via the ___ method.
Ans. charAt( )
39. To extract more than one character at a time, you can use the ___ method.
Ans. getChars( )
40. To extract a single character from a String, you can use ___ method.
Ans. charAt()
41. To extract more than one character at a time, you can use ___ method.
Ans. getChars()
42. To compare two strings for equality, use ___ method.
Ans. equals()
43. While searching string ___ searches for the first occurrence of a character or substring.
Ans. indexOf( )
44. While searching string ___ Searches for the last occurrence of a character or substring.
Ans. lastIndexOf( )
45. ___ method searches for the first occurrence of a character or substring.
Ans. indexOf()
46. ___ method searches for the last occurrence of a character or substring.
Ans. lastIndexOf()
47. You can extract a substring using ___ method.
Ans. substring()
48. To set the length of the buffer within a StringBuffer object, use ___ method.
Ans. setLength()
49. The ___ method concatenates the string representation of any other type of data to the end of the invoking StringBuffer object.
Ans. append()
50. You can reverse the characters within a StringBuffer object using ___ method.
Ans. reverse()
51. ___ is one of the features of object-oriented programming that allows the creation of hierarchical classifications.
Ans. inheritance
52. A class that is inherited is called a ___.
Ans. superclass
53. The class that does the inheriting is called a ___.
Ans. subclass
54. Engine has a ___ relationship with the automobile.
Ans. part-of
55. ___, ___ and ___ are the three types of access specifiers in Java.
Ans. public, private, protected
56. ___ is the mechanism in Java through which the class namespace is partitioned into more manageable chunks.
Ans. package
57. ___ keyword is used to define a package.
Ans. package
58. In Java, multi-leveled packages can be created. (True / False)
Ans. true
59. The specific location that the Java compiler will consider as the root of any package hierarchy is controlled by ___.
Ans. CLASSPATH
60. ___ symbol denotes the current working directory.
Ans. . (dot)
61. ___ is the mechanism through which you can specify what a class must do, but not how it does it.
Ans. Interface
62. Variables declared inside the interface declarations are implicit ___ and ___.
Ans. final, static
63. Do…While is a decision-making statement. (True or False)
Ans. False
64. ___ and ___ classes are derived from the Throwable class.
Ans. Error and Exception
65. Exception classes are available in the ___ package.
Ans. java.lang
66. ___ exception will be thrown when you divide by zero.
Ans. Arithmetic Exception
67. ___ exception will be thrown if you try to access the array element beyond its index value.
Ans. ArrayIndexOutOfBounds.
68. The term exception denotes a/an ___.
Ans. An exceptional event.
69. Java handles exceptions in a ___ way.
Ans. Object-oriented.
70. The class at the top of the exception classes hierarchy is ___.
Ans. Throwable.
Download MCQs on Java for interview
Production and Operations Management MCQ with answers
Conclusion Points
If you are seeking comprehensive and up-to-date MCQ for Java or Java Question and Answers for the year 2024, look no further. Our collection of MCQs for Java is designed to test your knowledge and understanding of this popular programming language.
Whether you are a beginner or an experienced programmer, these questions will help you assess your skills and identify areas for improvement. So why wait? Start practicing now and take your Java proficiency to the next level. Don’t miss out on this valuable resource – boost your Java expertise today.