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

Similar documents
VALLIAMMAI ENGINEERING COLLEGE

CS 6456 OBJCET ORIENTED PROGRAMMING IV SEMESTER/EEE

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING OBJECT ORIENTED PROGRAMMING CLASS : THIRD SEMESTER CSE

Get Unique study materials from

JAYARAM COLLEGE OF ENGINEERING AND TECHNOLOGY Pagalavadi, Tiruchirappalli (An approved by AICTE and Affiliated to Anna University)

Jayaram college of Engineering and Technology, Pagalavadi. CS2203 Object Oriented Programming Question Bank Prepared By: S.Gopalakrishnan, Lecturer/IT

PROGRAMMING IN C++ COURSE CONTENT

STUDY NOTES UNIT 1 - INTRODUCTION TO OBJECT ORIENTED PROGRAMMING

I BSc(IT) [ Batch] Semester II Core: Object Oriented Programming With C plus plus - 212A Multiple Choice Questions.

Short Notes of CS201

CS201 - Introduction to Programming Glossary By

Interview Questions of C++

OBJECT ORIENTED PROGRAMMING USING C++ CSCI Object Oriented Analysis and Design By Manali Torpe

SRM ARTS AND SCIENCE COLLEGE SRM NAGAR, KATTANKULATHUR

STRUCTURING OF PROGRAM

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS

Sri Vidya College of Engineering & Technology

Absolute C++ Walter Savitch


DOWNLOAD PDF CORE JAVA APTITUDE QUESTIONS AND ANSWERS

15CS45 : OBJECT ORIENTED CONCEPTS

AN OVERVIEW OF C++ 1

Object-Oriented Programming (OOP) Fundamental Principles of OOP


Object Oriented Pragramming (22316)

OBJECT ORIENTED PROGRAMMING. Ms. Ajeta Nandal C.R.Polytechnic,Rohtak

Weiss Chapter 1 terminology (parenthesized numbers are page numbers)

Tokens, Expressions and Control Structures

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

1 Shyam sir JAVA Notes

CS3157: Advanced Programming. Outline

Data Structures using OOP C++ Lecture 3

OOPS Viva Questions. Object is termed as an instance of a class, and it has its own state, behavior and identity.

Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub

Module Operator Overloading and Type Conversion. Table of Contents

CS304 Object Oriented Programming

Introduction to Programming Using Java (98-388)

Compaq Interview Questions And Answers

Department of Information Technology Object Oriented Programming. Two Mark Questions

I BCS-031 BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination. June, 2015 BCS-031 : PROGRAMMING IN C ++

Object Oriented Programming. Solved MCQs - Part 2

Contents. Figures. Tables. Examples. Foreword. Preface. 1 Basics of Java Programming 1. xix. xxi. xxiii. xxvii. xxix

Object Oriented Programming. Assistant Lecture Omar Al Khayat 2 nd Year

END TERM EXAMINATION

Hierarchical inheritance: Contains one base class and multiple derived classes of the same base class.

Java Overview An introduction to the Java Programming Language

Preface to the Second Edition Preface to the First Edition Brief Contents Introduction to C++ p. 1 A Review of Structures p.

RAJIV GANDHI COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF INFORMATION TECHNOLOGY OBJECT ORIENTED PROGRAMMING QUESTION BANK UNIT I 2 MARKS

C++ Quick Guide. Advertisements

A Short Summary of Javali

CS304 Object Oriented Programming Final Term

MaanavaN.Com CS1203 OBJECT ORIENTED PROGRAMMING DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

Introduction to C++ Systems Programming

Time : 3 hours. Full Marks : 75. Own words as far as practicable. The questions are of equal value. Answer any five questions.

C++_ MARKS 40 MIN

What are the characteristics of Object Oriented programming language?

Introduction to C++ Professor Hugh C. Lauer CS-2303, System Programming Concepts

Data type of a pointer must be same as the data type of the variable to which the pointer variable is pointing. Here are a few examples:

Problem Solving with C++

Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson

OOPs Concepts. 1. Data Hiding 2. Encapsulation 3. Abstraction 4. Is-A Relationship 5. Method Signature 6. Polymorphism 7. Constructors 8.

CORE JAVA TRAINING COURSE CONTENT

Object-Oriented Programming

Chapter 15 - C++ As A "Better C"

CHAPTER 1 Introduction to Computers and Programming CHAPTER 2 Introduction to C++ ( Hexadecimal 0xF4 and Octal literals 031) cout Object

