CS506 Web Programming and Development Solved Subjective Questions With Reference For Final Term Lecture No 1

Similar documents
Virtualians.ning.pk. 2 - Java program code is compiled into form called 1. Machine code 2. native Code 3. Byte Code (From Lectuer # 2) 4.

Come & Join Us at VUSTUDENTS.net

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

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

CS 6456 OBJCET ORIENTED PROGRAMMING IV SEMESTER/EEE

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

Compaq Interview Questions And Answers

Object Oriented Programming with Java. Unit-1

Introduction to Programming Using Java (98-388)

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

Core JAVA Training Syllabus FEE: RS. 8000/-

Objective Questions. BCA Part III Paper XIX (Java Programming) page 1 of 5

Get Unique study materials from

Framework. Set of cooperating classes/interfaces. Example: Swing package is framework for problem domain of GUI programming

Java Programming. Price $ (inc GST)

Which of the following syntax used to attach an input stream to console?

VALLIAMMAI ENGINEERING COLLEGE

CS506 Web Design & Development Final Term Solved MCQs with Reference

LTBP INDUSTRIAL TRAINING INSTITUTE

This page intentionally left blank

Core Java SYLLABUS COVERAGE SYLLABUS IN DETAILS

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS

SELF-STUDY. Glossary

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

CHAPTER 1: A GENERAL INTRODUCTION TO PROGRAMMING 1

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

(800) Toll Free (804) Fax Introduction to Java and Enterprise Java using Eclipse IDE Duration: 5 days

VALLIAMMAI ENGINEERING COLLEGE

Framework. Set of cooperating classes/interfaces. Example: Swing package is framework for problem domain of GUI programming

Sri Vidya College of Engineering & Technology

1 Shyam sir JAVA Notes

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?

1. Java is a... language. A. moderate typed B. strogly typed C. weakly typed D. none of these. Answer: B

First Name: AITI 2004: Exam 2 July 19, 2004

15CS45 : OBJECT ORIENTED CONCEPTS

ABOUT CORE JAVA COURSE SCOPE:

2. (True/False) All methods in an interface must be declared public.

Java for Programmers Course (equivalent to SL 275) 36 Contact Hours

CS Exam 1 Review Suggestions

Introduction This assignment will ask that you write a simple graphical user interface (GUI).

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

Introduction to the JAVA UI classes Advanced HCI IAT351

First Name: AITI 2004: Exam 2 July 19, 2004

CS 11 java track: lecture 3

JAVA. Duration: 2 Months

Java Primer 1: Types, Classes and Operators

Page 1

"Charting the Course... Java Programming Language. Course Summary

OBJECT ORIENTED PROGRAMMING TYm. Allotted : 3 Hours Full Marks: 70

Review sheet for Final Exam (List of objectives for this course)

Atelier Java - J1. Marwan Burelle. EPITA Première Année Cycle Ingénieur.

DEPARTMENT OF INFORMATION TECHNOLOGY

Selected Java Topics

Short Notes of CS201

1 OBJECT-ORIENTED PROGRAMMING 1

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

Name of subject: JAVA PROGRAMMING Subject code: Semester: V ASSIGNMENT 1

MARS AREA SCHOOL DISTRICT Curriculum TECHNOLOGY EDUCATION

The JFrame Class Frame Windows GRAPHICAL USER INTERFACES. Five steps to displaying a frame: 1) Construct an object of the JFrame class

CS201 - Introduction to Programming Glossary By

MyProgram m i ng Lab. get with the programming. Through the power of practice and immediate personalized

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

Casting -Allows a narrowing assignment by asking the Java compiler to "trust us"

S.No Question Blooms Level Course Outcome UNIT I. Programming Language Syntax and semantics

Chapter 3 Syntax, Errors, and Debugging. Fundamentals of Java

Index COPYRIGHTED MATERIAL

A- Core Java Audience Prerequisites Approach Objectives 1. Introduction

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.

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

