Friday, June 30, 2017

Web Development With Java mcqs

1. Error Message displayed when the page is not found at current location?
Ans: 404

2. What is the output of the following code. The value is <%=""%>
Ans: The value is

3. What gets printed when the following JSP code is invoked in a browser. Select the one correct answer. <%=if(Math.random()<0.5%)>hello<%=}else{%>hi<%=}%>
Ans: The JSP file will not compile

4. Select the right option to set session expiry after 1 minute of inactiveness
Ans: <session-config><session-timeout>1</session-timeout></session-config>

5. JSP is used for
Ans: Server Side Programming

6. Which of the following is true about javax.servlet.error.exception_type?
Ans: This attribute gives information about exception type which can be stored and analyzed after storing in a java.lang.Class data type

7. Which is not a JSP directive
Ans: scriptlet

8. Which of the following package contains servlet classes?
Ans: (a) javax.servlet
         (b) javax.servlet.http

9. JSP is 
Ans: Java Server Pages

10. Select the correct scopes in JSP
Ans: page, request, session, application

11. Select a valid declaration from the following
Ans: <%! String orgName="TCS";%>

12. How to create a cookie in servlet?
Ans: Use new operator

13. How many implicit objects are there in JSP
Ans: 9

14. In JSP, how can you know what HTTP method (GET or POST) is used by client request?
Ans: request.getMethod()

15. Which of the following code is used to set the session timeout in servlets?
Ans: session.setMaxInactiveInterval(Interval)

16. Comments in JSP can be written by
Ans: Both a and b (a. <%--comments--%>, b. <!--comments-->)

17. Which of the following code sends a cookie in servlet?
Ans: None of the above (a) response.addCookie(cookie); b) response.sendCookie(cookie); c) response.createCookie(cookie);)

18. In HTTP Request which asks for the loopback of the request message, for testing or troubleshooting?
Ans: TRACE

19. Which of the following tags can be used to print the value of an expression to the output stream?
Ans: <%=%>

20. Why use RequestDispatcher to forward a request to another resource, instead of using a sendRedirect?
Ans: The RequestDispatcher does not require a round trip to the client, and thus is more efficient and allows the server to maintain request state

21. A JSP needs to generate an XML file. Which attribute of page directive may be used to specify that JSP is generating an XML file?
Ans: contentType

22. Select the right method to include welcome file in a web application
Ans: <welcome-file-list><welcome-file>index.jsp</welcome-file><welcome-file>default.html</welcome-file><welcome-file-list>

23. Select a valid expression tag from the following
Ans: <%=new java.util.Dat().toString()%>

24. Which of the below methods returns a string containing information about the servlet, such as its author, version and copyright
Ans: getServletInfo()

25. What is the difference between doing an include or a forward with a RequestDispatcher?
Ans: The forward method transfers control to the designated resource, while the include method invokes the designated resource, substitutes its output dynamically in the display, and returns control to the calling page

26. Which of the following is true about javax.servlet.error.exception_type?
Ans: This attribute gives information about exception type which can be stored and analyzed after storing in a java.lang.Class data type

27. What are Servlets?
Ans: Both of the above (Java Servlets are programs that run on a Web or Application server. Java Servlets act as a middle layer between a request coming from a web browser or other HTTP client and databases or applications on the HTTP server)

28. Which of the following is true about servlets?
Ans: All of the above. ((a) Servlets execute within the address space of a Web server. (b) Servlets are platform-independent because they are written in Java. (c)The full functionality of the Java class libraries is available to a servlet.)

29.  Which of the following is the correct order of servlet life cycle phase methods?
Ans: init, service, destroy

30. When init method of servlet gets called?
Ans: The init method is called when the servlet is first created. 

31. Which of the following is true about init method of servlet? 
Ans: Both of the above. ((a) The init method simply creates or loads some data that will be used throughout the life of the servlet. (b) The init method is not called again and again for each user request.)

32. When service method of servlet gets called? 
Ans:  The service method is called whenever the servlet is invoked.

33. Which of the following is true about service method of servlet?
Ans: All of the above ((a) The servlet container i.e.webserver calls the service method to handle requests coming from the client. (b) Each time the server receives a request for a servlet, the server spawns a new thread and calls service. (c) The service method checks the HTTP request type GET,POST,PUT,DELETE,etc. and calls doGet, doPost, doPut, doDelete, etc. methods as appropriate. )

