ROEVER ENGINEERING COLLEGE Elambalur,Perambalur DEPARTMENT OF CSE

Similar documents
Core Java Syllabus. Overview

JAVA. Duration: 2 Months

Core Java Contents. Duration: 25 Hours (1 Month)

File. Long term storage of large amounts of data Persistent data exists after termination of program Files stored on secondary storage devices

Java How to Program, 9/e. Copyright by Pearson Education, Inc. All Rights Reserved.

Learn Java/J2EE Basic to Advance level by Swadeep Mohanty

Basic I/O - Stream. Java.io (stream based IO) Java.nio(Buffer and channel-based IO)

Core Java. Basics of Java. String Handling. OOPS Concepts. Exception Handling

Contents. iii Copyright 1998 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services August 1998, Revision B

Software Development & Education Center. Java Platform, Standard Edition 7 (JSE 7)

Application Development in JAVA. Data Types, Variable, Comments & Operators. Part I: Core Java (J2SE) Getting Started

Complete Java Contents

Software 1 with Java. Recitation No. 9 (Java IO) December 10,

A Quick Tour p. 1 Getting Started p. 1 Variables p. 3 Comments in Code p. 6 Named Constants p. 6 Unicode Characters p. 8 Flow of Control p.

I/O streams. Byte Streams Character Streams InputStream ByteArrayInputStream FileInputStream FilterInputStream

15CS45 : OBJECT ORIENTED CONCEPTS

The Java I/O System. Binary I/O streams (ASCII, 8 bits) The decorator design pattern Character I/O streams (Unicode, 16 bits)

SNS COLLEGE OF ENGINEERING, Coimbatore

Software 1 with Java. Recitation No. 7 (Java IO) May 29,

Example: Copying the contents of a file

Exceptions and Working with Files

CSC 1214: Object-Oriented Programming

Compaq Interview Questions And Answers

40) Class can be inherited and instantiated with the package 41) Can be accessible anywhere in the package and only up to sub classes outside the

Software 1. Java I/O

[Course Overview] After completing this module you are ready to: Develop Desktop applications, Networking & Multi-threaded programs in java.

CS193j, Stanford Handout #26. Files and Streams

Special error return Constructors do not have a return value What if method uses the full range of the return type?

Input, Output and Exceptions. COMS W1007 Introduction to Computer Science. Christopher Conway 24 June 2003

Object-Oriented Programming in the Java language

JOSE LUIS JUAREZ VIVEROS com) has a. non-transferable license to use this Student Guide

CSC 1214: Object-Oriented Programming

UNIT III - JDBC Two Marks

CSB541 Network Programming 網路程式設計. Ch.2 Streams 吳俊興國立高雄大學資訊工程學系

3. Course Outlines: Specific Objectives Contents Teaching Hours understand the basic concept of java programing. 1. Introduction to Java Language

COMP 213. Advanced Object-oriented Programming. Lecture 19. Input/Output

תוכנה 1 תרגול 8 קלט/פלט רובי בוים ומתי שמרת

PSD1B Advance Java Programming Unit : I-V. PSD1B- Advance Java Programming

Introduction... xv SECTION 1: DEVELOPING DESKTOP APPLICATIONS USING JAVA Chapter 1: Getting Started with Java... 1

CS Internet programming Unit- I Part - A 1 Define Java. 2. What is a Class? 3. What is an Object? 4. What is an Instance?

Files and IO, Streams. JAVA Standard Edition

Lecture 11.1 I/O Streams

Advanced Java Programming

DHANALAKSHMI SRINIVASAN COLLEGE OF ENGINEERING AND TECHNOLOGY ACADEMIC YEAR (ODD SEM)

1 OBJECT-ORIENTED PROGRAMMING 1

Darshan Institute of Engineering & Technology for Diploma Studies

09-1. CSE 143 Java GREAT IDEAS IN COMPUTER SCIENCE. Overview. Data Representation. Representation of Primitive Java Types. Input and Output.

Introduction. Assessment Test. Part I The Programmer s Exam 1

IT6503 WEB PROGRAMMING. Unit-I

Pieter van den Hombergh Richard van den Ham. March 13, 2018