Object Oriented Programming

1 OBJECT-ORIENTED PROGRAMMING 1

OBJECT ORİENTATİON ENCAPSULATİON

Object-Oriented Design (OOD) and C++

COP 3330 Final Exam Review

cs3157: c++ lecture #2 (mon-11-apr-2005) chronology of some programming languages... C++ vs Java identifiers.

C++ Important Questions with Answers

5/23/2015. Core Java Syllabus. VikRam ShaRma

Preface... (vii) CHAPTER 1 INTRODUCTION TO COMPUTERS

Inheritance, and Polymorphism.

Kapil Sehgal PGT Computer. Science Ankleshwar Gujarat

CS/B.TECH/CSE(OLD)/SEM-6/CS-605/2012 OBJECT ORIENTED PROGRAMMING. Time Allotted : 3 Hours Full Marks : 70

An Object Oriented Programming with C

Object Oriented Programming with Java. Unit-1

UCA31 - PROGRAMMING IN C++ Unit-1 Principal of OOP Type: 75% Theory & 25 % Numerical Question and Answer

CS304- Object Oriented Programming LATEST SOLVED MCQS FROM FINALTERM PAPERS. MC

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?

WA1278 Introduction to Java Using Eclipse

Introduction to C++ (Extensions to C)

Instantiation of Template class

Cpt S 122 Data Structures. Introduction to C++ Part II

Borland 105, 278, 361, 1135 Bounded array Branch instruction 7 break statement 170 BTree 873 Building a project 117 Built in data types 126

BCA (Part II) EXAMINATION, 2009 C++ PROGRAMMING Time allowed: Three Hours Maximum Marks: 50 Attempt any five questions

CS242 COMPUTER PROGRAMMING

Contents. 1 Introduction to Computers, the Internet and the World Wide Web 1. 2 Introduction to C Programming 26

Learning Objectives. C++ For Artists 2003 Rick Miller All Rights Reserved xli

CS201 Latest Solved MCQs

Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal

+2 Volume II OBJECT TECHNOLOGY OBJECTIVE QUESTIONS R.Sreenivasan SanThome HSS, Chennai-4. Chapter -1

CHAPTER 4 FUNCTIONS. 4.1 Introduction

Index COPYRIGHTED MATERIAL

Fast Introduction to Object Oriented Programming and C++

Introduction to Computers and C++ Programming p. 1 Computer Systems p. 2 Hardware p. 2 Software p. 7 High-Level Languages p. 8 Compilers p.

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

2 rd class Department of Programming. OOP with Java Programming

Transcription:

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING CS6456 OBJECT ORIENTED PROGRAMMING Unit I : OVERVIEW PART A (2 Marks) 1. Give some characteristics of procedure-oriented language. The characteristics of procedure-oriented language are, i. Emphasis is on doing things (algorithms). ii. Larger programs are divided into smaller programs known as functions. iii. Most of the functions share global data. iv. Data move openly around the system from function to function. v. It employs top-down approach in program design. 2. What are the basic concepts of OOPS? The basic concepts of OOPS are, i. Objects. ii. Classes. iii. Data abstraction and Encapsulation. iv. Inheritance. v. Polymorphism. vi. Dynamic binding. vii. Message passing. 3. What is an object? (N-12) An object is basic run-time entity in an object-oriented system. They may represent a person, a place, a bank account, a table of data or any item that the program has to handle. Each object has the data and code to manipulate the data and theses objects interact with each other. 4. What is a class? (N -12) A class is a collection of objects of similar type. Once a class has been defined, we can create any number of objects belonging to the class. Class is a user-defined data type and behaves like built-in types of the programming language. 5. What is an encapsulation? (A - 11), (A - 12), (N - 10), (N - 14) Wrapping up of data and function within the structure is called as encapsulation. The insulation of data from direct access by the program is called as data hiding or information binding. The data is not accessible to the outside world and only those functions, which are wrapped in the class, can access it. Moreover it provides reusability of codes without rewriting the same function. 6. What is meant by dynamic binding or late binding? (N - 11)