Core Java Interview Questions and Answers.

E Oracle 10g Java Bootcamp I v1

Chapter 6 Introduction to Defining Classes

CS 335 Lecture 02 Java Programming

Oracle 10g: Java Programming

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING CS6456 OBJECT ORIENTED PROGRAMMING

The Sun s Java Certification and its Possible Role in the Joint Teaching Material

Murach s Beginning Java with Eclipse

CONTENTS. PART 1 Structured Programming 1. 1 Getting started 3. 2 Basic programming elements 17

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

Java Programming Lecture 6


CS11 Java. Fall Lecture 4

SCHEME OF COURSE WORK

FOR BEGINNERS 3 MONTHS

CSC Java Programming, Fall Java Data Types and Control Constructs

F1 A Java program. Ch 1 in PPIJ. Introduction to the course. The computer and its workings The algorithm concept

OracleAS 10g R3: Java Programming

CS304 Object Oriented Programming Final Term

Lecture 20. Java Exceptional Event Handling. Dr. Martin O Connor CA166

COURSE DETAILS: CORE AND ADVANCE JAVA Core Java

Sri Vidya College of Engineering & Technology

Java Programming Course Overview. Duration: 35 hours. Price: $900

Class, Variable, Constructor, Object, Method Questions

(2½ hours) Total Marks: 75

An applet is a program written in the Java programming language that can be included in an HTML page, much in the same way an image is included in a

5. In JAVA, is exception handling implicit or explicit or both. Explain with the help of example java programs. [16]

CSSE 220 Day 19. Object-Oriented Design Files & Exceptions. Check out FilesAndExceptions from SVN

STRUCTURING OF PROGRAM

Language Features. 1. The primitive types int, double, and boolean are part of the AP

1Z Java SE 5 and 6, Certified Associate Exam Summary Syllabus Questions

Transcription:

