0% found this document useful (0 votes)
24 views16 pages

Mca Ii Sem Lab Viva Questions

MCA II SEM LAB VIVA QUESTIONS

Uploaded by

nayeem.vsrnvr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views16 pages

Mca Ii Sem Lab Viva Questions

MCA II SEM LAB VIVA QUESTIONS

Uploaded by

nayeem.vsrnvr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

MCA 203 :: WEB TECHNOLOGIES

UNIT-I
1. What are Java Buzzwords? Name any five.
Java buzzwords describe Java's features; examples include simple, object-oriented,
portable, robust, and secure.

2. Explain the concept of Platform Independence in Java.


Java code runs on any OS with JVM, making it platform-independent.

3. What is JVM? How is it different from JRE and JDK?


JVM executes bytecode; JRE includes JVM + libraries; JDK includes JRE + development
tools.

4. What is the difference between a class and an object in Java?


A class is a blueprint; an object is an instance of that class.

5. What is inheritance? How is it implemented in Java?


Inheritance allows a class to acquire properties of another using the extends
keyword.

6. What is polymorphism? Explain method overloading and overriding.


Polymorphism allows multiple forms; overloading = same method name, different
params; overriding = subclass redefines parent method.

7. What is encapsulation? How is it achieved in Java?


Encapsulation hides data using private fields and public getters/setters.

8. Define abstraction with an example.


Abstraction hides complexity; e.g., abstract Shape class with draw() method.

9. What is dynamic binding? How is it different from static binding?


Dynamic binding resolves method calls at runtime, static binding does so at compile
time.

10. What is the difference between an abstract class and an interface?


Abstract class can have both implemented and abstract methods; interface is fully
abstract (Java 7) or partially (Java 8+).

11. Can an interface have method definitions in Java? Explain with Java 8+ context.
Yes, Java 8 introduced default and static methods in interfaces.

12. Why do we use packages in Java? How do you create and import a package?
Packages group related classes; use package to create and import to use.
13. Can a class implement multiple interfaces? Explain with an example.
Yes; class A implements X, Y is valid and allows multiple inheritance.

14. What are access specifiers in Java? Give examples.


They define access levels: public, private, protected, and default.

15. What is the use of the final keyword in Java?


final is used to make variables constant, methods non-overridable, and classes non-
inheritable.

16. What is the difference between AWT and Swing?


AWT is heavyweight using native OS components, while Swing is lightweight and
platform-independent.

17. Explain the concept of Event Handling in Java.


Event handling captures user actions and triggers responses using listeners.

18. What are the components of MVC architecture? How is it used in Swing?
MVC has Model (data), View (UI), Controller (logic); Swing separates logic and UI
using MVC.

19. Name and describe the hierarchy of major Swing components.


JComponent > Container > Components like JFrame, JButton, JPanel, etc.

20. What is a container in Swing? Give examples.


A container holds other components; examples: JFrame, JPanel, JDialog.

21. Explain the use of JFrame, JPanel, and JDialog.


JFrame is a main window, JPanel is a section within it, JDialog is a popup dialog.

22. Write a simple Swing program to display a button.

JFrame f = new JFrame(); f.add(new JButton("Click")); f.setSize(200, 200); f.setVisible(true);

23. What is a layout manager? Why is it important?


It controls component placement and resizing; ensures organized GUI design.

24. Compare and contrast BorderLayout and GridLayout.


BorderLayout divides into 5 regions; GridLayout arranges in rows and columns.

25. What are the steps to handle an event generated by a JButton?


Create ActionListener, register with addActionListener(), and override
actionPerformed().
UNIT-II
1. What is HTML and why is it used?
HTML (HyperText Markup Language) is used to create and structure content on web
pages.

2. Differentiate between ordered and unordered lists in HTML.


Ordered lists (<ol>) are numbered; unordered lists (<ul>) use bullets.

3. How do you create a table in HTML? List some table tags.