Dynamic binding means that the code associated with a given procedure call is not known until the time of the call at the run-time. 7. Write the process of programming in an object-oriented language? The processes of programming in an object-oriented language are i. Create classes that define objects and their behavior. ii. Creating objects from class definition. iii. Establishing communication among objects. 8. List any four advantages of OOPS. The advantages of OOPS are i. The principle of data hiding helps the programmer to build secure programs that cannot be invaded by code in other parts of the program. ii. It is possible to have multiple instances of an object to co-exist without any interference. iii. Object oriented programming can be easily upgraded from small to large systems. iv. Software complexity can be easily managed. 9. What are the features required for object-based programming language? (A - 07) The features required for object-based programming are i. Data encapsulation. ii. Data hiding and access mechanisms. iii. Automatic initialization and clear up of objects. iv. Operator overloading. 10. Give any four applications of the OOPS. The four applications of OOPS are i. Real-time systems. ii. Simulation and modeling. iii. Object-oriented databases. iv. AI and expert systems. 11. What are the operators available in C++? The operators available in C++ are, i. :: - Scope resolution operator. ii. :: * - Pointer-to-member declarator. iii. ->* - Pointer-to-member operator. iv..* - Pointer-to-member operator. v. delete - Memory release operator. vi. endl - Line feed operator vii. new - Memory allocation operator viii. setw - Field width operator 12. What is a default argument? Default argument assigns a default value to the parameter, which does not have matching argument in the function call. Default values are specified when the function is declared. Example: float amount (float principle, int period, float rate=0. 15) {

} 13. What is constant argument? Keyword is const. The qualifier const tells the compiler that the function should not modify the argument. The compiler will generate an error when this condition is violated. This type of declaration is significant only when we pass arguments by reference or pointers Example: int strlen (const char *p); 14. How do you create an object? Once the class has been declared, we can create object for a class using the class name. Example: classname x; //memory for x is created 15. How the class is specified in C++? Generally class specification has two parts. They are, i. Class declaration - It describes the type and scope of its member ii. Class function definition - It describes how the class functions are implemented. The general form is: class class_name { private: public: variable declarations; function declaration; variable declaration; function declaration; }; 16. How do you access a class member? We can access the member function by using the following syntax: Syntax: Object-name. Function-name (actual arguments); Example: x.getdata (100, 75.5); 17. How is the member functions defined? Member functions can be defined in two ways. They are, i. Outside the class definition - Member function can be defined by using scope resolution operator (::). General format is return type class_ name:: function-name (argument declaration) {

}..//function body ii. Inside the class definition - This method of defining member function is to replace the function declaration by the actual function definition inside the class. It is treated as inline function Example: class item { int a, b; }; void getdata (int x, int y) { a=x; b=y; } 18. What are the features of static data member? The features of static data member are i. It is initialized to zero when the first object is created ii. Only one copy of that member is created for the entire class iii. It is only visible within the class iv. It is stored separately rather than objects 19. What are the situations that inline functions may not work? The situations that inline functions may not work is i. For function returning values, if a loop, a switch, or a goto exists. ii. For function not returning values, if a return statement exists. iii. If function contains static variables. iv. If inline functions are recursive. 20. What is a namespace? (A - 11), (A - 12), (N 12) The namespaces are used to group the entities like class, variables, objects, function under a name.

PART B (16 Marks) 1. What are the features of oop s and how are they implemented in C++? (A - 11), (A - 12), (N - 10), (N - 11), (N - 14), (A - 15), (N - 13) 2. Explain in detail inline function? (N - 11) 3. Explain function overloading using in C++? (N - 11), (N 14) 4. Illustrate the function overloading concept with a C++ program to find the volume of cube and cylinder. (N - 14) 5. Explain the basic concepts of oops with suitable examples. (A - 11), (N - 11), (N - 14), (A - 15) 6. Write a C++ program to construct student mark list for three subjects. Write the program to display name, rollno, marks, avg and total. Use class and objects. 7. Explain the control structures in C++. 8. Explain in detail call by reference and return by reference? 9. Explain in detail about Class, Objects, Methods and Messages. (A - 11), (A - 12) 10. Write a C++ program to perform 2D matrix operations as follows: (N - 10) i. Define class MATRIX, use appropriate constructor(s). ii. iii. Define methods for the following two matrix operations: determinant and transpose. Write a main program to demonstrate the use of the MATRIX class and its methods. 11. Write a C++ program as follows to perform arithmetic operations on Rational numbers of type a/b, where a and b are integers. (N - 10), (N - 11) i. Define a class by Rational Number. ii. iii. iv. Use operator overloaded methods for addition and subtraction. Write a main program to demonstrate the use of this class and its methods. Give a sample output. 12. Write a C++ program for temperature conversion. (N - 11) 13. Explain the characteristics of OOPS in detail. (N - 12) 14. Write a C++ program for calculating gross salary of a person. (A - 15) 15. Write a C++ program to demonstrate Do-while idea. (N - 13)