P a g e 1 CS506 Web Programming and Development Solved Subjective Questions With Reference For Final Term Lecture No 1 Q1 Describe some Characteristics/Advantages of Java Language? (P#12, 13, 14) 1. Java is WORA (Write once run anywhere) 2. Java is Object oriented or network friendly language 3. Java is network based 4. Multi Threaded, 5. High Performance dynamic language 6. Java is programmer efficient 7. Java is very Robust language 8. Simple and Secure 9. port able Q2 Give some similarities b/w Java with C/C++ p#15 (from internet also) 1. Both are object oriented based languages 2. Both languages allow to write comments for code understanding 3. Inheritance (single inheritance in case of Java) 4. Classes are used in both C/C++ and Java 5. in both languages semicolon is placed at the end of statement except at the end of class (semicolon is not placed at end of class in java) Lecture No 2 Q3 what is JVM? P#17 JVM stands for Java Virtual Machine. Java byte code executes by software known as virtual machine so JVM executes java byte code or executable code. We can say that central part of java platform is JVM. Q4 what is meant by byte code in Java? P# 17 Java programs are compiles in the form of byte code. Java compiler reads program (source code) and translate it in to byte code (understandable or executable) and places it into class files Q5 what is JRE? P# 18

P a g e 2 JRE stands for Java Runtime environment. JVM (Java Virtual Machine) is part of JRE. JRE consists of built in classes and JVM. Without JRE it is impossible to run java software. Q6 Write Program Development and Execution steps involved in Java? P#19 There are following steps involved 1. Edit 2. Compile 3. Load 4. Verify 5. Execute Q7 why the main method is declared as static in Java program? P#29 It is made as static so that Java Run time environment (JRE) can call it with out creating an object. If main method is not static then JRE have to call object of the class in which main method is present and call the main method on that object. So making main method static allows JRE to call it without creating object. Q8 what does Void in main method indicates P#29 it indicates that main ( ) does not return any thing. Lecture No 3 Q9 what is String? P#30 String is sequence of characters stored in the memory and accessible as a unit. Java strings are represented as objects Q10 Differentiate b/w == and equals method? P#30 == allows shallow comparison while equals operator allows deep comparison so in java we use equals operator for comparison instead of == operator. Example: string1.equals (string2) // (comparison of two strings using equals operator in java) Q11Why java is object oriented? P#34

P a g e 3 Every thing in java is an object as every class in java inherits from class object by default. Java programming can not be done by classes so we can say that classes are building blocks for java programming. That is why java is object oriented because java programming can not be done without classes/ objects. Q12 how we can we create object of Wrapper Class? P#35 we can create object of Wrapper Class using a string or primitive data type Example: Integer num = new Integer (4); Integer num = new Integer ( 4 ); We can also use corresponding value function to get primitive data type from a wrapper. Example: Int primnum = num.intvalue ( ); Q13 how can we convert strings to numeric primitive data types? P#35 We can convert a string to primitive data type using parse ( ) method. Example: String value 552; Int d = Integer.parseInt (value); Example: String value 3.14; Double d = Double.parseDouble (value); Lecture No 4 Q14 Define the followings P#40 Class, object, constructor, attribute and methods Class Definition: Class is user defined data type. It is prototype for objects. Classes are basic features of OOP (object oriented programming) With out classes, it is not possible to program in java.

P a g e 4 Object Definition: Objects are instances of class. These are created from class. Examples are nouns, things in the world. Constructor Definition It is used for initialization. It is used to create an object and to initialize it. Constructor has the same name as the name of class. Attribute Definition: Attribute represents characteristics or properties of object Methods Definition: Methods are the actions that an object can perform. Q15 Write some differences b/w Java and C/C++? P#41 1. Unlike C/C++ every thing resides inside the class in Java where as in C/C++ there are also present global functions and variables. 2. All methods are written inline in Java 3. There is no semicolon at the end of class in Java 4. Constructors and Destructors both are used in C/C++ but in Java only constructors are used and destructors are not required in Java as memory management is responsibility of JVM in java. Q16 Name the access modifiers used in Java? P#41 there are three access modifiers used in java Public: accessible by anyone at anywhere Private: only accessible within the class Protected: accessible to the class itself, to its subclass, or other classes within the same package.

P a g e 5 Q17 what do you know about static variables and methods? P#47 static variables and methods are associated with the class itself and not tied to any particular object. Static variables and methods are generally accessible by class name Q18 for what purpose, Finalize method is used? P#47 To recycle the object of class we use finalize ( ) method Q19 Describe advantages of inheritance and what type of inheritance java supports? P#52 Java allows single inheritance and keyword extends is used in java for inheritance. All classes are inherited from object class. Advantages of Inheritance 1. Provides reusability 2. No need to create objects again and again 3. Time saving 4. Easy to implement and Understand Q20 what is polymorphism in Java? P#57 Poly means many and Morphic means shapes means many shapes so polymorphism in java means having multiple behaviors Q21 what is type casting and its Types? Explain with example?p#5 Type casting means conversion of one entity type into another. It is of two types 1. Up Casting 2. Down Casting Up Casting Conversion of smaller data type into bigger one Example Int a = 10; Double b = a;

P a g e 6 Example: Employee e = new Teacher ( ); Down Casting Conversion of bigger data type into smaller one Example: Double a = 7.65 Int b = (int) a; Lecture No 6 Q22 what is collection what is its advantage and which package we need to import while using it? P#60 Collection is group of objects known as its elements Advantage of collection over array is we don t need to know the eventual size of collection in order to add objects in to it. We need to import Java.util package to use collection. Q23What are basic methods of Collection P#60 Basic methods are 1. Constructor 2. int size ( ) 3. Boolean add (Object) 4. Boolean isempty ( ) 5. Boolean contains (Object) 6. Boolean removes (Object) Q24 Difference b/w Array and Array list P#61 Array is of fixed size once created can not be modified can not add or delete any record. Array list is resizable. It can grow or shrink over time. Q25 Describe Methods of Array list? P#61 Methods are 1. Int size ( ) 2. add (Object) 3. Object get (int index) 4. remove (int index)

P a g e 7 Q26 what is hash map describe its methods? P#63 hash map stores elements in the form of key value pair. A key is associated with each object stored. Keys are unique and allow fast retrieval of object. Methods are 1. put (Object key, Object value) 2. object get (Object key) 3. int size ( ) Lecture No 7 Q27 what are types of error? P#70 three types of errors are 1. Syntax error( Language syntax errors) 2. Logic error (error in logic unexpected output results) 3. runtime error (Exceptional errors) Q28 what is exception how program can handle it? P#70 an exception is an event that usually signals an erroneous situation at run time. A program handles exception as 1. ignore it 2. handle it where it occurs 3. handle it another place in the program Q29 what are types of exception? P#72 Checked and Unchecked Exceptions UN Checked Exception Subclass of run time exception/error Can be solved by debugging Does not require explicit handling Cause due to internal factors Examples: Null pointer exception, Division by zero exception Checked Exceptions 1. Can not be solved by debugging 2. must be caught/declare in throws clause 3. subclass of exceptions

P a g e 8 4. caused due to external factors 5. compiler error if not handled properly Q30 How java handles exceptions? P#72 java handles exception through 5 keywords Try, Catch, throw, throws and finally Finally block always executes Catch block is used for exception handling To avoid a code which could generate errors enclose it in try block To normally throw an exception, through keyword is used. If not interested in handling exception then use throws block Lecture No 8 Q31 what do you know about Stream? P#85 streams are abstraction of data source/sink. We can consider stream as data path data can flow through this path in one direction. Streams can be 1. Node Stream 2. Filter Stream Lecture No 9 Q32 what is abstract class? P#96 instance of an abstract class can not be instantiated because it is used to define part of implementation only Q33 what is interface class? P#98 these are special java types contain only set of method prototype. These do not provide implementation. So interface is pure abstract class. Q34 what is Graphical user interface? P#102 A GUI component is an object with which user interact via mouse or keyboard. Q35 what is meant by look and feel in Java? P#102 The appearance and how user interacts with program is known as look and feel. Q36 what package is needed to import for making GUI? P#102 javax.swing or Java.awt package

P a g e 9 Q37 what are container and its types? P#104 A container is a collection of related components which allows other components to be nested inside it Types of container are Top Level Container: (can exist independently/alone JFrame, Applet) General Purpose Container: (can not exist independently/alone like JPanel, Tool bar) Q38 Write steps for creating GUI in Java? P#104 1. Import required package Import javax.swing.*; /import Java.awt.*; 2. setup top level container 3. get component area for top level container 4. Apply layout to component area 5. create and add components 6. set size of frame and make it visible Q39 Name the Layouts supported in java P#109 1. Border Layout 2. Flow Layout 3. Box Layout 4. Grid Layout 5. Card Layout 6. Grid Bag Layout Lecture No 11 Q40 How Java handle events write steps? P#120 1. Create components which can generate events (Event Generation) 2. Guild components that can handle events ( Event Handlers) 3. Register handler with generators Lecture No 12 Q41 how can we handle mouse events in java? P#130 Two types of listener interfaces are available for handling mouse events 1. Mouse Listener (Clicked, Exit, Pressed, Released, Enter)

P a g e 10 2. Mouse Motion Listener (Dragged, Moved) Q42 how window events are handled in Java? P#133 these are handled through window listener interface there are 7 methods available 1. Window activated 2. Window Closed 3. Window Closing 4. Window Deactivated 5. Window Deiconified 6. Window Iconified 7. Window Open Lecture No 13 Q43 what are adapter classes? P#136 Adapter classes provide definition for all the methods (empty bodies) corresponding to listener interface Q45 what is meant by inner classes? P#139 A class defined within another class is inner class Q46 Differentiate b/w named and anonymous objects Anonymous objects: 1. Difficult to understand 2. Shorter 3. Has no name 4. same as inner class in capabilities 5. used when there is only one time use of particular object Named Objects: 1. Easy to understand 2. Have name 3. used when repeated use of an object is required Lecture No 14 Q47 Write steps involved in JDBC? P#151 1. Import required package java.sql.*; 2. Load Database driver

P a g e 11 3. Define connection URL 4. establish connection with DB 5. Create statement 6. Execute query 7. Close the connection Lecture No 15 Q48 name statement methods? P#156 1. execute Update ( ) 3. getmaxrows ( )/setmaxrows ( ) 4. getquerytimeout ( )/setquerytimeout ( ) Q49 Describe different types of statements? P#159 Statement Prepared Statement Callable Statement Q50 Write syntax of update query P#153 String sql = INSERT INTO table name + (columns name) Values (values) Int count = stmt.executeupdate (sql); Lecture No 16 Q51 what does result set contains? P#162 it contains result of SQL query Q52 Name useful result set methods? P#162 next ( ) 2. Getters 3. Close ( ) 4. Absolute (int) 5. Updaters 6. Update Row ( ) 7. MoveToInsertRow (int) 8. InsertRow ( ) 9. DeleteRow ( ) 10 Last ( ) Fist ( ) 11. GetRow ( )

P a g e 12 Lecture No 17 Q53 what is Meta data? P#174 data about data is known as Meta data. Q54 How to create result set Meta data object? P#174 ResultSetMetaData rsmd = rs.getmetadata ( ); Q55 Name methods of ResultSetMetaData P#174 getcolumncount ( ) GetColumnType ( ) GetColumnName ( ) GetColumnLable (int) GetColumnDisplaySize ( ) Q56 Name JDBC driver Types P#179 JDBC-ODBC Bridge Native-API /Partly java driver Net-Protocol Driver/All Java Driver Native-Protocol Driver/All Java Driver Lecture No 18 Q57 Write methods used for painting swing components? P#186 PaintComponent ( ) PaintBorder ( ) PaintChildern ( ) Q58 Write steps that we need to follow in order to perform painting? P#187 1. Subclass JPanel 2. Override paintcomponent (Graphics g) method 3. install that JPanel inside the JFrame Lecture No 20 Q59 what is applet and is it a JPanel? P#199 It is a small program written in java and included in HTML page. It is independent of the OS on which it runs that is why an applet is a panel because it allows interaction with java program. Q60 what can an applet do? (Methods) P#201

P a g e 13 An applet can initialize itself init ( ) It can start itself start ( ) It can stop itself stop ( ) It can destroy itself (it can perform final cleanup) destroy ( ) Lecture No 21 Q62 What is socket and describe its advantages? P#211 socket is bidirectional communication link b/w two programs running on a network. Advantages: 1. Provides more control 2. Used for client server communication 3. Efficient performance 4. We can read/write a network through sockets Q63 what is Port? P#211 port is transparent address to which processes can listen communication request Q64 Write steps to make Client connection? P#212 1. import package java.net and java.io 2. connect socket with server 3. Get I/O streams of socket 4. Send/Receive Message 5. Close Socket Q65 Write steps to make simple server connection? P#214 1. import package java.net and java.io 2. Create server socket 3. Wait for incoming connections 4. Get I/O streams of socket 5. Send/Receive Message 6. Close Socket Lecture No 22

P a g e 14 Q66 why we need serialization? P#219 We need serialization to send an object to stream Q67 how can we prevent serialization? P#225 there is no need to serialize sockets, streams, DB connections because they don t represent state of object. For serialization prevention we use transient keyword with the object which we don t want to serialize Like transient Sockets s; transient Connection con; etc