Use <table>, with tags like <tr>, <td>, <th>, <thead>, and <tbody>.

4. Which tag is used to insert an image in HTML? What are the required attributes?
The <img> tag is used with src and alt attributes.

5. What is the use of the <form> tag in HTML?


It is used to collect user input and send data to a server.

6. Explain different form elements used in HTML.


Form elements include <input>, <textarea>, <select>, <button>, and <label>.

7. What is the purpose of the <iframe> tag? How is it different from <frame>?
<iframe> embeds another page within a page; <frame> is used inside <frameset> and
is deprecated.

8. What are Frames in HTML? Why are they not used in modern HTML5?
Frames divide the browser into sections; not used now due to usability, SEO, and
mobile issues.

9. What is CSS? How does it differ from inline styling?


CSS (Cascading Style Sheets) styles HTML elements externally or internally; inline
styles are applied directly in the tag.

10. List and explain the three types of CSS with examples.
Inline (style attribute), internal (<style> tag), and external (<link> tag referencing .css
file).

11. What is JavaScript? How is it different from Java?


JavaScript is a scripting language for web interactivity; Java is a general-purpose OOP
language.

12. How do you include JavaScript in an HTML document?


Using the <script> tag in the head or body section.

13. What are JavaScript objects? Give an example.


Objects are collections of key-value pairs; e.g., let car = {brand: "Toyota", model:
"Camry"}.
14. What is the difference between == and === in JavaScript?
== compares values with type conversion; === checks both value and type.

15. What is DOM in JavaScript? How is it used for dynamic content?


DOM (Document Object Model) allows JavaScript to access and manipulate HTML
elements.

16. What is Dynamic HTML (DHTML)? How is JavaScript used in it?


DHTML combines HTML, CSS, JavaScript, and DOM to create interactive web pages.

17. How do you create and call a function in JavaScript?


Define using function name() {} and call using name().

18. Explain the concept of event handling in JavaScript with an example.


Event handling executes code in response to user actions; e.g.,
onclick="alert('Clicked!')".

19. How does JavaScript validate form inputs?


By checking values in input fields using conditions before submission.

20. What is the purpose of document.getElementById() method?


It selects and manipulates an HTML element by its ID.

21. What is XML? How is it different from HTML?


XML stores and transports data; HTML displays data and content.

22. What is a DTD (Document Type Definition) in XML? Why is it used?


DTD defines the structure and rules for XML documents to ensure validity.

23. What is an XML Schema? How is it better than DTD?


XML Schema is more powerful and supports data types, namespaces, and stricter
validation than DTD.

24. What is the Document Object Model (DOM)? How does it relate to XML?
DOM is a tree structure representation of XML/HTML used for accessing and
modifying elements.

25. What is the difference between DOM and SAX XML parsers?
DOM loads the whole document in memory for random access; SAX reads it
sequentially and uses less memory.
UNIT-III
1. What is JDBC? Why is it used in Java?
JDBC is an API that allows Java programs to interact with databases.

2. Explain the steps to connect Java with a database using JDBC.


Load driver → establish connection → create statement → execute query → process
results → close connection.

3. What is a JDBC driver? Name the types of JDBC drivers.


JDBC driver is a software component that enables Java to connect to a database;
types: JDBC-ODBC Bridge, Native-API, Network Protocol, and Thin driver.

4. What are the key classes/interfaces used in JDBC?


DriverManager, Connection, Statement, PreparedStatement, CallableStatement, and
ResultSet.

5. What is a Connection object in JDBC? How is it created?


A Connection represents a session with a database, created using
DriverManager.getConnection().

6. Explain the difference between Statement, PreparedStatement, and


CallableStatement.
Statement is for static SQL, PreparedStatement for parameterized queries, and
CallableStatement for stored procedures.

7. What is a ResultSet? How do you retrieve data from it?


ResultSet holds data retrieved from a query; use methods like getString(), getInt(),
etc.