16. Write a program for find out prime numbers from the fixed interval.

Unit II : BASIC CHARACTERISTICS OF OOP PART A (2 Marks) 1. What is Constructor? A constructor is defined as a special member of a class, which has no return type. It can be used to initializes an object immediately upon creation. 2. Write some special characteristics of constructor. Some special characteristics of constructor are i. They should be declared in the public section. ii. They are invoked automatically when the objects are created. iii. They do not have return types, not even void and therefore, and they cannot return values. iv. They cannot be inherited, though a derived class can call the base class v. They can have default arguments. vi. Constructors cannot be virtual function. 3. How the objects are initialized dynamically? The objects an initialized dynamically to call parameterized constructor or methods we should the pass values to the object ie, for the constructor integer add(int a, int b) it is invoked by integer a (10, 18). This value can be get during run time. i.e., f or above constructor Example: int p,q; cin>>p>>q; integer add(p,q); 4. What is meant by operator overloading? Operator overloading is the mechanism of giving such special meanings to an operator is known. It provides a flexible option for the creation of new definitions for C++ operators. 5. List out the operators that cannot be overloaded. (A - 11), (A - 12), (N - 14) The operators that cannot be overloaded are i. Class member access operator (.,.*) ii. Scope resolution operator (::) iii. Size operator (sizeof) iv. Conditional operator (? :) 6. List out the operators that cannot be overload as friend functions. (N - 12) The operators that cannot be overload as friend function are i. Assignment operator = ii. Function call operator ( ) iii. Array subscript operator [ ] iv. Access to class member using pointer to object operator ->