Core Java SYLLABUS COVERAGE SYLLABUS IN DETAILS

CS 251 Intermediate Programming Java I/O Streams

Class Libraries. Readings and References. Java fundamentals. Java class libraries and data structures. Reading. Other References

LTBP INDUSTRIAL TRAINING INSTITUTE

Java Input / Output. CSE 413, Autumn 2002 Programming Languages.

Performing input and output operations using a Byte Stream

Chapter 4 Java I/O. X i a n g Z h a n g j a v a c o s q q. c o m

COURSE DETAILS: CORE AND ADVANCE JAVA Core Java

File Operations in Java. File handling in java enables to read data from and write data to files

CS2 Advanced Programming in Java note 8

B2.52-R3: INTRODUCTION TO OBJECT ORIENTATED PROGRAMMING THROUGH JAVA

Challenges in component based programming. Lena Buffoni

Peers Techno log ies Pv t. L td. Core Java & Core Java &Adv Adv Java Java

PIC 20A Streams and I/O

Contents Introduction 1

PESIT Bangalore South Campus

Computation Abstractions. Processes vs. Threads. So, What Is a Thread? CMSC 433 Programming Language Technologies and Paradigms Spring 2007

Java Fundamentals p. 1 The Origins of Java p. 2 How Java Relates to C and C++ p. 3 How Java Relates to C# p. 4 Java's Contribution to the Internet p.

KINGS COLLEGE OF ENGINEERING DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING ACADEMIC YEAR (ODD SEMESTER) QUESTION BANK

ABOUT CORE JAVA COURSE SCOPE:

Chapter 17 Binary I/O. Liang, Introduction to Java Programming, Eleventh Edition, (c) 2017 Pearson Education, Inc. All rights reserved.

File IO. Computer Science and Engineering College of Engineering The Ohio State University. Lecture 20

Welcome to CIS 068! 1. GUIs: JAVA Swing 2. (Streams and Files we ll not cover this in this semester, just a review) CIS 068

7 Streams and files. Overview. Binary data vs text. Binary data vs text. Readers, writers, byte streams. input-output

How to be a Good Bean

Core Java Syllabus DAY -1 :

Lecture 22. Java Input/Output (I/O) Streams. Dr. Martin O Connor CA166

Overview CSE 143. Input and Output. Streams. Other Possible Kinds of Stream Converters. Stream after Stream... CSE143 Wi

SELF-STUDY. Glossary

Training topic: OCPJP (Oracle certified professional Java programmer) or SCJP (Sun certified Java programmer) Content and Objectives

JAVA & J2EE UNIT -1 INTRODUCTION

Syllabus & Curriculum for Certificate Course in Java. CALL: , for Queries

DOWNLOAD PDF CORE JAVA APTITUDE QUESTIONS AND ANSWERS

Chapter 10. IO Streams

Bharati Vidyapeeth s Institute of Computer Applications and Management A-4, Paschim Vihar, New Delhi-63.

Contents Chapter 1 Introduction to Programming and the Java Language

This course is intended for Java programmers who wish to write programs using many of the advanced Java features.

Overview CSE 143. Data Representation GREAT IDEAS IN COMPUTER SCIENCE. Representation of Primitive Java Types. CSE143 Sp

Overview CSE 143. Data Representation GREAT IDEAS IN COMPUTER SCIENCE

Overview CSE 143. Data Representation GREAT IDEAS IN COMPUTER SCIENCE. Representation of Primitive Java Types. CSE143 Au

Type of Classes Nested Classes Inner Classes Local and Anonymous Inner Classes

Big Java Late Objects

About the Tutorial. Audience. Prerequisites. Disclaimer & Copyright. Avro

Java Overview An introduction to the Java Programming Language

JAVA. 1. Introduction to JAVA

VALLIAMMAI ENGINEERING COLLEGE

CS555: Distributed Systems [Fall 2017] Dept. Of Computer Science, Colorado State University

1993: renamed "Java"; use in a browser instead of a microwave : Sun sues Microsoft multiple times over Java

Table of Contents. Chapter 1 Getting Started with Java SE 7 1. Chapter 2 Exploring Class Members in Java 15. iii. Introduction of Java SE 7...

