MCQOPTIONS
Saved Bookmarks
This section includes 17 Mcqs, each offering curated multiple-choice questions to sharpen your Java Programming knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
What is the difference between servlets and applets?i.Servlets execute on Server; Applets execute on browserii.Servlets have no GUI; Applet has GUIiii.Servlets creates static web pages; Applets creates dynamic web pagesiv.Servlets can handle only a single request; Applet can handle multiple requests |
| A. | i,ii are correct |
| B. | i,iii are correct |
| C. | i,ii,iii are correct |
| D. | i,ii,iii,iv are correct |
| E. | None of these |
| Answer» B. i,iii are correct | |
| 2. |
Which are the session tracking techniques?i. URL rewritingii. Using session objectiii.Using response objectiv. Using hidden fieldsv. Using cookiesvi. Using servlet object |
| A. | i, ii, iv, v |
| B. | i, ii, iii, vi |
| C. | i, ii, iii, v |
| D. | i, vi, iii, v |
| E. | None of these |
| Answer» B. i, ii, iii, vi | |
| 3. |
Which of the following is good coding practice to determine oddity?i)public boolean Calc(int n){ return (n & 1)!= 0; }ii)public boolen Calc(int n){ return n % 2 == 1;} |
| A. | i |
| B. | ii |
| C. | option (i) causes compilation error |
| D. | option (ii) causes compilation error |
| E. | None of these |
| Answer» B. ii | |
| 4. |
What is the lastest version of Java? |
| A. | 7 |
| B. | 6 |
| C. | 9 |
| D. | 8 |
| Answer» D. 8 | |
| 5. |
JVM stands for ____ |
| A. | Java vacuum machine |
| B. | Java void machine |
| C. | Java Virtual machine |
| D. | Java Virtual model |
| Answer» D. Java Virtual model | |
| 6. |
Which are the session tracking techniques? |
| A. | i, ii, iv, v |
| B. | i, ii, iii, vi |
| C. | i, ii, iii, v |
| D. | i, vi, iii, v |
| E. | None of these |
| Answer» B. i, ii, iii, vi | |
| 7. |
What is the difference between servlets and applets? |
| A. | i,ii are correct |
| B. | i,iii are correct |
| C. | i,ii,iii are correct |
| D. | i,ii,iii,iv are correct |
| E. | None of these |
| Answer» B. i,iii are correct | |
| 8. |
request is instance of which one of the following classes? |
| A. | ServletRequest |
| B. | Request |
| C. | HttpRequest |
| D. | HttpServletRequest |
| E. | None of these |
| Answer» E. None of these | |
| 9. |
What does foo.getClass().getMethod( doSomething , null) return? |
| A. | Exception is thrown |
| B. | Class object |
| C. | Method is returned and we can call the method as method.invoke(foo,null); |
| D. | doSomething method instance |
| E. | None of these |
| Answer» D. doSomething method instance | |
| 10. |
jspService() method of HttpJspPage class should not be overridden. |
| A. | False |
| B. | True |
| C. | NA |
| D. | NA |
| E. | NA |
| Answer» B. True | |
| 11. |
What does Class.forName( myreflection.Foo ).getInstance() return? |
| A. | Foo object |
| B. | Calls the getInstance() method of Foo class |
| C. | class object of Foo |
| D. | An array of Foo objects |
| E. | None of these |
| Answer» B. Calls the getInstance() method of Foo class | |
| 12. |
Can and be used alternatively in JSP? |
| A. | False |
| B. | True |
| C. | NA |
| D. | NA |
| E. | NA |
| Answer» B. True | |
| 13. |
out is implicit object of which class? |
| A. | javax.servlet.jsp.JspWriter |
| B. | javax.servlet.jsp.SessionPrinter |
| C. | javax.servlet.jsp.SessionWriter |
| D. | javax.servlet.jsp.PrintWriter |
| E. | None of these |
| Answer» B. javax.servlet.jsp.SessionPrinter | |
| 14. |
Which method is used to get three-letter abbreviation for locale s country in servlets? |
| A. | Local.retrieveISO3Country() |
| B. | Response.getISO3Country() |
| C. | Request.getISO3Country() |
| D. | Locale.getISO3Country() |
| E. | None of these |
| Answer» D. Locale.getISO3Country() | |
| 15. |
What does MIME stand for? |
| A. | Multipurpose Internet Mail Extension |
| B. | Multipurpose Internet Mass Extension |
| C. | Multipurpose Internet Messaging Extension |
| D. | Multipurpose Internet Media Extension |
| E. | None of these |
| Answer» B. Multipurpose Internet Mass Extension | |
| 16. |
What does System.getProperty( variable ) return? |
| A. | Null |
| B. | Runtime error |
| C. | Value stored in variable |
| D. | Compilation error |
| E. | None of these |
| Answer» B. Runtime error | |
| 17. |
Which of these events will be generated if we close an applet s window? |
| A. | AdjustmentEvent |
| B. | ActionEvent |
| C. | WindowEvent |
| D. | ComponentEvent |
| E. | None of these |
| Answer» E. None of these | |