💼 IT4206 Enterprise Application Development (2023)
UCSC BIT | MCQ Solutions with Simple Theory & Examples
Java Persistence API (JPA)
Theory: JPA helps Java programs communicate with relational databases (MySQL, Oracle) using Java objects instead of raw SQL.
Example: entityManager.find(Student.class, 1); automatically fetches the student.
Memory Trick: JPA = Java ↔ Database
Where do discount calculations go?
Theory: Business rules (like calculating VIP discounts or taxes) belong in the Business Logic Tier.
Example: If customer is VIP → 20% discount. This calculation happens here.
Distributing Standalone Java Apps
Theory: A JAR (Java Archive) file packages Java programs into one executable file.
Example: Run using java -jar MyApp.jar. Easy to share!
Handling SOAP & REST
Theory: The Web Tier receives requests from browsers/apps and handles HTTP, REST APIs, and SOAP Web Services.
Flow: Mobile App → REST Request → Web Server → Business Logic → Database.
Java EE Deployment
Theory: Java EE applications run inside an Application Server (like Tomcat or WildFly), which manages security, sessions, and transactions.
Example: Online Banking runs on a server (Java EE), while a Desktop Calculator runs directly on your PC (Java SE).
WebSocket Imports
Theory: You only need to import packages for annotations actually used in the code. If the code uses @ServerEndpoint and @OnMessage, only those two are required.
Memory Trick: Import only what you use.
WebSocket Communication
Theory: WebSocket creates a lightweight, bi-directional connection. The server can push data anytime without reconnecting.
Example: WhatsApp live chat. Both users can send messages anytime.
Memory Trick: WebSocket = Live Chat
Requesting Information
Theory: The GET method is used to request/read data from a web server.
Example: Opening www.amazon.com sends a GET request to fetch the webpage.
Memory Trick: GET = Get Data
HTTP Redirection
Theory: HTTP status codes in the 300 range indicate redirection (e.g., 301 Moved Permanently).
Memory Trick: 300 = Move Somewhere Else
Java Inside HTML
Theory: JSP (JavaServer Pages) allows Java code to be written inside HTML to generate dynamic web pages.
Example: Welcome <%= "Nimal" %> outputs "Welcome Nimal".
Memory Trick: JSP = Java Inside HTML
RequestDispatcher.forward()
Theory: Transfers the same request and response from one servlet to another. The browser URL does NOT change.
Example: LoginServlet forwards to Dashboard.jsp.
Memory Trick: forward() = Go to another page
Marking Old Methods
Theory: @Deprecated warns developers that a method is outdated and should not be used in new programs.
Memory Trick: Deprecated = Old Method
Hiding Compiler Warnings
Theory: Tells Java to ignore unnecessary compiler warnings (e.g., @SuppressWarnings("unchecked")).
Memory Trick: Suppress = Hide
JSP Elements
Theory: The 4 main JSP elements are:
- Declaration:
<%! int x=10; %>(Variables) - Scriptlet:
<% out.println("Hi"); %>(Java code) - Expression:
<%= name %>(Output) - Directive:
<%@ page ... %>(Instructions)
Memory Trick: DSED
Servlet Initialization Parameters
Theory: Defines configuration values for a servlet during initialization instead of hardcoding them.
Memory Trick: Init = Initial Settings
ServletContextListener
Theory: Listens to the web app lifecycle. contextInitialized() runs on start, contextDestroyed() runs when the app stops.
Memory Trick: Destroyed = Application Closed
Executing Java Code in JSP
Theory: The Scriptlet tag <% ... %> is used to execute Java code on the server.
Memory Trick: Scriptlet = Java Code
Correct JSON Syntax
Theory: JSON stores data as "Key":"Value". It strictly requires double quotes for keys and string values.
Memory Trick: JSON uses DOUBLE QUOTES
Destroying a Session
Theory: When a user logs out, session.invalidate(); destroys their session completely.
Memory Trick: Logout = invalidate()
Handling HTTP Requests
Theory: In the Servlet lifecycle, service() handles every client request and decides whether to call doGet() or doPost().
Memory Trick: service() = Handle Requests
Quick Revision (All 25 Questions)
| Q | Answer | Memory Trick |
|---|---|---|
| 1 | JPA | Java ↔ Database |
| 2 | Business Tier | Business Rules |
| 3 | JAR | Java Package |
| 4 | Web Tier | REST & SOAP |
| 5 | App Server | Java EE |
| 6 | a,b,c | Apache = Server |
| 7 | Session Bean | One Client |
| 8 | @PrePassivate | Before Passivation |
| 9 | Passive | Sleeping State |
| 10 | @ServerEndpoint | WebSocket |
| 11 | Only a,b | Import Used Packages |
| 12 | a,b,d | Live Communication |
| 13 | GET | Read Data |
| 14 | 300 | Redirection |
| 15 | JSP | Java in HTML |
| 16 | forward() | Transfer Request |
| 17 | @Deprecated | Old Method |
| 18 | @SuppressWarnings | Hide Warnings |
| 19 | DSED | JSP Elements |
| 20 | @WebInitParam | Initial Settings |
| 21 | contextDestroyed() | Application Stops |
| 22 | <% ... %> | Scriptlet = Java Code |
| 23 | "Key":"Value" | Double Quotes |
| 24 | invalidate() | Logout |
| 25 | service() | Handles Requests |
🎯 Exam Tips
- JPA → Connects Java applications to relational databases.
- Business Logic Tier → Contains business rules like discounts and tax calculations.
- Web Tier → Handles HTTP, REST, and SOAP communication.
- WebSocket → Enables two-way (bi-directional) communication.
- Servlet Lifecycle → init() → service() → destroy().
- Session → invalidate() logs the user out.
- JSON → Uses "key":"value" format with double quotes.
❓ Frequently Asked Questions (FAQ)
session.invalidate() method, which is typically used during user logout.
<%! %>), Scriptlets (<% %>), Expressions (<%= %>), and Directives (<%@ %>).
🎓 Expert ICT, Coding, School Classes, Digital Marketing & University Project Guidance
Struggling with your university final year project? Want to master coding, upscale your business with expert digital marketing, or learn absolute computer basics from scratch? We offer high-quality individual and group online classes conducted in English, Sinhala, or Tamil mediums. Get guaranteed academic success and professional growth with tailored guidance.
🎓 University Final Year Project Guidance & AI
Get specialized, end-to-end mentoring and technical support to pass your degree or master's program with flying colors:
- 🏫 Targeted Institutes: Expert guidance tailored for BIT UCSC, UoM, SLIIT, NIBM, and other leading universities.
- 🔬 Postgraduate Support: Comprehensive assistance for MSc Software Final Year Projects.
- 🤖 AI & Smart Applications: Step-by-step implementation of AI, Machine Learning (ML), and automation modules.
- ✅ Guaranteed Success: Help with documentation, system architecture, coding, and viva preparation.
🏫 School ICT & Corporate Beginner Classes
- 💻 Non-IT Staff Computer Basics: Absolute beginner-friendly online classes covering essential computer skills, office tools, and internet operations.
- 🎒 Primary & Secondary (Grades 1-10): Interactive online ICT classes tailored to build strong foundations from early ages.
- 📝 Exam Prep: Dedicated training packages for GCE O/L, GCE A/L ICT, and GIT exams.
- 🌍 Global Syllabuses: Complete curriculum coverage for Local, Edexcel, and Cambridge in English & Tamil Mediums.
📢 Software Development & Digital Marketing Services
- ⚙️ Software & Web Development: Professional custom software application and website development built using PHP & MySQL.
- 🎯 Social Media Management: Content creation, publishing, and channel management for Facebook, Instagram, TikTok, and YouTube.
- 📈 Ad Boosting: Highly targeted paid advertising campaigns to drive leads, traffic, and sales to your business.
📞 Connect With Us Instantly
Book your slot for online classes or get a premium tech service quote today!
💬 WhatsApp: +94 729622034
📧 Email: ITClassSL@gmail.com
🌐 Explore Our Resources & Communities
Stay updated with our latest tutorials, project ideas, and student guides across all our official platforms:
- 📺 YouTube Tutorials: Subscribe to our Channel
- 💼 Professional Network: Connect on LinkedIn
- ✍️ Tech Blog: Visit our WordPress Site
- ❓ Project Q&A: Follow our Quora Guide Profile
- 📰 Monthly Updates: Read Our Newsletter
- 🌐 Official Portfolios: Wix Site | Google Business | Strikingly Portfolio
- 🗣️ Student Forum: Join our ElaKiri Discussion Thread