CS11 Java. Fall Lecture 4

Transcription:

ROEVER ENGINEERING COLLEGE Elambalur,Perambalur-621212 DEPARTMENT OF CSE 2 marks questions with answers CS331-ADVANCED JAVA PROGRAMMING 1. What is Java Streaming? Java streaming is nothing more than a flow of data. There are input streams that direct data from the outside world from the keyboard, or a file for instance, into the computer; and output streams that direct data toward output devices such as the computer screen or a file. 2. What are Byte streams? Byte streams provide a convenient means for handling input and output of bytes. Byte streams are used for example when reading or writing binary data. 3.What are Character streams? Character streams, provide a convenient means for handling input and output of characters. They use Unicode, and therefore, can be internationalized. 4.List some Byte Stream supported classes. BufferedInputStream BufferedOutputStream ByteArrayInputStream ByteArrayOutputStream DataInputStream DataOutputStream 5. List some Character Stream supported classes. BufferedReader BufferedWriter CharArrayReader CharArrayWriter FileReader FileWriter 6. Write note on FileInputStream class. The FileInputStream class creates an InputStream that you can use to read bytes from a file. Its two most common constructors are FileInputStream(String filepath) FileInputStream(File fileobj) 7. Write note on FileOutputStream class.

FileOutputStream creates an OutputStream that you can use to write bytes to a file. Its most commonly used constructors are FileOutputStream(String filepath) FileOutputStream(File fileobj) FileOutputStream(String filepath, Boolean append) They can throw an IOException or a SecurityException. 8. What is the use of the class ByteArrayInputStream? ByteArrayInputStream is an implementation of an input stream that uses a byte array as the source. This class has two constructors, each of which requires a byte array to provide the data source: ByteArrayInputStream(byte array[]) ByteArrayInputStream(byte array[], int start, int numbytes) 9. Write note on the class SequenceInputStream. The SequenceInputStream class allows you to concatenate multiple InputStreams. A SequenceInputStream constructor uses either a pair of InputStreams or an Enumeration of InputStreams as its argument: SequenceInputStream(InputStream first, InputStream second) SequenceInputStream(Enumeration streamenum) 10. Write note on the class PushbackReader. The PushbackReader class allows one or more characters to be returned to the input stream.this allows you to look ahead in the input stream. Its constructors are PushbackReader(Reader inputstream) PushbackReader(Reader inputstream, int bufsize) 11.What is an Event? An event is an object that describes a state change in a source. It can be generated as a consequence of a person interacting with the elements in a graphical user interface. Some of the activities that cause events to be generated are pressing a button, entering a character via the keyboard, selecting an item in a list and clicking the mouse. 12. What is an Event Listener? A Listener is an object that is notified when an event occurs. Only the types of events, which are registered with an event listener will be received by that listener. 13.When does an ActionEvent generate? An ActionEvent is generated when a button is pressed, a list- item is doubleclicked, or a menu item is selected. You can obtain the command name for the invoking ActionEvent object by using the getactionmethod() method. String getactioncommand() 14.When is Component Event generated?