34. When doGet method of servlet gets called?
Ans: Both of the above. ((a) A GET request results from a normal request for a URL. (b) The service method checks the HTTP request type as GET and calls doGet method.)

35. When doPost method of servlet gets called?
Ans: Both of the above. ((a) A POST request results from an HTML form that specifically lists POST as the METHOD. (b) The service method checks the HTTP request type as POST and calls doPost method.)

36. Which of the following code can be used to clear the content of the underlying buffer in the response without clearing headers or status code.
Ans: response.resetBuffer()

37. How can you make jsp page as error page
Ans: isErrorPage="true"

38. In JSP, how can you know what HTTP method (GET or POST) is used by client request?
Ans: request.getMethod()

39. Which of the following code can be used to set the character encoding for the body of the response? 
Ans: response.setCharacterEncoding(charset) 

40. Which of the following is not an implicit object in JSP? 
Ans: pageConfig 

41. Java declaration tag is used to declare 
Ans: Both variables and methods 

42. What is the return type of getParameter(String name) in ServletRequest? 
Ans: String

43. Web Development is a broad term for____?
Ans: Work involved in developing a website for the Internet

44. Web Development Team consists of Web Developers?
Ans: True

Reference Books:

1. PHP MySQL Web Development
2. Mean Web Development
3. Fundamentals of Web Development

Sources: Tutorialspoint: Servlet mock test 1 