8. What are the advantages of using PreparedStatement over Statement?


It improves performance, prevents SQL injection, and supports dynamic parameters.

9. How can we execute stored procedures using JDBC?


Using CallableStatement and the {call procedure_name(?)} syntax.

10. What is the purpose of executeQuery() vs executeUpdate()?


executeQuery() is for SELECT statements; executeUpdate() is for INSERT, UPDATE, or
DELETE.

11. Why do we need network programming in Java?


To enable communication between distributed systems or across the internet.

12. What are the basic concepts of networking?


IP addresses, ports, protocols (TCP/UDP), sockets, and client-server model.
13. What is the difference between a URL and a URI?
A URL is a specific type of URI that includes network location and protocol.

14. How can you retrieve an IP address in Java using InetAddress?


By using InetAddress.getByName("hostname").getHostAddress().

15. What is a socket in Java? How is it used for communication?


A socket is an endpoint for communication; used to send/receive data over TCP/IP.

16. What is the difference between TCP and UDP protocols in Java networking?
TCP is connection-oriented and reliable; UDP is connectionless and faster but less
reliable.

17. Explain the working of UDP datagrams in Java.


UDP uses DatagramSocket to send/receive DatagramPacket without connection
setup.

18. What is the role of DatagramSocket and DatagramPacket?


DatagramSocket handles sending/receiving, and DatagramPacket holds the data
being sent/received.

19. How can a Java application connect to a remote host?


By using sockets, such as Socket for TCP or URL for HTTP-based connections.

20. What are the classes used for TCP socket programming in Java?
Socket (client), ServerSocket (server), and InputStream/OutputStream for data.

21. What is RMI in Java? What problem does it solve?


RMI allows one Java object to call methods on another Java object in a different JVM,
enabling distributed applications.

22. What are the main components of a Java RMI application?


Remote interface, implementation class, server, client, and rmiregistry.

23. How does RMI differ from traditional socket programming?


RMI works at the object level with method calls, while sockets deal with byte
streams.

24. What is the use of the rmiregistry tool?


It registers and looks up remote objects for clients to access in RMI.

25. Explain the role of stub and skeleton in RMI communication.


Stub acts as client-side proxy; skeleton (Java 1.1) on the server handles method call
routing (later replaced internally by dynamic proxies).
UNIT-IV
1. What is a Web Server? What is Tomcat and why is it used?
A web server handles HTTP requests; Tomcat is a Java-based server that runs Servlets
and JSPs.
2. What is a Servlet in Java?
A Servlet is a Java class that handles HTTP requests and generates dynamic web
content.
3. Explain the lifecycle of a Servlet.
Lifecycle stages: load → init() → service() → destroy().
4. Which methods are part of the Servlet lifecycle?
init(), service(), and destroy() methods.
5. What is the difference between init(), service(), and destroy() methods?
init() runs once on startup, service() handles requests, and destroy() runs before
shutdown.
6. What is JSDK? How is it related to Servlets?
JSDK (Java Servlet Development Kit) provides APIs to build and test Servlets.
7. What is the purpose of the javax.servlet package?
It contains core interfaces and classes for writing Servlets.
8. How can a Servlet read request parameters sent by the client?
Using request.getParameter("name") method.
9. What are initialization parameters in a Servlet? How are they defined and read?
Configured in web.xml, accessed using getInitParameter().
10. What is the difference between doGet() and doPost() methods in HTTP Servlet?
doGet() is for fetching data; doPost() is for submitting form data securely.
11. What is the HttpServletRequest and HttpServletResponse interface used for?
They handle incoming client data and outgoing server responses.
12. How do Servlets handle HTTP requests and responses?
By overriding doGet() or doPost() using request and response objects.
13. What is a Cookie? How are cookies created and used in Servlets?
A cookie stores client data; use new Cookie(), add with response.addCookie().
14. What is session tracking? List different ways to track a session in a web application.
Session tracking keeps user data across pages; methods: Cookies, URL rewriting,
Hidden fields, HttpSession.
15. What are the security concerns related to Servlets and Web applications?
Include data interception, session hijacking, input validation, and authentication
flaws.
16. What is JSP? How is it different from Servlets?
JSP allows embedding Java in HTML; Servlets are Java code handling HTML
generation.
17. What is the main problem with using only Servlets in web applications?
Mixing HTML and Java in Servlets makes code complex and hard to maintain.
18. What is the structure or anatomy of a typical JSP page?
Contains HTML, directives, declarations, scriptlets, and expressions.
19. Explain the lifecycle or phases of JSP processing.
Phases: Translation → Compilation → Initialization → Execution → Destruction.
20. What are the scripting elements in JSP? (Declarations, Scriptlets, Expressions)
Declarations: <%! %>, Scriptlets: <% %>, Expressions: <%= %>.
21. How does JSP follow the MVC design pattern?
JSP acts as View, Servlet as Controller, and Java Beans/Classes as Model.
22. What is the role of JSP in the MVC architecture?
JSP is used to present data (View) generated by the Controller.
23. How do you set up the JSP environment on a system?
Install JDK, Apache Tomcat, and set environment variables.
24. How do you install and configure Tomcat server for JSP/Servlet development?
Download Tomcat → extract → set JAVA_HOME → run startup.bat/startup.sh.
25. How can you test that Tomcat is installed correctly?
Open http://localhost:8080 in a browser and check for the Tomcat welcome page.
MCA 205.1 :: PROGRAMMING AND PROBLEM SOLVING
USING PYTHON