A ComponentEvent is generated when the size, position, or visibility of a component is changed. The getcomponent() method of ComponentEvent returns the component that generated the event. 15.What is an Adapter class? An adapter class provides an empty implementation of all methods in an event listener interface. Adapter classes are useful when you want to receive and process only some of the events that are handled by a particular event listener interface. 16. Define Multithread Programming. A multithreaded program contains two or more parts that can run concurrently. Each part of such program is called a thread, and each thread defines a separate path of execution. Thus, multithreading is a specialized form of multitasking. 17. What is Synchronization? When two or more threads need access to a shared resource, they need some way to ensure that the resource will be used by only one thread at a time. The process by which this is achieved is called synchronization. The general form of the synchronized statement is synchronized (object){ // statements to be synchronized } 18. In multithreading, When does a deadlock situation occur? Deadlock situation occurs, when two threads have a circular dependency on a pair of synchronized objects. 19. What is the need of Thread Priorities? Thread priorities are used by the thread scheduler to decide when each thread be allowed to run. Higher-priority threads get more CPU time than lower-priority threads. To set a thread s priority, use the setpriority() method, which is a member of Thread. final void setpriority(int level) 20.Write note on ArrayList collection class. The ArrayList class extends AbstractList and implements the List interface. ArrayList supports dynamic arrays that can grow as needed. ArrayList can dynamically increase or decrease in size. ArrayList has the constructors: ArrayList() ArrayList(Collection c)

ArrayList(int capacity) 21.Write note on TreeSet collection class. In TreeSet, objects are stored in sorted, ascending order. Access and retrieval times are quite fast, which makes TreeSet an excellent choice when storing large amounts of sorted information. The constructors are: TreeSet() TreeSet(Collection c) TreeSet(Comparator comp) TreeSet(SortedSet ss) 22. What are Maps? A map is an object that stores associations between keys and values or key/value pairs. Given a key, you can find its value.both keys and values are objects. 23.What are Comparators? Comparator defines, in which order the elements in TreeSet or TreeMap has to be ordered. If you want to order elements a different way, then specify a Comparator object when you construct the set or map. 24. Write note on Collection Algorithms. The Collections framework defines several algorithms that can be applied to collections and maps. These algorithms are defined as static methods within the collections class. Several of the methods can throw a ClassCastException, which occurs when an attempt is made to compare incompatible types, or an UnSupportedOperationException, which occurs when an attempt is made to modify an unmodifiable collection. 25. Write note on Collection class Stack. Stack is a subclass of vector that implements a standard last-in, first-out stack. Stack only defines the default constructor, which creates empty stack. Stack includes all the methods defined by Vector, and adds several of its own. 26. What is the need for creating a CustomSocket? The real goal of using a CustomSocket with RMI is to provide some additional functionality such as compression or security. Since the socket itself doesn t do much good without a stream that provides the additional functionality, you must first define a stream for your purposes. 27.What is Remote Method Invocation (RMI)? Remote Method Invocation (RMI) allows a Java Object that executes on one machine to invoke a method of a Java Object that executes on another machine. This is an important feature, because it allows you to build distributed applications. 28. What are stubs and skeletons in RMI?

A stub is Java Object that resides on the client machine. Its function is to present the same interfaces as the remote server. Remote method calls initiated by the client are actually directed to the stub. A skeleton is a Java Object that resides on the server machine. It receives request, performs deserialization, and invokes the appropriate code on the server. 29. What do you meant by Activation in RMI? Activation in RMI has the capability to remotely activate an object. The activator will check the status of the remote object and perform what ever initialization is necessary to get it running again. 30. What is object serialization? Serialization is the process of writing the state of an object to a byte stream. This is useful when you want to save the state of your program to a persistent storage area, such as a file. At a later time, you may restore these objects by using the process of deserialization. 31. Write note on the interface Serializable? An object that implements the serializable interface can be saved and restored by the serialization facilities. The Serializable interface defines no members. It is simply used to indicate that a class may be serialized. If a class is serializable, all of its subclasses are also serializable. 32. What is distributed garbage collection? Freeing up the memory space in the server is called Distributed garbage collection. The java.rimi.dgc package defines the interfaces and classes to implement the distributed garbage collection algorithm. 33. Write note on Interface Definition Language? IDL is part of a language neutral strategy provided by CORBA. Every language has a mapping to and from IDL. These IDL interfaces represent a method calling API that can be used to access your object from other languages, such as c++. 34. What is CORBA? The CORBA is essentially a remote method invocation facility. The ORB is language neutral, meaning you can create objects in any language and use the ORB to invoke methods in those objects.

35. Write note on interfaces in IDL. An IDL interface contains a set of method definitions, just like a Java interface. Like Java interfaces, an IDL interface may inherit from other interfaces. Sample IDL interface is interface MyInterface { }; void mymethod (in long param1); 36. What is a Java Bean? A Java Bean is a software component that has been designed to be reusable in a variety of different environments. There is no restriction on the capacity of a Bean. 37. List some advantages of Java Beans. A Bean obtains all the benefits of Java s Write Once, run-anywhere paradigm. The configuration settings of a Bean can be saved in persistent storage and restored at a later time. A Bean may register to receive events from other objects and can generate events that are sent to other objects. 38. What are JAR files? A JAR file allows you to efficiently deploy a set of classes and their associated resources. Elements in a JAR file are compressed, which makes downloading a JAR file much faster than separately downloading several uncompressed files. 39. Write note on manifest file in Java Beans. Manifest file is used to indicate which of the components in a JAR file are Java Beans. A manifest file may reference several. class file. If a.class file is a Java Bean, its entry must be immediately followed by the line Java Bean : True. 40. what is Introspection? Introspection is the process of analyzing a Bean to determine its capabilities. The java. beans. Introspector class, does all the pattern analysis to expose the properties, methods and events that a component has.

41. Write the design patterns for simple properties in Bean. A simple property has a single value. It can be identified by the following design patterns, where N is the name of the property and T is its type. public T get N( ); public void set N(T arg); 42. What are the design patterns for Boolean properties in a Bean? A Boolean property has a value of true or false. It can be identified by the following design, patterns, where N is the name of the property ; public boolean is N( ); public boolean get N(); public void setn(boolean value); 43. What do you meant by constrained properties in a Bean? A Bean that has a constrained property generates an event when an attempt is made to change its value. The event is of type PropertyChangeEvent. 44. Define the term persistence in a Bean. Persistence is the ability to save a Bean to nonvolatile storage and retrieve it at a later time. The information that is particularly important are the configuration settings. 45. What do you meant by Bound Properties in a Bean? A Bean that has a bound property generates an event when the property is changed. The event is of type PropertyChangeEvent and is sent to objects that previously registered an interest in receiving such notifications. 46. What is Bean Customizer? A Bean Customizer is nothing but a wizard that can be used to provide values to a bean. A Customizer can be created in the same way as any other Java program and can then be attached to the bean with the help of BeanInfo file. 47. What is the use of Layout Managers in Swing? The Layout Managers are used to place the components in a predefined manner relative to each other. The layout manager puts the components in a queue and arranges them one after the other rather then placing the components according to the coordinates. This helps in achieving platform independence. 48. List some Layout Managers supported by Swing.

The most common Layout Managers supported by Swing are Box Layout Grid Layout GridBag Layout Border Layout 49. How we can include tables in Swing applications? Swing provides a structure called the JTable which is capable of displaying the data in a tabular format. For creating a JTable you need to create an array that contains the column names and another array that contains the row and column contents. The constructors to create a JTable are given below : JTable ( ) JTable (int numrows, int numcolumns) JTable (Object [] [] rowdata, Object [] columnnames) JTable (TableModel dm) 50. Write note on Trees in Swings. A tree is a component that presents a hierarchical view of data. A user has he ability to expand or collapse individual subtrees in this display. Trees are implemented in Swing by the JTree class, which extends JComponent. Some of its constructors are : JTree (Hastable ht) JTree (Object obj[]) JTree (TreeNode tn) JTree (Vector v) 51.What are Servlets? Servlets are small programs that execute on the server side of a Web connection. Servlets dynamically extend the functionality of a Web server. 52. What are the advantages of Servelets over CGI? o Servlets are platform-independent, because they are written in Java. o Performance is significantly better. Servlets execute within the address space of a Web server. Creating a separate process to handle each client request isn t necessary. o The Java Security Manager on the server enforces a set of restrictions to protect the resources on a server machine. 53. Write note on the Life Cycle of a Servlet. Three methods are central to the life cycle of a servlet : init(), service(), destroy().

init() is invoked only when the servlet is first loaded into memory. service() method is called for each HTTP request. destroy() method is called when the servlet is uloaded from the memeory. 54. Write note on SingleThreadModel interface. The SingleThreadModel interface is used to indicate that only a single thread should execute the service () method of a servlet. It defines no constants and declares no methods. If a servlet implements this interface, the server creates several instances of it. 55. What is Session Tracking? HTTP is a stateless protocol, which means that each request is independent of the previous one. However, in some applications, it is necessary to save state information, so that information can be collected from several interactions between browser and a server. Session Tracking helps to achieve this.