Sunteți pe pagina 1din 4

Bachelor of Computer Application (BCA) Semester 4 BC0047 (Book ID : B0831) Java Programming 4 Credits Assignment Set - I (40 Marks)

Answer all the questions. 1. How is Java is different than any other OOP language like C++? Explain. Following are the five services provided by operating systems.

2.

Write a program in Java to find the highest of any five numbers. How do you compile and execute this Java Program? The kernel became large and difficult to manage. In the mid-1980s, researches at Carnegie Mellon University developed an operating system called Mach that modularized the kernel

3. 4. 5.

Write a simple Java program to illustrate the use of for loop statement. What do you mean by array? Explain with example. Write a program to explain the Exception Handling mechanisms in Java using the keywords: try, catch and finally. Define i) Inheritance ii) Package and iii) Interface.

6.

Bachelor of Computer Application (BCA) Semester 4 BC0047 (Book ID : B0831) Java Programming 4 Credits Assignment Set - 2 (40 Marks)

Answer all the questions. 1. What are the uses of FileInputStream and FileOutputStream? Write short notes on each. The FileInputStream and FileOutputStream Classes These streams are classified as mode streams as they read and write data from disk files. The classes associated with these streams have constructors that allow you to specify the path of the file to which they are connected. The FileInputStream class allows you to read input from a file in the form of a stream. The FileOutputStream class allows you to write output to a file stream. Example FileInputStream inputfile = new FileInputStream (Employee.dat); FileOutputStream outputfile = new FileOutputStream (binus.dat); 2. Write an applet program to change the background colour of an applet window as soon as you click on a button.
import java.awt.*; // Defines basic classes for GUI programming. import java.awt.event.*; // Defines classes for working with events. import java.applet.*; // Defines the applet class. public class Test extends Applet implements ActionListener { int colorNum; public void init() { setBackground(Color.red); colorNum = 1; Button bttn = new Button("Change Color"); bttn.addActionListener(this); add(bttn); } public void paint(Graphics g) { switch (colorNum) { case 1: setBackground(Color.red); break; case 2: setBackground(Color.blue); break; case 3: setBackground(Color.green); break; } g.drawString("Hello World!", 20,70);

} public void actionPerformed(ActionEvent evt) { if (colorNum == 1) colorNum = 2; else if (colorNum == 2) colorNum = 3; else colorNum = 1; repaint(); } }

3.

What are the uses of ODBC, JDBC and Driver Manager? ODBC : ODBC is an abbreviation of Open Database Connectivity, a standard database access method developed by Microsoft Corporation. The goal of ODBC is to make it possible to access any data from any application, regardless of which database management system (DBMS) is handling the data. ODBC manages this by inserted a middle layer, called a driver, between an application and the DBMS. The purpose of this layer is to translate the queries of the application into commands that the DBMS understands. For this to work, both the application and the DBMS must be ODBC-compliant-that is, the application must be capable of issuing ODBC commands and the DBMS must be capable of responding to them. JDBC : JDBC provides a database-programming interface for Java programs. Since the ODBC is written in C language, a Java program cannot directly communicate with an ODBC driver. JavaSoft created the JDBC-ODBC Bridge driver that translates the JDBC API to the ODBC API. It is used with ODBC drivers. JDBC Driver Manager : The JDBC driver manager is the backbone of the JDBC architecture. The Function of the JDBC driver manager is to connect a Java application to the appropriate driver.

4.

Write short notes on (i) RMI and (ii) CORBA RMI : Distributed applications are applications that execute across multiple host system. Objects executing on one host system can invoke the methods of objects on remote hosts. The remotely invoked methods can return values to the local objects. There are different approaches used for developing distributed applications. The Internet and the Web are examples of distributed systems that have been developed using the Client/Server approach. The transfer of data is one of the most important processes in distributed applications. The default implementation of the message passing method in Java transfers data from the calling object to the called object within a single Java Virtual Machine (JVM). You have learned how to cross process boundaries to transfer the data from one host to the other using sockets. Another way to achieve the same in using Remote Method Invocation (RMI), which allows objects in different hosts to send and receive messages. Both the methods achieve the same goal. However, the method calls approach used by RMI in much easier to use. RMI allows objects in different JVMs belonging to different hosts to send and receive message. CORBA : CORBA stands for Common Object Request Broker Architecture. RMI, discussed in previous section with RMI is that, it needs the 2 objects participating in communication be

written in Java CORBA is a distributed computing technology where the participating objects need not only be written in Java. 5. Write an essay on history of web application. History of Web Application : While servlets can be used to extend the functionality of any Java-enabled server, today they are most often used to extend web servers, providing a powerful, efficient replacement for CGI scripts. When you use servlet to create dynamic content for a web page or otherwise extend the functionality of a web server, you are in effect creating a Web application. While a web page merely displays static content and lets the user navigate through that content, a web application provides a more interactive experience. A web application may be as simple as a key word search on a document archive or as complex as an electronic storefront. Web applications are being deployed on the internet and on corporate intranets and extranets, where they have the potential to increase productivity and change role of servlets in any web application it is necessary to understand the architecture of any current web application.

S-ar putea să vă placă și