UNIT-I
1. What is computational problem solving?
It is the process of designing an algorithm and implementing it to solve a real-world
problem using computation.

2. What is Python and why is it popular?


Python is a high-level, interpreted language known for its simplicity, readability, and
wide applicability.

3. What are expressions in Python?


Expressions are combinations of values, variables, operators, and function calls that
return a result.

4. How do you declare and assign a variable in Python?


Use simple assignment like x = 10 without specifying the data type.

5. What is dynamic typing in Python?


Variables can change types at runtime based on the assigned value.

6. What are the basic data types in Python?


int, float, str, bool, list, tuple, set, and dict.

7. How are strings defined and manipulated in Python?


Strings are defined using quotes and can be manipulated using slicing and string
methods like .upper() or .split().

8. What is a list in Python and how is it different from a tuple?


A list is a mutable, ordered collection; tuples are similar but immutable.

9. What is an object in Python?


Everything in Python is an object, with attributes and methods.

10. What is a class in Python?


A class is a blueprint for creating objects with specific attributes and methods.

11. What is the Python Standard Library?


It is a collection of built-in modules providing functions for tasks like math, file I/O,
and web access.

12. Give an example of using a standard library in Python.


import math and then use math.sqrt(16) to calculate square root.
13. What is imperative programming?
It is a programming paradigm that uses statements to change a program’s state step
by step.

14. What is the structure of a basic Python program?


It includes imports, function definitions, control structures, and statements inside the
main block.

15. What are control structures in Python?


Control structures include if, if-else, for, while, and break/continue.

16. How is an if-else statement used in Python?


It is used to execute code conditionally, like if x > 0: print("Positive").

17. What is a for loop used for in Python?


To iterate over sequences like lists or ranges.

18. What is a while loop in Python?


It repeatedly executes a block of code as long as a condition is true.

19. How do you define a function in Python?


Using the def keyword, e.g., def greet():.

20. What is the difference between a built-in function and a user-defined function?
Built-in functions are provided by Python (e.g., len()); user-defined are created by the
programmer.

21. What is variable scope in Python?


It refers to the region where a variable is accessible – local, global, or nonlocal.

22. What are the types of parameter passing in Python?


Python uses pass-by-object-reference (also called pass-by-assignment).

23. How do you pass arguments to a function?