144 comments:

  1. Replies
    1. Great Information sharing .. I am very happy to read this article .. thanks for giving us go through info.Fantastic nice. I appreciate this post. business to business marketing

      Delete
  2. Replies
    1. I feel really happy to have seen your webpage and look forward to so many more entertaining times reading here. Thanks once more for all the details.Thanks once more for all the details.
      Read More: Application Services Company
      Designing Services Company

      Delete
  3. We Create This Blog Learn Php at home is for beginner Programmers and Developers that should be learn web development using php step by step and can do examples of php with easy ways to Explain.

    ReplyDelete
  4. the blog is about java Setup your JavaWeb Development With Java mcqs #java it is useful for students and java Developers for more updates on python follow the link
    Java Online Training Hyderabad

    ReplyDelete
  5. Thanks for the information you have provided in your blog as it proved to be very helpful for me in start writing my own blogs you have provided in this blog as it proved to be very helpful to me.

    web design company in jaipur

    ReplyDelete
  6. Nice blog post, thanks for sharing. For more information about web development

    ReplyDelete
  7. Thanks for sharing this attractive and informative content.please share some more content ..keep it up
    PHP Training Center

    ReplyDelete
  8. Thanks for sharing this wonderful blog. keep posting more content ..keep it up.
    PHP Web Application Development

    ReplyDelete
  9. Your good knowledge and kindness in playing with all the pieces were
    very useful. I don’t know what I would have done if I had not
    encountered such a step like this.



    java training in chennai


    java Training in Bangalore

    ReplyDelete
  10. Thanks for sharing this good blog. It's very interesting and useful for students Java Online Course Hyderabad

    ReplyDelete
  11. It is amazing and wonderful to visit your site. Thanks for sharing this information; this is useful to everyone...
    You can also visit here java course in delhi, Java Course

    ReplyDelete
  12. Nice blog and absolutely outstanding. You can do something much better but i still say this perfect.Keep trying for the best. Hire Web and App Developers

    ReplyDelete
  13. Very interesting article for reading and it is providing genuine tips about concern work. Keep it up.
    Crystal Tech Solution offers Digital Marketing Service in reasonable cost.

    ReplyDelete
  14. This comment has been removed by the author.

    ReplyDelete
  15. Hi Author just now i found your blog its really awesome. Keep this work.Hire Xamarin Developer , Xamarin Development company

    ReplyDelete
  16. I have read a few of the articles on your website now, and I really like your style of blogging. I added it to my favorites blog site list and will be checking back soon. Please check out my site as well and let me know what you think.Web Development Kuala Lumpur

    ReplyDelete
  17. hi this article is very grateful! so i add a eCommerce Development Company India With Iphygenia as your eCommerce company, you have a complete solution, from inception to development and all the way through to marketability and conversion rate analysis.

    ReplyDelete
  18. Your article is more informative .Thanks for sharing nice information about web development .

    ReplyDelete
  19. This information has really helpful for most of the beginner of web development. I really appreciate the way you have written about this topic. I will really like to read this more information blog. Thanks for sharing this blog.
    Thanks and Regards,
    Mohit Verma
    Seo Company in Lucknow |Seo Services in Lucknow

    ReplyDelete
  20. Really awesome blog. Your blog gives very useful information. Thanks for sharing. Top Java training in Hyderabad.

    ReplyDelete
  21. Thanks for your article and sharing your expertise, it's really appreciated.It helped me a lot for what i was searching for
    Prestashop Development Company Lucknow

    ReplyDelete
  22. A designer knows he has achieved perfection not when there is nothing left to add, but when there is nothing left to take away.Web Design Services

    ReplyDelete
  23. Very inspired from this blog. Thanks for sharing.
    Website Development Services in Pune
    Web Development Company Pune

    Read our more article on viral feeds here.


    ReplyDelete
  24. A great website is a quintessential aspect of promoting your brand and taking it to the new height of success. Get in touch with the reputed web development services in the United States to tweak your brand's reputation. So, get a quality website as soon as possible.

    ReplyDelete
  25. Thank you so much for taking effort to share such a useful information. I will definitely share this great post in my articles. in web development website

    ReplyDelete
  26. Thank you so much for taking effort to share such a useful information. I will definitely share this great post in my articles. Web Development

    ReplyDelete
  27. These are actually wonderful some ideas in the blog. You have touched good quality points here. In whatever way continue writing.


    Kiwi Website Design

    ReplyDelete
  28. Wonderful question. No doubt you blog is best thanks for posting these question answers.
    Hire PHP Developers In USA

    ReplyDelete
  29. A designer knows he has achieved perfection not when there is nothing left to add, but when there is nothing left to take away.
    Zen cart Developers India

    ReplyDelete




  30. Hi Your Blog is very nice!!

    Get All Top Interview Questions and answers PHP, Magento, laravel,Java, Dot Net, Database, Sql, Mysql, Oracle, Angularjs, Vue Js, Express js, React Js,
    Hadoop, Apache spark, Apache Scala, Tensorflow.

    Mysql Interview Questions for Experienced

    php interview questions for experienced

    php interview questions for freshers

    python interview questions for freshers

    tally interview questions and answers

    ReplyDelete
  31. Having trouble in Hire Php Web Developer who is reliable and experienced enough to implement the functionality and design you need? Reach out to us we have a team of developers, designers and seo experts that fulfill your dreams. we provide you Custom PHP Software Development USA, PHP Application Development India, Custom Php Software Solutions UK. Our services will be on budget of clients. We provide 100% quality assurance and dedicated to meet deadlines of the project.

    ReplyDelete
  32. Hi I loved reading your Blog!! Thank you so much for posting these questions and answers.Read our relevant information right here Top web development companies
    .

    ReplyDelete
  33. These questions are really important and valuable. Thank you for sharing this extremely useful details here. Keep blogging and sharing your knowledge.
    Web Design Company | Web development Lucknow

    ReplyDelete
  34. Love your site. have you got the theme you used that you can share? website design companies in johannesburg

    ReplyDelete
  35. Writ a Very useful information blog for thanks.
    thanks for share this article , Top Web development development company in Lucknow which is provides affordable cost website development services in Lucknow, India. We have professional team of highly skilled designer and developers that create amazing websites for your online business

    ReplyDelete
  36. Positive site, where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work.
    software development company in delhi

    ReplyDelete
  37. Thanks for sharing such a great article. Have the best
    Website Designing Company in Delhi
    to make your work the best in the industry!

    ReplyDelete
  38. Thanks for sharing great post. I really like this post.Phoenixbinarysystem

    ReplyDelete
  39. I am happy to find this post very useful for me, as it contains a lot of information. I always prefer to read the quality content I found in you post. Thanks for sharing.
    Best JAVA Training in Chennai
    JAVA Training

    ReplyDelete
  40. Thanks for the nice blog. It was very useful for me. I'm happy I found this blog.
    I would like to thank you for sharing this helpful blog..

    https://businesswebsitegroup.co.nz/

    ReplyDelete
  41. Existing without the answers to the difficulties you’ve sorted out
    through this guide is a critical case, as well as the kind which could
    have badly affected my entire career if I had not discovered your
    website.


    Java training in chennai

    ReplyDelete
  42. Can I just say what a aid to find somebody who truly knows what theyre speaking about on the internet. You positively know the right way to bring an issue to light and make it important. More people have to read this and understand this facet of the story. I cant believe youre not more standard because you undoubtedly have the gift. Web agencies and firms

    ReplyDelete
  43. This article is extremely useful and intersting,Thanks for sharing such an instructive article with us.
    keep updating.

    https://creativecontent.co.nz/

    ReplyDelete
  44. Hey! This is my first visit to your blog! We are a team of volunteers and starting a new initiative in a community in the same niche. Your blog provided us valuable information to work on. You have done a outstanding job! FCPX

    ReplyDelete
  45. it is very excellent blog and useful article thank you for sharing with us , keep posting Ruby on Rails Online Training India

    ReplyDelete
  46. Hi,

    Thank you for sharing useful information

    Looking attractive and high quality Ecommerce Portal Development services with low cost if you find more details about our Ecommerce portal design and development so please feel free to contact us.

    Website Designing and Development

    Ecommerce Portal Design and Development
    Dynamic Ecommerce Portal Designing
    PHP Website Development Bangalore
    Wordpress Website Development

    ReplyDelete
  47. Thanks for sharing the above information with us, admin. IT company is the best way to enhance the profit of the business. IT services are doing their amazing role in business development.

    Website Development Company in Lucknow | Software Company in Lucknow

    ReplyDelete
  48. Really it was an awesome article… very interesting to read…
    Thanks for sharing.........
    best Web Development company in India

    ReplyDelete
  49. Hi Dear,

    I really prefer your blog..! This blog are very useful for me and other. So i see it every day.

    Rhoynar software stands as top "Web development agency" in Boulder & Denver, CO area. We deliver "Android app development" by our highly skilled android app.

    Visit Now - https://www.rhoynar.com/

    Thank You,,,

    ReplyDelete

  50. Windows RDP Server can be found in various USA spots. buy remote desktop protocol You may get USA RDP online with distant desktop 7 and prompt activation. You may utilize the RDP host to get online dating sites on Match.com, Zoosk, e-harmony, ok cupid, etc..

    ReplyDelete
  51. Thank you for sharing this powerful article, your explanation is clear and very easy to understand. Please kindly visit our site to get more information about IT solution.SEO Company in Pakistan

    ReplyDelete
  52. This is very helpful for me. Thanks you very much for this awesome article guide.
    Web Development Services Islamabad

    ReplyDelete
  53. This is very interesting site having information about website development which can be very useful for students and professionals.
    Best website and Software development
    Service corner is the best website and software development company in Lucknow having a variety of services like website designing and development , Promote your business in the digital world in affordable price.
    Not only provide the service in your budget, but we also care for quality and time duration.

    ReplyDelete
  54. Nice article. Yes,With Mobile applications business can grow as expected.The great thing about apps is that they are in use both offline and online.
    web development services Islamabad

    ReplyDelete
  55. Web design company actually operate with business website's Containing block, Geometrical figures and shapes, Navigation, Graphical Design Patterns, Whitespace, Drop shadows and depth, Particle backgrounds, Mobile Friendly Designs, ChatBots, Scrolling Effects, Asymmetry and broken grid layouts for achieving clean responsive web design for your business website. Rest of the operations like Search Engine Optimization, Analytics, Marketing, Partnership, Enhance the rate of conversion, Mobile Application, Logo, Presentation and Video should taken care by another domain specific company.

    ReplyDelete
  56. Nicely picked details, many thanks to the author. It’s incomprehensive in my experience at present, however in common, the convenience and importance is mind-boggling. Regards and all the best .. web development new york

    ReplyDelete
  57. I have been reading your posts regularly. This time your blog about Web Development such a fantastic blog. I need to say that you are doing a fantastic job. Please keep up the great work.

    ReplyDelete
  58. Thank You For sharing usefull Information. Please keep sharing

    Web Design and Development Company Nagpur

    ReplyDelete
  59. Thank You For sharing usefull Information. Please keep sharing

    Web Design and Development Company Nagpur

    ReplyDelete
  60. The good news is that making a superb business website will not be a challenge for you because we are here to help. We are one of the renowned software development companies in LosAngeles, and we have significant achievements in web development also.We have skilled developers in our team who believe in turning good concepts into superior creations for our clients. We can create content-rich sites. Plus, we ensure that we provide user-friendly tools to our clients so that they edit the content of their website without a problem.

    ReplyDelete
  61. You have noted very interesting points ! ps nice website . web development new york

    ReplyDelete
  62. Useful Information, your blog is sharing unique information....
    Thanks for sharing!!!Software Development company Lucknow

    ReplyDelete
  63. Nice information.. Thanks for sharing this blog. see my website also
    Website Designing Company in delhi which will help you to get a professional website at affordable cost .we provide web designing Services solutions to our valuable clients.... VIEW MORE:- Website Designing Company in Delhi

    ReplyDelete
  64. Informative information. Thanks for sharing...!! SEO Company in India

    ReplyDelete
  65. I found your blog very interesting and informative. Thanks for sharing.
    Web Development Company in Lucknow

    ReplyDelete
  66. Cool stuff you have and you keep overhaul every one of us Dedicated Servers Hosting in US

    ReplyDelete
  67. Amazing blog you have shared. Great piece of information. Very informative. I appreciate to blogger for an amazing post. Thanks for sharing this with us.
    website development company in india

    ReplyDelete
  68. Great Article. Thanks for sharing this and update us with latest articles about Web Development Phoenix Arizona

    ReplyDelete
  69. Thanks for sharing this informative post. Really interested to keep in touch with this kind of valuable information. web development

    ReplyDelete
  70. Emulate Infotech Pvt. Ltd is the best Web Design and Development Company in Lucknow providing high quality and cost effective services including responsive web designing, re-designing, ecommerce website development and shopping cart development. Web Designing in Lucknow | Website Development Company in Lucknow

    ReplyDelete
  71. Thanks for sharing such a great information.. It really helpful to me..I always search to read the quality content and finally i found this in you post. keep it up!
    CSIR NET JRF MATHEMATICS RESULT

    ReplyDelete

  72. Lopamudra Creative is a multifarious design and creative advertising agency in Delhi and Gurgaon, India,Choosing a creative agency to create advertising for your company can be

    confusing and difficult.
    App Design Company India
    creative agency in gurgaon
    creative app design agency
    advertising agencies
    advertising agency in gurgaon
    marketing and advertising companies
    best advertising agency in india

    ReplyDelete
  73. Thanks for sharing this information with us and it was a nice blog.You can visit here if you are looking for a Digital Marketing Services
    Digital Marketing Agency
    Digital Marketing Company
    advertising agency in gurgaon
    Digital Marketing Services
    Digital Marketing India

    ReplyDelete
  74. Nice blog.. thanks for sharing such information...!! Java Development Company

    ReplyDelete
  75. This comment has been removed by the author.

    ReplyDelete
  76. Excellent blog! Thank you for posting this informative blog. Here is a piece of good information regarding Web Development. Keep more sharing.

    ReplyDelete
  77. hi,

    Thank you for sharing information about designing. This blog is Very Useful For me.

    Stationery Designer in delhi

    ReplyDelete
  78. Nice post, very useful blogs with very useful information, thank you for sharing this post web application development company

    ReplyDelete
  79. Actually, I am facing some difficulties to understand the meaning of the blog. If you have any short video film related to your blog, then I would request you to share here. It would be great help.
    รับออกแบบโบรชัวร์

    ReplyDelete
  80. Thank you for sharing such great information very useful to us.
    Web Designing Training in Noida

    ReplyDelete
  81. This is really a worthy and wonderful blog to read and further more tips on the web designing have been learnt. thanks for sharing your views among us and its great time spending on this. thank you Marble slabs Sydney,Marble Sydney

    ReplyDelete
  82. That's great information. Thanks for sharing this blog. I did a search and found your blog and glowing review. It's been a big help! Thanx for sharing
    Website Development Services

    ReplyDelete

  83. This article is very informative and helpful with great piece of information. Thanks for sharing. I would like to keep updated with this website.
    Best freelance php developer India
    Best Web Designing Company in Delhi

    ReplyDelete
  84. There is noticeably big money to understand about this. I suppose you made particular nice points in features also. web design

    ReplyDelete
  85. I read that Post and got it fine and informative.Webdesign

    ReplyDelete
  86. Web Development Company in Lahore


    CodeNinja.pk is digital products production studio, web development company in lahore web design seo digital marketing mobile app with creative mind innovation

    ReplyDelete
  87. The the next occasion I just read a weblog, I really hope it doesnt disappoint me as much as this one. Come on, man, I know it was my method to read, but When i thought youd have something interesting to state. All I hear can be a handful of whining about something you could fix when you werent too busy looking for attention. kocaeli web tasarım

    ReplyDelete
  88. Excellent Blog About Web Design !!
    Really Appreciated !!
    Thanks For Posting This Blog !!
    Have A Look At Our Site Also Web Developer

    ReplyDelete
  89. Awesome post. You Post is very informative. Thanks for Sharing.
    Web Development course in Noida

    ReplyDelete

  90. Thanks for sharing the blog, seems to be interesting and informative too.app development company in bhopal

    ReplyDelete
  91. Nice blog, very interesting to read
    I have bookmarked this article page as i received good information from this.
    Web Development company in Indore

    ReplyDelete
  92. Are you looking for a brand that can provide amazing service of Website development in Ludhiana? If yes then get in touch with Flymedia Technology which is known for its amazing results of web development.

    ReplyDelete
  93. Along with striking web designs and digital marketing tactics, we deal in SEO. Experience competent Search Engine Optimization in Delhi with us and get the best rankings in search engines. Partner with us and we assure you to provide a niche to your never-ending online visibility.

    ReplyDelete
  94. Thanks for your great post.We are the leading seo company in mumbai. Hire our seo agency in mumbai today for seo services in mumbai

    ReplyDelete
  95. The details you've shared here areIt’sextremely instructive because it contains some best knowledge, which is extremely helpful. Thanks for posting it. PHP Training in delhi

    ReplyDelete
  96. Are you looking for the best Website designing company in Ghaziabad? If yes then connect with CSS Founder that can provide you the exact website design that you want for your website.

    ReplyDelete
  97. CSS Founder Pvt. Ltd. There is a company that designs website and ranks website and has been providing its service in this field for the last many years and has achieved the first position in this field, if you want to know more information visit here
    Web design company Portland

    ReplyDelete
  98. Thank you because you have been willing to share information with us. we will always appreciate all you have done here
    Website design company in Jalgaon

    ReplyDelete
  99. If you want to increase your business through a website, then contact us. because We are the best website design company that provides services in this digital world.
    Web design company Nottingham

    ReplyDelete
  100. Looking for the best appartment at the best location "Noida & Noida Extension" then you must connect with Exotica Housing. We can be the right choice for you.
    Top Builders in Noida Extension

    ReplyDelete
  101. Nice blog..! I really loved reading through this article... Thanks for sharing such an amazing post with us and keep blogging. we also have a website that provides Custom Web Development Services Mohali,India.

    ReplyDelete
  102. Very unique information I got here. so many blogs I search and I find but your blog is a different blog than others great job you have done. Website design company in Manjeri

    ReplyDelete
  103. Business gets a new identity through the website and no one can build a good and reliable website from CSS Founder, there is no one better than CSS Founder in the field of website design.
    Website designing company in allahabad

    ReplyDelete
  104. Nice post, As you all guys know PHP / Laravel programming and PHP also have a collection of errors so i am specifying some errors below.
    composer detected issues in your platform

    ReplyDelete
  105. You can connect with Al Mumtaz Tents companies if you are looking for the best tents for party and events. We also provide car parking shades, ramadan tents, and so on. Sun Shades

    ReplyDelete
  106. Senior movie ask enough expert better fill. Measure future purpose deal for cup. Share teach what home. Anyone art only recent.latest news headlines

    ReplyDelete
  107. CMOLDS Dubai is a leading web development dubai company offering and providing complete and authentic solutions and services in this domain.

    ReplyDelete