7. What is the purpose of using operator function? Write its syntax. To define an additional task to an operator, we must specify what it means in relation to the class to which the operator is applied. This is done by Operator function, which describes the task. Operator functions are either member functions or friend functions. The general form is: return type classname :: operator op(arglist ) { // function body } 8. Write any four rules for operator overloading. Rules for Operator overloading are, i. Only the existing operators can be overloaded. ii. The overloaded operator must have atleast one operand that is of user defined data type. iii. The basic meaning of the operator should not be changed. iv. Overloaded operators follow the syntax rules of the original operators. v. They cannot be overridden. 9. What are the different types of conversion? The different types of conversions are i. Basic type to Class type. ii. Class type to Basic type. iii. Class type to Class type. iv. Basic type to Basic type 10. Write the syntax to convert from class to basic type. The syntax to convert from class to basic type is, Operator type_name ( ) { Function statements; } 11. What are the conditions to satisfy the type casting function? The conditions to satisfy the type casting function are i. It must be a class member. ii. It must not specify a return type. iii. It must not have any arguments. 12. What is function overloading? Give an example. Function overloading means we can use the same function name to create functions that perform a variety of different tasks. Example: An overloaded add ( ) function handles different data types as shown below. // Declarations int add (int a, int b); //add function with 2 arguments of same type int add (int a, int b, int c); //add function with 3 arguments of same type

13. Write at least four rules for operator overloading. Rules for Operator overloading are i. Only the existing operators can be overloaded. ii. The overloaded operator must have at least one operand that is of user defined data type. iii. The basic meaning of the operator should not be changed. iv. Overloaded operators follow the syntax rules of the original operators. v. They cannot be overridden. 14. What is meant by static invocation of virtual function? It is possible to call virtual function using as object of the class or using a scope resolution operator. In that case, virtual function is invoked statically. This is known as static invocation of the virtual function. The syntax for static invocation of virtual function is, pointer-object classname::virtual-function(); 15. What is a scope resolution operator? (A - 15) Scope resolution operator is used to uncover the hidden variables. It also allows access to global version of variables. Scope resolution operator is used to define the function outside the class. Syntax: return type <class name> : : <function name> Example: #include<iostream. h> int m=10; // global variable m void main ( ) { int m=20; // local variable m cout<< m= <<m<< \n ; cout<< : : m= <<: : m<< \n ; } Output: 20 10 (:: m access global m) 16. What are the operators available in C++? All operators in C are also used in C++. In addition to insertion operator << and extraction operator >> the other new operators in C++ are :: Scope resolution operator * Pointer-to-member declarator ->* Pointer-to-member operator.*pointer-to-member operator delete Memory release operator endl Line feed operator new Memory allocation operator setw Field width operator\

17. What is a scope resolution operator with reference to outside of a class? Scope resolution operator is used to uncover the hidden variables. It also allows access to global version of variables. Eg: #include<iostream.h> int m=10; // global variable m void main ( ) { int m=20; // local variable m cout<< m= <<m<< \\n ; cout<< : : m= <<: : m<< \\n ; } output: 20 10 (: : m access global m)scope resolution operator is used to define the function outside the class. Syntax: Return type <class name> : : <function name> Eg: Void x : : getdata() 18. What are free store operators (or) memory management operators? New and Delete operators are called as free store operators since they allocate the memory dynamically. New operator can be used to create objects of any data type. Pointer-variable = new data type; Initialization of the memory using new operator can be done. This can be done as, Pointer-variable = new data-type(value) Delete operator is used to release the memory space for reuse. The general form of its use is Delete pointervariable. 19. What are manipulators? (N 11) Setw, endl are known as manipulators. Manipulators are operators that are used to format the display. The endl manipulator when used in an output statement causes a linefeed to be inserted and its effect is similar to that of the newline character \\n. Eg: Cout<<setw(5)<<sum<<endl; 20. What is meant by enumerated datatype? An enumerated datatype is another user-defined datatype, which provides a way for attaching names to numbers, thereby increasing comprehensibility of the code. The syntax of an enum statement is similar to that of the struct statesmen. Eg: enum shape{ circle, square, triangle} enum color{ red, blue, green, yellow}

PART B (I6 Marks) 1. Explain in detail operator overloading with compile time polymorphism using C++? (N - 11), (N - 14), (A - 15) 2. Explain overloading unary and binary operators using C++? 3. Explain type conversions used in C++ with examples? 4. Explain the types of constructor with an example? (N - 14), (N-13) 5. Explain the multiple constructors (constructor overloading) in detail? (A - 11) 6. Explain the friend function concept with an example program. (N - 13) 7. What is dynamic initialization of objects? Give a program to illustrate your answer. 8. Explain the copy constructor concept with its types with example programs. 9. Explain the concept of objects as functional arguments. 10. Write a C++ program to manage a bank account using classes and objects. 11. Write a C++ program to define overloaded constructor to perform string initialization, string copy and string destruction. (A - 11), (A - 12), (N 12)

Unit III : ADVANCED PROGRAMMING Part A (2 Marks) 1. What are the various traditional error handling methods? The various traditional error handling methods are i. Returning error number. ii. Global flag manipulation. iii. Abnormal termination. 2. What is the importance of exceptional handling? The importance of exceptional handling is i. Divide the error handling. ii. To provide unconditional termination and programmer preferred termination iii. For separating error reporting and error handling. iv. To solve the object destroy problem. 3. What are the three keywords used for exception handling mechanism? (A - 15) The three keywords used for exception handling mechanism are, i. try for indicating program area where the exception can be thrown. ii. throw for throwing an exception. iii. catch for taking an action for specific exception. 4. What is the use of unexpected function? The unexpected function is called when a function throws an exception not listed in its exception specification. Internally, it calls the terminate function to terminate the program execution. The function set unexpected () is used to call our own unexpected function in place of the built-in unexpected function. 5. What are the challenges in the exception handling mechanism? The challenges in the exception handling mechanism are, i. Finding proper catch block. ii. Finding proper catch block for polymorphic object. iii. Backtracking till the beginning of the try block. 6. Why templates are used in C++? (N - 14) The Templates are used to develop reusable software component such as functions, classes, etc. Templates allow the construction of a family of templates functions and classes to perform the same operations on different data types. 7. What are rules for invalid function template declaration? The rules for invalid function template declaration are, i. No-argument template function. ii. Template type argument unused. iii. Usage of partial number of template arguments.

8. Write the syntax for function template. The syntax for function Template is, Template <class T,..> Return Type Fun_Name (arguments) {. // body of the template } 9. What are the error handling function in C++? The error handling function in C++ is, i. eof() ii. fail() iii. bad() iv. good() 10. What are the rules for virtual function? The rules for virtual function are, i. They cannot be static members. ii. They are access by using object pointers. iii. A virtual function can be a friend of another class. 11. What are streams? Stream is a mechanism, which supplies the input data to a program and presents the processed data in the desired form. 12. What are the file stream classes in C++? The file stream classes in C++ are, i. filebuf ii. fstreambase iii. ifstream iv. ofstream v. fstream 13. What is the stream objects used in C++? The Stream objects used in C++ is, i. cin ii. cout iii. cerr iv. clog

14. List out the ways of class template inheritance. The ways of Class Template inheritance are, i. Derive a class template from a base class, which is a template class ii. Derive a class template from the base class, which is a template class, add more template members in the derived class iii. Derive a class template from a base class which is not a template class, and add template members to that class iv. Derive a class template from a base class which is a template class and restrict the template feature. 15. What are the three formatted I/O operation classes? The three input/output operation classes are i. istream does formatted input. ii. ostream does formatted output. iii. iostream - does formatted input and output. 16. What are the functions of ios classes? (A - 15), (A - 07) The functions of ios classes are Function Task Performed width() Specifies the required number of fields to be used while displaying the output value. precision() Specifies the number of digits to be displayed after the decimal point fill() Specifies a character to be used to fill the unused area of a field. setf() Sets format flag that control the form of output display unset() Clears the specified flag 17. What are the modes used file stream class? The modes used file stream class is, in open for reading out open for writing app all write occur at end of file trunc truncate the file if already exits nocreate open fails if file does not exits noreplace open fails if file already exits binary open as a binary file 18. What is get () and put () functions? get() is a member function of a stream class fstream and is used to read a single character from a file. put() is a member function of a stream class fstream and is used to write a single character to the file.

19. What are two types of file pointers used in C++? The two types of file pointers used in C++ are, i. get pointer specifies a location from where the current reading operation is initiated ii. put pointer - specifies a location from where the current writing operation is initiated 20. What is meant by inheritance? Inheritance is the process by which objects of one class acquire the properties of another class. It supports the concept of hierarchical classification. It provides the idea of reusability. We can add additional features to an existing class without modifying it by deriving a new class from it.

PART B (16 Marks) 1. Explain in detail using inheritance in C++? (N - 10), (N - 11), (N - 12), (N - 14) 2. Explain in detail virtual functions with an example? (A - 11), (N - 11), (A - 15) 3. Explain virtual function concept with a program to find the distance between two objects. 4. Explain the inheritance types with example programs using C++? 5. What is meant by operator overloading? What are its types? Explain the types with example programs. (A - 15), (N 13) 6. Explain single and multiple inheritance with an example of your own. (N - 13) 7. Describe manipulation of strings with overloading the following operators :<<,>>,+,-. (N - 12) 8. Explain the different types of streams and various formatted I/O in C++. (A 11), (A - 12), (N - 11), (N -14) 9. Explain the various file handling mechanisms in C++. (A 11), (A - 12), (N - 10), (N - 12) 10. Write a program for dynamic memory allocation in C++. (N - 12) 11. Explain the usage of templates in C++. (N - 12), (N - 13) 12. Write a program for merging of two files in C++. (A - 15) 13. Write a C++ program for function templates. (N - 13)

Unit IV : OVERVIEW OF JAVA PART A (2Marks) 1. What is Java? Java is a high-level, third generation programming language, like C, FORTRAN, Smalltalk, Perl, and many others. You can use Java to write computer applications that crunch numbers, process words, play games, store data or do any of the thousands of other things computer software can do. 2. What are the features of Java? (N - 12) The features of Java are i. Simple ii. Object Oriented iii. Platform Independent iv. Robust v. Multi-threaded vi. Secure 3. What are the various applications of Java? The various applications of Java are i. Applets ii. Networking iii. Internationalization iv. Security v. Object serialization vi. Java Database Connectivity (JDBC) 4. What is meant by virtual machine? (N - 12), (N - 14) A Java virtual machine (JVM), an implementation of the Java Virtual Machine Specification, interprets compiled Java binary code (called byte code) for a computer's processor (or "hardware platform") so that it can perform a Java program's instructions. 5. What are the two components of Java platform? The two components of Java platform are, i. The Java Virtual Machine ii. The Java Application Programming Interface (API) 6. What is byte code in Java? (A - 15),(A - 11), (A - 12) Java byte code is the form of instructions that the Java virtual machine executes. Each byte code opcode is one byte in length, although some require parameters, resulting in some multi-byte instructions. Not all of the possible 256 opcodes are used.

7. What is an object and how do you allocate memory to it? Object is an instance of a class and it is a software unit that combines a structured set of data with a set of operations for inspecting and manipulating that data. When an object is created using new operator, memory is allocated to it. 8. What are the different types of access modifiers used in Java? (N - 10) The different types of access modifiers are, i. public: Any thing declared as public can be accessed from anywhere. ii. private: Any thing declared as private can t be seen outside of its class. iii. iv. protected: Any thing declared as protected can be accessed by classes in the same package and subclasses in the other packages. default modifier: Can be accessed only to classes in the same package. 9. What is method overloading and method overriding? (N - 13) Method overloading: When a method in a class having the same method name with different arguments is said to be method overloading. Method overriding: When a method in a class having the same method name with same arguments is said to be method overriding. 10. List out the primitive types in Java. The seven primitive types are listed in the following table: Type Definition one-byte signed two's complement integer byte short int long float double char two-byte signed two's complement integer 4-byte signed two's complement integer 8-byte signed two's complement integer 4-byte IEEE 754 single-precision float 8-byte IEEE 754 double-precision float 2-byte unsigned Unicode character

11. What is an array? An array is a special object containing a group of contiguous memory locations that have the same name and the same type and a separate variable containing an integer constant equal to the number of array elements. The elements of Java arrays are numbered starting from 0. Example: double x []; // create an array reference x = new double [5]; // create array object 12. What are the methods used in String class? The methods used in String class are, i. charat(int index) ii. compareto(string anotherstring) iii. concat(string str) iv. copyvalueof(char[] data) v. equals(object anobject) 13. Why Java use Unicode? Java use Unicode to represent a character. Unicode defines a fully international character set that can represent all of the characters found in all human languages. 14. What is class path? The class path is an argument we can set either on the command-line, or through an environment variable that tells the Java Virtual Machine where to look for user defined classes and packages when running Java programs. 15. What is garbage collection? (N - 14) The Garbage collection is the process that is used to free the memory of the objects that are no longer in use. When a program stops referencing an object, it is not required anymore and can be deleted. The space that is used by the object is released for use by another object. 16. What are nested classes? A nested class is a class defined as a member of another class. The scope of nested class is bounded by the scope of its enclosing class. The nested class has access to the members of its enclosing class including private members. 17. What are the advantages of inheritance? The advantages of inheritance are i. It permits code reusability. ii. Reusability saves time in program development. iii. It encourages the reuse of proven and debugged high-quality software, thus reducing problem after a system becomes functional.

18. What members does a subclass inherit? A subclass inherits all of the members in its superclass that are accessible to that subclass unless the subclass explicitly hides a member variable or overrides a method. Note that constructors are not members and are not inherited by subclasses. 19. Mention some of the separators used in Java Programming? ( ) _ Contain a list of parameters in method definition & invocation. { } _ Contain the value of automatically initialized arrays. [ ] _ Declare array types. ; Terminate statements. Separate package name from sub packages. 20. What is boolean data type? Java has simple type called boolean for logical values. It can have only one of two possible values, true or false. This is the type returned by all relational operators like a<b. boolean is also required by the conditional expression that governs the control statements such as if for. Student Test Result Sports Syntax: boolean variable name;

PART B (16 Marks) 1. Explain the features of Java in detail? (N - 13) 2. Describe the structure of java program in detail? (N - 11) 3. Explain how run time polymorphism achieved through java? (A -11), (A - 12), (N - 12) 4. Explain method overriding ued in Java with an example. 5. Construct the pictorial representation of Java Virtual Machine. (N - 10) 6. Write a java program to perform all string operations using the String class. (A -11), (A- 12), (N - 14) 7. Write a program in java using constructor usage. 8. Explain the different statements and its use in java with examples? 9. Illustrate multiple inheritance in Java with suitable program. (A -11) 10. Write a menu-based java program that can calculate the area of a triangle, circle or square, based on the user s choice. (N - 10) 11. Write a java class called student with name, Marks of 3 subjects and total Marks. Write another class named calculate that gets the Marks of the student and calculates the total Marks and displays the result (pass or fail). (N - 10) 12. Explain the importance of JVM in JRE. (N - 11) 13. Write a Java program for add or subtract two complex numbers and the constructor should do add, subtract and product of the two instance variables of type double. (N - 11) 14. Write a java program to implement a calculator. (N - 14) 15. Write a java program for interchanging odd, even numbers of an array. (A - 15) 16. Write a java program to sort an array of string in alphabetical order. (A- 15)

Unit - V : EXCEPTION HANDLING Part A (2 Marks) 1. What are packages? (A - 11), (A - 12), (A -15) A Java package is a mechanism for organizing Java classes into namespaces similar to the modules of Modula. Java packages can be stored in compressed files called JAR files, allowing classes to download faster as a group rather than one at a time. 2. List out the Java packages. The Java packages are, i. java.lang ii. java.io iii. java.awt iv. java.net v. java.applet vi. java.rmi 3. What is an interface in java? (A - 11), (A - 12), (N - 12), (A - 15) An Interface is defined as a named collection of method definitions (without implementations). An interface can also declare constants. All the methods declared in the interface are abstract methods by default. And all the data members are static final members. 4. What is the use of finally block? (N - 11) The finally statement identifies a block of code that cleans up regardless of whether an exception occurred within the try block. A try statement must be accompanied by at least one catch statement or a finally statement and may have multiple catch statements. 5. How Threads are created in Java? (N - 10), (A - 14) Threads are created in two ways, i. extending the Thread class ii. implementing Runnable interface. 6. What is Thread pool? A Thread pool is a managed collection of threads that are available to perform tasks. Thread pool usually provides, i. Improved performance when executing large numbers of tasks due to reduced per task invocation overhead. ii. A means of bounding the resources, including threads, consumed when executing a collection of tasks.

7. What is meant by Dead Lock? A Dead Lock is defined as a special type of error that relates specifically to multitasking is dead lock, which occurs when two threads have a circular dependency on a pair of synchronized objects. 8. What do you mean by Thread Scheduling? Execution of multiple threads on a single CPU in some order is called Thread scheduling. The Java runtime environment supports a very simple, deterministic scheduling algorithm called fixed-priority scheduling. This algorithm schedules threads on the basis of their priority relative to other Runnable threads. 9. What are the various states of a thread? The various states of threads are shown below: 10. What is the use of Data input and output streams? (N - 14) Data input and output Streams are used to read or write primitive data types in a machine-independent format. 11. What is the use of Buffered Streams? (N - 14) Buffered streams, buffer data while reading or writing, thereby reducing the number of accesses required on the original data source. Buffered streams are typically more efficient than similar non buffered streams and are often used with other streams. 12. What is filtered Stream? (N - 14) A filtered stream filters data as its being read from or written to the stream. The java.io package provides a set of abstract classes that define and partially implement filter streams. 13. Name two super classes used in byte stream. The Input Stream and Output Stream classes. 14. How to define a Package? Include package statement as the first statement in a java source file. The package statement defines a name space in which classes are stored. Syntax: package pkg; Pkg _ name of the package. We can create a hierarchy of classes. For that separate each package name from the one above it by use of a period. Syntax: package pkg1[pkg2[.pkg3]];

15. How to import packages? Java includes the import statements to bring certain classes, or entire packages in to visibility. Import statements occur immediately following the package statements & before any class definitions. Syntax: import pkg1[.pkg2].( class name *); Pkg1 _name of the Top level package. Pkg2 _name of the subordinate package inside the outer package separated by a dot.

PART B (16 Marks) 1. Explain in detail Interfaces in Java? (N - 11), (N - 14) 2. Explain detail packages with avoiding naming conflicts in java. (N - 11), (N - 12), (N 14) 3. Explain Threads used in Java? (N - 10), (N - 11), (N - 12), (N - 14) 4. Explain Strings used in Java? (N - 12) 5. Explain various Thread lifecycle with multithreading in detail? (N - 12), (N - 14) 6. Explain how exception handling used in Java. (M -11), (A - 12), (N - 11) 7. Explain the idea methods overriding and methods overloading in java? (N - 11) 8. Explain the Life cycle of Thread with an example? (N - 11), (A -13) 9. What is Interfaces? Explain the extension of interfaces, implementation and accessing it. (N - 13) 10. What are the different exceptions caught? Explain the types with example program. (A - 15) 11. Explain try, catch and finally statements used in java with example? (A - 12) 12. Write a java program to create two single dimensional arrays, initialize them and add them to store the result in another array. (A - 11), (A - 12) 13. Write a program to read a input from keyboard into three separate strings and append them use of append(). (N - 11) 14. List the major categories of containers supported by STL. (N - 11) 15. Write a java program for used defined exceptions. (N 13)