By specifying values inside parentheses, e.g., greet("Alice").

24. What is the return statement in Python?


It exits a function and optionally passes back a result.

25. How do you handle default parameters in Python?


Use def greet(name="Guest"): to define a parameter with a default value.
UNIT-II
1. What is the use of the open() function in Python?
➤ It is used to open a file and returns a file object.

2. How do you read data from a text file in Python?


➤ Use read(), readline(), or readlines() methods after opening the file.

3. How do you write data to a text file in Python?


➤ Use write() or writelines() with a file opened in write ("w") or append ("a") mode.

4. What is formatted output in Python?


➤ It refers to output generated using format(), f-strings, or % formatting.

5. What is the difference between text and binary files?


➤ Text files contain human-readable characters; binary files contain byte data.

6. What is an exception in Python?


➤ An exception is an error that occurs during program execution.

7. How is exception handling done in Python?


➤ Using try, except, finally, and raise blocks.

8. What is the purpose of the finally block?


➤ It runs cleanup code whether an exception occurred or not.

9. How is an if statement used in Python?


➤ It executes a block of code if a given condition is true.

10. What is a for loop used for in Python?


➤ It is used to iterate over sequences like lists, strings, or ranges.

11. How does a while loop function in Python?


➤ It executes a block of code repeatedly as long as a condition is true.

12. What is a two-dimensional list in Python?


➤ It is a list of lists used to represent a table or matrix.

13. What is the use of the break statement?


➤ It exits the loop immediately, skipping remaining iterations.

14. What is the use of the continue statement?


➤ It skips the current iteration and moves to the next one.

15. What is the use of the pass statement?


➤ It acts as a placeholder for future code without doing anything.
16. What is a dictionary in Python?
➤ A dictionary is an unordered collection of key-value pairs.

17. How do you access a value in a dictionary?


➤ Use dict[key] to retrieve the value associated with the key.

18. What is a set in Python?


➤ A set is an unordered collection of unique elements.

19. What are common set operations in Python?


➤ Union, intersection, difference, and subset testing.

20. What are the built-in container types in Python?


➤ Lists, tuples, sets, and dictionaries.

21. What is the random module used for?


➤ To generate random numbers or select random items.

22. How do you generate a random integer between 1 and 10?


➤ Using random.randint(1, 10).

23. What is character encoding?


➤ It represents characters as bytes using standards like UTF-8.

24. How do you convert a string into a list of characters?


➤ Use list("hello") to get ['h', 'e', 'l', 'l', 'o'].

25. What is the difference between a list and a dictionary?


➤ A list stores ordered items by index; a dictionary stores key-value pairs.

UNIT-III
1. What are the fundamental concepts of OOP?
➤ Encapsulation, Inheritance, Polymorphism, and Abstraction.

2. How do you define a new class in Python?


➤ Use the class keyword: class ClassName:.

3. What is the purpose of the __init__() method?


➤ It initializes object attributes when a class is instantiated.

4. How do you create a user-defined class object in Python?


➤ By calling the class like a function: obj = MyClass().
5. What is operator overloading in Python?
➤ It customizes behavior of operators like +, == using special methods like
__add__().

6. What is inheritance in Python?


➤ Allows one class to derive from another using class Derived(Base):.

7. What is multiple inheritance?


➤ A class can inherit from multiple classes: class C(A, B):.

8. How do you define a user-defined exception in Python?


➤ By creating a class inheriting from Exception: class MyError(Exception):.

9. What is a namespace in Python?


➤ A namespace is a space where names are mapped to objects (like
variables/functions).

10. What is encapsulation in Python functions?


➤ Local variables are encapsulated within the function’s scope.

11. What is the difference between global and local variables?


➤ Global variables are accessible everywhere; local ones only within a function.

12. How do you access a global variable inside a function?


➤ Use the global keyword before the variable name.

13. What is exception control flow?


➤ Flow of execution when an error occurs is handled using try-except-finally.

