{"id":1198,"date":"2017-08-31T10:30:20","date_gmt":"2017-08-31T10:30:20","guid":{"rendered":"https:\/\/www.h2kinfosys.com\/blog\/?p=1198"},"modified":"2025-10-22T07:06:31","modified_gmt":"2025-10-22T11:06:31","slug":"java-online-test","status":"publish","type":"post","link":"https:\/\/www.h2kinfosys.com\/blog\/java-online-test\/","title":{"rendered":"JAVA Online Test"},"content":{"rendered":"\n\n\n<h3 class=\"wp-block-heading\"><strong>1. Which of the following is not a Java keyword?<\/strong><\/h3>\n\n\n\n<p>A. static<br>B. Boolean<br>C. void<br>D. private<\/p>\n\n\n\n<p>\u2705 <strong>Answer:<\/strong> B. Boolean<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>2. What is the default value of a local variable in Java?<\/strong><\/h3>\n\n\n\n<p>A. 0<br>B. null<br>C. false<br>D. No default value<\/p>\n\n\n\n<p>\u2705 <strong>Answer:<\/strong> D. No default value<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>3. Which concept of OOP is achieved by method overloading?<\/strong><\/h3>\n\n\n\n<p>A. Encapsulation<br>B. Polymorphism<br>C. Abstraction<br>D. Inheritance<\/p>\n\n\n\n<p>\u2705 <strong>Answer:<\/strong> B. Polymorphism<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>4. What is the size of an <code>int<\/code> in Java?<\/strong><\/h3>\n\n\n\n<p>A. 2 bytes<br>B. 4 bytes<br>C. 8 bytes<br>D. Depends on OS<\/p>\n\n\n\n<p>\u2705 <strong>Answer:<\/strong> B. 4 bytes<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>5. Which of these cannot be used for a variable name in Java?<\/strong><\/h3>\n\n\n\n<p>A. myVariable<br>B. $value<br>C. _count<br>D. 123abc<\/p>\n\n\n\n<p>\u2705 <strong>Answer:<\/strong> D. 123abc<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>6. Which method is the entry point of a Java program?<\/strong><\/h3>\n\n\n\n<p>A. start()<br>B. run()<br>C. main()<br>D. init()<\/p>\n\n\n\n<p>\u2705 <strong>Answer:<\/strong> C. main()<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>7. What will <code>System.out.println(10 + 20 + \"Java\");<\/code> output?<\/strong><\/h3>\n\n\n\n<p>A. Java30<br>B. 30Java<br>C. 1020Java<br>D. Compilation error<\/p>\n\n\n\n<p>\u2705 <strong>Answer:<\/strong> B. 30Java<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>8. Which of the following is not a valid access modifier?<\/strong><\/h3>\n\n\n\n<p>A. private<br>B. protected<br>C. internal<br>D. public<\/p>\n\n\n\n<p>\u2705 <strong>Answer:<\/strong> C. internal<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>9. Which keyword is used to inherit a class in Java?<\/strong><\/h3>\n\n\n\n<p>A. implements<br>B. extends<br>C. inherits<br>D. instanceOf<\/p>\n\n\n\n<p>\u2705 <strong>Answer:<\/strong> B. extends<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>10. What does the <code>final<\/code> keyword mean when applied to a variable?<\/strong><\/h3>\n\n\n\n<p>A. It cannot be overridden<br>B. It cannot be reassigned<br>C. It cannot be accessed<br>D. It is public<\/p>\n\n\n\n<p>\u2705 <strong>Answer:<\/strong> B. It cannot be reassigned<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>11. Which of these statements about constructors is true?<\/strong><\/h3>\n\n\n\n<p>A. Constructors can have a return type<br>B. Constructors are inherited<br>C. Constructors initialize objects<br>D. Constructors can be abstract<\/p>\n\n\n\n<p>\u2705 <strong>Answer:<\/strong> C. Constructors initialize objects<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>12. Which class is the parent of all classes in Java?<\/strong><\/h3>\n\n\n\n<p>A. System<br>B. Object<br>C. Runtime<br>D. Class<\/p>\n\n\n\n<p>\u2705 <strong>Answer:<\/strong> B. Object<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>13. What is method overriding?<\/strong><\/h3>\n\n\n\n<p>A. Two methods with the same name in one class<br>B. Subclass providing a new implementation of a superclass method<br>C. Two methods differing only by parameters<br>D. Method hiding<\/p>\n\n\n\n<p>\u2705 <strong>Answer:<\/strong> B. Subclass providing a new implementation of a superclass method<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>14. Can a constructor be <code>static<\/code>?<\/strong><\/h3>\n\n\n\n<p>A. Yes<br>B. No<br>C. Only in abstract classes<br>D. Only for inner classes<\/p>\n\n\n\n<p>\u2705 <strong>Answer:<\/strong> B. No<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>15. Which package is imported by default?<\/strong><\/h3>\n\n\n\n<p>A. java.util<br>B. java.lang<br>C. java.io<br>D. java.net<\/p>\n\n\n\n<p>\u2705 <strong>Answer:<\/strong> B. java.lang<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>16. Which of these data types can store Unicode characters?<\/strong><\/h3>\n\n\n\n<p>A. int<br>B. float<br>C. char<br>D. String<\/p>\n\n\n\n<p>\u2705 <strong>Answer:<\/strong> C. char<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1<strong>7. What does <code>this<\/code> keyword refer to?<\/strong><\/h3>\n\n\n\n<p>A. Parent class object<br>B. Current object<br>C. Static object<br>D. Class name<\/p>\n\n\n\n<p>\u2705 <strong>Answer:<\/strong> B. Current object<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>18. Which of the following cannot be declared <code>abstract<\/code>?<\/strong><\/h3>\n\n\n\n<p>A. Class<br>B. Method<br>C. Variable<br>D. Interface<\/p>\n\n\n\n<p>\u2705 <strong>Answer:<\/strong> C. Variable<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>19. Which of the following is not an OOP principle?<\/strong><\/h3>\n\n\n\n<p>A. Inheritance<br>B. Compilation<br>C. Polymorphism<br>D. Abstraction<\/p>\n\n\n\n<p>\u2705 <strong>Answer:<\/strong> B. Compilation<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>20. Which of these operators is used for string comparison?<\/strong><\/h3>\n\n\n\n<p>A. ==<br>B. equals()<br>C. compareTo()<br>D. Both B and C<\/p>\n\n\n\n<p>\u2705 <strong>Answer:<\/strong> D. Both B and C<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. Which of the following is not a Java keyword? A. staticB. BooleanC. voidD. private \u2705 Answer: B. Boolean 2. What is the default value of a local variable in Java? A. 0B. nullC. falseD. No default value \u2705 Answer: D. No default value 3. Which concept of OOP is achieved by method overloading? A. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[57],"tags":[58,60,59,61],"class_list":["post-1198","post","type-post","status-publish","format-standard","hentry","category-java-skill-test","tag-java","tag-java-online-quiz","tag-java-quiz","tag-java-skill-test"],"_links":{"self":[{"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/posts\/1198","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/comments?post=1198"}],"version-history":[{"count":2,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/posts\/1198\/revisions"}],"predecessor-version":[{"id":31119,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/posts\/1198\/revisions\/31119"}],"wp:attachment":[{"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/media?parent=1198"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/categories?post=1198"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/tags?post=1198"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}