14. What is a module in Python?


➤ A file with Python code that can be imported and reused.

15. How does namespace relate to modules?


➤ Each module has its own namespace to avoid variable conflicts.

16. What is an object in Python?


➤ An object is an instance of a class containing data and behavior.

17. What is turtle graphics in Python?


➤ A module that lets you draw using a cursor ("turtle") on the screen.

18. What is modular design in Python?


➤ Designing software in separate, reusable modules for clarity and reuse.

19. What is top-down design?


➤ A technique that breaks a large problem into smaller, simpler components.
20. How do you import a module in Python?
➤ Using import module_name or from module_name import something.

21. What is recursion?


➤ A function calling itself to solve a smaller version of the problem.

22. Give an example of a recursive function.


➤ def factorial(n): return 1 if n==0 else n * factorial(n-1)

23. What is the base case in recursion?


➤ The stopping condition that prevents infinite recursion.

24. What is the difference between recursion and iteration?


➤ Recursion uses self-calls; iteration uses loops to repeat code.

25. What is runtime analysis in recursion?


➤ Measuring how time complexity grows with input size, often using Big O.

UNIT-IV
1. What is Tkinter in Python?
➤ Tkinter is Python’s standard library for building GUI applications.

2. What is a widget in Tkinter?


➤ A widget is a GUI element like a button, label, entry box, etc.

3. How do you create a window using Tkinter?


➤ By calling Tk() from the tkinter module: root = Tk().

4. What is the mainloop() function in Tkinter?


➤ It keeps the GUI window running and listens for events.

5. How do you attach a function to a button click in Tkinter?


➤ Use the command argument in the Button() widget: Button(..., command=func).

6. What is event-based programming in Tkinter?


➤ GUI reacts to user actions like clicks, keypresses using event binding.

7. How do you design a layout in Tkinter?


➤ Using geometry managers like pack(), grid(), or place().

8. What is the purpose of OOP in GUI development?


➤ To create structured, reusable, and modular GUI components as classes.
9. How do you update the GUI dynamically in Tkinter?
➤ Use widget methods like config() or variable tracing.

10. How can you close a Tkinter window programmatically?


➤ By calling root.destroy() or root.quit().

11. What is the World Wide Web (WWW)?


➤ It is a system of interlinked hypertext documents accessed via the internet.

12. What is the Python WWW API?


➤ A set of modules (e.g., urllib, http.client) used for web communication.

13. How do you fetch data from a URL in Python?


➤ Using urllib.request.urlopen(URL) to read web content.

14. What is string pattern matching in Python?


➤ Finding specific text patterns using regular expressions (re module).

15. How do you search for a pattern using re in Python?


➤ Use re.search() or re.findall() for pattern matching in strings.

16. What is a regular expression (RegEx)?


➤ A sequence of characters defining a search pattern.

17. How can you extract email IDs from a text using Python?
➤ Use a regex pattern like \b[\w.-]+@[\w.-]+\.\w+\b with re.findall().

18. What are some applications of string pattern matching?


➤ Data validation, searching, text extraction, input filtering.

19. How do you connect Python with a database?


➤ Using sqlite3.connect('database.db') or with connectors for MySQL/PostgreSQL.

20. What is the use of a cursor in database programming?


➤ A cursor executes SQL queries and fetches results from the database.

21. How do you execute an SQL query in Python?


➤ Use cursor.execute("SQL query") after creating a connection and cursor.

22. How do you prevent SQL injection in Python?


➤ By using parameterized queries like cursor.execute("SELECT * FROM users WHERE
id = ?", (id,)).

23. How do you commit changes to a database in Python?


➤ Use connection.commit() to save insert/update/delete operations.
24. How do you fetch query results in Python?
➤ Use fetchone(), fetchall(), or iterate through the cursor.

25. What is the benefit of using databases in Python programs?


➤ Efficient data storage, retrieval, and management for large or persistent datasets.

You might also like