• No results found

Subject Name: Object Oriented Programming in C++ Subject Code:

N/A
N/A
Protected

Academic year: 2021

Share "Subject Name: Object Oriented Programming in C++ Subject Code:"

Copied!
15
0
0

Loading.... (view fulltext now)

Full text

(1)

L.J. Institute of Engineering & Technology Semester: IV (2016)

Subject Name: Object Oriented Programming in C++

Subject Code: 2140705

Faculties:

Sr

No UNIT - 1 : CONCEPTS OF OOCP Marks

Topics -Introduction OOCP, Procedural & Object Oriented Programming , Principal, Benefits & Application of OOP

SHORT QUESTIONS

1 What is object oriented programming? (Dec, 2012) [LJIET] 1

2 What is object? 1

3 What is class? 1

4 What is data abstraction? 1

5 What is encapsulation? 1

6 What is inheritance? 1

7 What is Polymorphism? 1

8 What is Dynamic binding? 1

9 List the benefits of OOP 1

10 List applications of OOP 1

DESCRIPTIVE QUESTIONS

1 Explain dynamic binding with example (Jan, 2016) [LJIET] 03 2 Distinguish between Dynamic binding and message Passing. (June, 2015) [LJIET] 03 3 Explain any two characteristics of OOP(June 2015/Jan, 2016) [LJIET] 04 4 List benefits of OOP.(June, 2015) [LJIET] 03 5 Describe multi-level and multiple inheritances. (June, 2015) [LJIET] 04 6 Explain features of object oriented programming language.(Dec, 2012) [LJIET] 06 7 Explain features of object oriented programming language or Explain basic concepts of

Object-Oriented Programming. (May/June2012/Dec 2011/June2013/Dec2013/Jan 2015) [LJIET]

07

8 Explain benefits of Object oriented programming. (Jan, 2016) [LJIET] 07 9 Give difference between POP Language and OOP Language. (Dec 2010/June 2014)[LJIET] 07 Sr

No UNIT - 2 : C++ BASICS Marks

Topics - Overview & Program Structure, Namespace, Identifiers, Variables, Constants, Enum, Operators, Type Casting & Control Structure

SHORT QUESTIONS

1 Why main function is special in C++? 1

2 What is run-time error, logical error and syntax error? 1 3 What is the role of #include directive in C++? 1

(2)

L.J. Institute of Engineering & Technology Semester: IV (2016)

5 What is the difference between while and do-while loop? 1 6 In control structure switch-case what is the purpose of default in C++? 1 7 What is the effect of absence of break in switch case in C++? 1

8 What is type conversion in C++? 1

9 What is the difference between local variable and global variable? 1 10 How does a main () function in C++ differ from main () in C? 1 12 Find errors, if any in given C++ statement cout<<”X=”X; 1 13 Find errors, if any in given C++ statement cin>>X;>>Y; 1 14 Find errors, if any in given C++ statement m=5;// n=10; // s= m+n ; 1

15 Why array called derived data type? 1

16 What are the applications of void data type in C++? 1 17 How does a const defined by const differ from the constant defined by the preprocessor

directive statement #define?

1

18 What is the application of scope resolution operator:: in C++? 1 19 What is the advantage of new operator as compared to the function malloc()? 1

DESCRIPTIVE QUESTIONS

1 Describe with examples the use of enumeration data types.(June 2015) [LJIET] 04 2 Explain new & delete operator. What are the advantages of new operator Over malloc? (June,

2013)[LJIET] (Jan, 2016)[LJIET]

04

3 Explain scope resolution operator with example. (June, 2013)[LJIET] 03 4 What is a reference variable? What is its major use? Give Example. (June 2013)[LJIET] 04 5 Explain member dereferencing operator and memory management operator in

C++. (Jan, 2016)[LJIET]

04

6 Explain << and >> operators.(June, 2015) [LJIET] 04 7 Explain how to allocate and de-allocate memory dynamically(June, 2015) [LJIET] 03 8 Explain reference variables(June, 2015) [LJIET] 03 9 Explain reference variables and their usage by giving examples. (Jan 2016)[LJIET] 07 10 Describe various operators in C++.( Dec 2013, Jan 2015)[LJIET] 07 11 Write the basic structure of a C++ program with all necessary blocks. (June, 2014) [LJIET] 07

UNIT - 3 : C++ Functions Marks

Topic – 1: Simple Functions, Call By value & Call By Reference,

SHORT QUESTIONS

1 When do we need to use default arguments in a function? 1 2 What are different types of writing prototype? 1 3 Explain function prototyping with example 1 4 Difference between get() and getline(). 1

5 What is function prototype? 1

DESCRIPTIVE QUESTIONS

1 Write a C++ Program to generate a Fibonacci Series by Using Recursion(June,2015)

[LJIET]

(3)

L.J. Institute of Engineering & Technology Semester: IV (2016)

2 Write a program using a function with arguments to swap the values of a pair of integers using call by reference. (Dec 2012)[LJIET]

07

3 Write a program using function with arguments to swap the values of a pair of integersMay/June2012[LJIET]

07

4 Explain Call by reference and Return By Reference with suitable example.

(Jan,2015)[LJIET]

07

5 What is call and return by reference? Explain with example.(June 2014)[LJIET] 07 6 What do you mean by call by value and call by reference? Justify your answer with suitable

example. (Jan,2016)[LJIET]

07

7 Write a program using function with arguments to swap the values of a pair of integers.

(Dec 2011)[LJIET]

07

Topic – 2: Inline Functions & Macro Vs. Inline Functions

SHORT QUESTIONS

1 When you will make function inline? Why? 1 2 When argument is passed by reference in function 1 3 Write some situations where inline expansion may not work 1 4 What does micro differs from inline function? 1

DESCRIPTIVE QUESTIONS

1 What is Inline Function? In which Situation Inline Function may not work? How does an inline function differ from a pre-processor macro? Write program using Inline Function to find largest of three numbers. (June 2013)[LJIET]

07

2 Explain the inline functions and default arguments giving examples. ( June 2011)[LJIET] 07 3 Describe inline function in C++ with example. ( May/June2012)[LJIET] 07 4 What is inline function? Where and How it is useful in C++ ? Give an example. (June 2014)

[LJIET]

07

5 Explain the inline functions and default arguments giving examples. (June 2011) [LJIET] 07 6 Explain inline function and its use with suitable example. (Jan 2015) [LJIET] 07 7 Explain merits and demerits of inline function. (June 2015/Jan 2016) [LJIET] 04

Topic – 3: Overloading of functions, Default Arguments

SHORT QUESTIONS 1 What is a default argument?

2 What is function overloading?

DESCRIPTIVE QUESTIONS

1 Define function overloading. Give proper example.(June 2013) [LJIET] 03 2 Explain function overloading with suitable example. (June 2015) [LJIET] 04 3 Explain default arguments by giving an example(s).(June 2015/ Jan 2016) [LJIET] 04 4 Declare a class called book having members like book_title, publisher and author_name.

Overload extractor and inserter operators ( >> and << ) for class book. (June 2015) [LJIET]

04

(4)

L.J. Institute of Engineering & Technology Semester: IV (2016)

7 Describe following terms in C++ with suitable example.

Function Overloading, Inline function, Default argument, Call by reference

(Dec 2013) [LJIET]

07

Topic – 4: Friend Functions & Virtual Functions

SHORT QUESTIONS

1 What are Friend functions? Write the syntax 1 2 Write some properties of friend functions 1

DESCRIPTIVE QUESTIONS

1 Define friend function (June 2014) [LJIET] 02 2 Define & Discuss pure virtual function.(June 2013) [LJIET] 03 3 Can we overload an assignment operator using friend function? Justify your answer.

(June 2015) [LJIET]

04

4 Is assignment operator overloaded by default? Justify your answer. When do you overload it mandatorily?

04

5 Explain friend function and its use? (Jan 2016) [LJIET] 04 6 Explain two usage of keyword virtual. (June, 2015) [LJIET] 03 7 What are the Virtual Functions? Where are they needed? Are virtual functions inherited?

Justify your answer with the help of an example. (June 2015) [LJIET]

07

8 What is Friend function? Explain with example. (Dec 2010) [LJIET] 07 9 Explain friend function with suitable example. (Jan 2015) [LJIET]/ (June 2015) 07 / 04 10 Explain a friend function with example and List some of the special properties of the friend

function. (Dec 2012)[LJIET]

07

11 What is friend function? Give an example. What is the advantage of Overloading binary operator as friend function?( June 2010) [LJIET]

07

UNIT – 4: Object & Classes Marks

Topic – 1: Basics of Object & Class in C++

SHORT QUESTIONS

1 How the class is specified? 1

2 How to create an object? 1

3 How to access a class member? 1

4 How the member functions are defined? 1

5 Define local classes 1

DESCRIPTIVE QUESTIONS

1 How does a main() function in C differ from C++? Give General format of Class.

(June 2013)[LJIET]

02

2 Create a class Account. It has three data member account id, name and balance. Define function to assign value and display value. Define function that search account number given by the user. If account number exists, print detail of that account. Write a program using array of object.

(5)

L.J. Institute of Engineering & Technology Semester: IV (2016) Declare at least 5 account and print details. (June 2013) [LJIET]

3 Define Friend Function. Create two classes DM and DB which store the value of distances. DM stores distances in meters and centimeters and DB in feet and inches. Write a program that can read values for the class objects and add one object of DM with another object of DB. Use a friend function to carry out the addition operation. The object stores the results may a DM object or DB object, depending on the units in which the results are required. The display

should be in the format of feet and inches or meters and centimeters depending on the object on display. 1 Feet = 0.3048Meter 1Meter = 3.28 Feet

1 Inch = 2.54 Centimeter 1 Centimeter = 0.3937 Inch(June 2013) [LJIET]

07

4 Explain Friend function and its characteristics. Define a class matrix with an integer array of 3X3 as a data member. Define a friend function which adds two matrix objects and returns resultant matrix object. (Dec 2013) [LJIET]

07

5 Define a class to represent a string with operations string length, compare and reverse. Show its use by writing main().(June 2011) [LJIET]

07

6 Write a program in C++ to find the sum of two entered complex numbers from different classes and display the sum using a common friend function of both classes. (June 2015) [LJIET]

07

7 Explain the difference between structure and class in C++. (Jan 2015) [LJIET] 07 8 Write a program which includes class to represent a vector (a serious of float values). Include

member functions to perform the following tasks: a> To create the vector

b> To modify the value of given elements

c> To Display the given vector in the form(10,20,30)(Dec 2011)[LJIET]

07

9 Define a class complex, having data member as X and Y, Define a friend function sum () to add two complex numbers and display all numbers using show () friend function Program for Maximum number using Friend function for two classes. (Dec 2010)[LJIET]

07

Topic – 2: Private & Public Members, Static Data & Function Members

SHORT QUESTIONS

1 What is static data member? 1

2 What is static member function? 1

3 How the objects are used as function argument? 1

4 List access specifiers. 1

5 What is a private member of a class? 1

DESCRIPTIVE QUESTIONS

1 What is the purpose of Static? Write Characteristics of Static Data Member and Static Member Function. Write a program that demonstrates the Static Data Member And static member function. (June 2013) [LJIET]

07

2 Define a class Time with hours and minutes as two data members, add necessary member functions to initialize and display data of class. Do not use constructors in a class. Define a member function sum() which adds two Time objects. Invoke the statements like T3.sum(T1, T2) in main ().(Dec, 2013) [LJIET]

(6)

L.J. Institute of Engineering & Technology Semester: IV (2016)

3 Discuss the use of static data members and static member functions with example

(June, 2014) [LJIET]

07

4 Explain Static Data Member and Static Member Function with their special characteristics. Also write a suitable programming example. (Jan, 2015) [LJIET]

07

5 Write a C++ program to explain Objects as function arguments. Define a class name VALUE with two data member variable, two member functions for inputting data and displaying the result. Define third member function that takes two objects as arguments and adds the objects. (June, 2015) [LJIET

07

6 Write a single C++ program to explain static member and static member function. (June, 2015) [LJIET]

07

7 What is friend function? Write a program to find out sum of two private data members x and y of two classes A and B using a common friend function. Assume that the prototype for both the classes will be void sum (A, B); (Jan, 2016) [LJIET]

07

8 Write down the uses of static data member and static member function with suitable example. (Jan, 2016) [LJIET

07

9 Explain the constant argument, constant member function and constant object with suitable example. (June 2010)[LJIET]

07

Topic – 3: Constructors & Their Types , Destructors

SHORT QUESTIONS

1 Define constructor 1

2 Define default constructor 1

3 Define parameterized constructor 1

4 Define copy constructor 1

5 Define dynamic constructor 1

6 Define destructor 1

7 Define multiple constructors or constructor overloading 1 8 Write some special characteristics of constructor 1

DESCRIPTIVE QUESTIONS

1 Explain by example(s), copy constructor. (Jan, 2016) [LJIET] 04 2 Explain copy constructor and its usage by giving an example. (June, 2015) [LJIET] 04 3 Explain Constructor with default arguments.( Dec 2010) [LJIET] 03 4 Destructor function cannot be overloaded. True or false? Justify your answer.

(Jan, 2016) [LJIET]

04

5 What is Constructor? Write the characteristics of constructor function. Define Class named point which represents 2-D Point, i.e P(x, y). Define Default constructor to initialize both data member value 5, Parameterized constructor to initialize member according to value supplied by user and Copy Constructor. Define Necessary Function and Write a program to test class Point.

(June 2013) [LJIET]

07

6 What is a constructor? Which are the special characteristics of constructor functions? What is the need of “do-nothing” implicit constructor? When the destructor function invoked?

(Dec 2013) [LJIET]

(7)

L.J. Institute of Engineering & Technology Semester: IV (2016)

7 What is a constructor? Explain types of constructors with examples. (June, 2014/ Jan 2015) [LJIET]

07

8 Explain the use of destructor in C++. Discuss its features. (June, 2014) [LJIET] 07 9 Write a single C++ program to explain the concept of both constructor and destructor.

(June, 2015) [LJIET]

07

10 Define copy constructor. Explain its significance. Under which condition is it invoked? Describe your answer with a C++ program. (June, 2015) [LJIET]

07

11 What are the characteristics of constructor in C++? Write a program to illustrate the use of copy constructor. (Jan, 2016) [LJIET]

07

12 Explain following with respect to C++ with examples. New operator, destructor

(June 2011)[LJIET]

07

13 Declare a class called book_details to represent details for a book, having data members like title, author, edition, price and no_of_copies_available. Define following functions: - constructor(s)

- display to display all data members

- find_books to find and display details of all books having price less than Rs. 250 - main to create an array of book_details and to show usage of above functions

(June 2015)[LJIET]

07

14 Write a class called “arithmetic” having two integer and one character data members. It performs the operation on its integer members indicated by character member (+, -, *, /). For example * indicates multiplication on data members as d1 * d2. Write a class with all necessary constructors and methods to perform the operation and print the operation performed in format Ans = d1 op d2. Test your class using main(). (June 2011)[LJIET]

07

Topic – 4: Operator Overloading & Type Conversion

SHORT QUESTIONS

1 What is operator overloading? 1

2 List out the operators that cannot be overloaded. 1 3 What is the purpose of using operator function? 1 4 List out the operators that cannot be overloaded using Friend function. 1

5 What is type conversion? 1

DESCRIPTIVE QUESTIONS

1 What is Type conversion? Explain Basic to class type conversion with example.

(June 2013)/(June 2015) [LJIET]

04

2 Define Operator overloading. Create class Time that has three data members hour, minute and second and two constructor, default constructor and parameterized constructor to initialize data member. Write a program to add two times by overloading operator +.(June 2013) [LJIET]

07

3 What is type conversion? Explain the type conversion from basic type to class type and from class type to basic type with proper example.(Dec 2012/June 2013/Dec 2013) [LJIET]

07

4 Define a class complex with real and imaginary as two data member, add necessary constructors and member function to initialize and display data of class. Class should overload the + operator to add two complex objects and return the results. Invoke the statements like C3=C1+C2 in main (). (Dec 2013) [LJIET]

(8)

L.J. Institute of Engineering & Technology Semester: IV (2016)

5 Write a C++ program that overloads + operator to add two complex numbers. (June 2014) [LJIET]

07

6 Define a class complex with real and imaginary as two data member with default & parameterized constructors, function to initialize and display data of class. It should overload the + operator to add two complex objects. Write a complete C++ program to demonstrate use of complex class. (Jan 2015) [LJIET]

07

7 Write a C++ program to overload the + operator to concatenate two strings.

(June 2015)[LJIET]

07

8 The effect of a default argument can be alternatively achieved by overloading. Discuss with an example. (June 2015)[LJIET]

07

9 What is an operator function? Write a program to overload binary + operator as a member function. (Jan 2016)[LJIET]

07

10

Explain type conversion from class type to basic type and one class type to another class type

with suitable example. (Dec 2013 / Jan 2016)[LJIET] 07

11 Define a circle class with radius as data member, necessary constructors and member function to compute area of circle. Class should overload the = = operator to compare two circle objects whether they are equal in radius. Demonstrate its use in main().

(June 2010/June 2011) [LJIET]

07

12 Define operator overloading. Explain how to overload unary operator and binary operator

(Dec 2012) [LJIET]

07

13 Declare a class called bird having two private data members called name and weight. Define following functions :

- default constructor for reading data members from key board

- overloaded constructor with two arguments to be used for initialization of data members. - display function to display data members.

- overloaded member operator >= to compare weight of two bird objects, returning false if weight of first bird object is less than that of second & true otherwise.

Define function main to illustrate use of above functions. (June 2015/ Jan 2016) [LJIET]

07

14 Declare a class called book having members like book_title, publisher and author_name. Overload operators << and >> for class book. Define function main. (Jan 2016) [LJIET]

07

Sr No

UNIT - 5 :Inheritance Marks

Topic – 1: Concept Of Inheritance ,Types of Inheritance: Single, Multiple, Multi-Level, Hybrid, Hierarchical, Protected Members, Overriding, Virtual Base Class

SHORT QUESTIONS 1

1 What is meant by inheritance? 1

2 List the class member‟s visibility 1

3 Explain the public visibility 1

4 Explain the private visibility 1

5 Explain the protected visibility 1

6 What is meant by Abstract base class? 1 7 Protected data members. (June, 2014)[LJIET] 2

(9)

L.J. Institute of Engineering & Technology Semester: IV (2016)

DESCRIPTIVE QUESTIONS

1 Explain Visibility mode. (Jan 2016)[LJIET] 03 2 What does Inheritance mean in C++? Explain different forms of Inheritance.

(Dec 2010)[LJIET]

04

3 Explain virtual and pure virtual functions. (Jan 2016)[LJIET] 04 4 Explain in brief different types of inheritance. (Jan 2016)[LJIET] 04

5 Explain keywords public and protected. (June, 2015) [LJIET] 04

6 What does inheritance mean in c++? What are different forms of inheritance? Give an example for each. (Dec 2012/ Dec 2011) [LJIET]

07

7 Write down different form of inheritance and describe them in detail. Or Explain various forms of inheritance with suitable diagrammatic illustrations.

(May/June 2012/Dec 2013)[LJIET]

07

8 Define Inheritance. Write the types of Inheritance. Explain Inheritance with example. Consider Example with respect to print result of Student and Student Details. (June, 2013) [LJIET]

07

9 Consider a class network as shown in figure given below. The class Employee derives information from both Account and Admin classes which in turn derive information from the class Person. Define all the four classes and write a program to create, update and display the information contained in Employee objects. (Dec 2013) [LJIET]

07

10 Explain various forms of inheritance with suitable diagram.(Jan 2015) [LJIET] 07 11 Explain the importance of Inheritance. List its types and explain any one with example.

(June 2014) [LJIET]

07

12 What is Inheritance? What are the different visibility modes observed while deriving a class from a base class. Explain with C++ Program. (June 2015) [LJIET]

07

13 What is inheritance? Why do we use of protected specifier for base class data members in inheritance? Explain hybrid inheritance with example. (Jan 2016) [LJIET]

07

14 Explain access specifier and its effects with different modes of inheritance

(Jan 2016) [LJIET]

07

15 Consider the following class structure as shown in the figure. The class Result derives information from the classes Internal, University and External respectively. The

Internal and External classes access information from the Student class. Define all five classes and write a suitable program to create and display the information contained in

Result object. (Jan 2016) [LJIET]

(10)

L.J. Institute of Engineering & Technology Semester: IV (2016)

16 What is inheritance? Give the different types of inheritance and explain how it encourages reusability and sharing. (June 2011)[LJIET]

07

17 Explain following:

a).Constructor with default arguments. b).Call by reference. c).Private, Public and Protected access specifier[LJIET] Dec 2010

07

18 Declare a class called item having data members item_code, item_name, cost and discount. Derive two classes from class item, namely employee and customer. The class employee has data members like employee_id and amount. The class customer has data members like customer_name and amount. Define following functions

- to initialize data members.

- to display the values of members.

- to compute amount to be paid for purchased item.

- main to create objects of both derived classes and to show usage of above functions. (June 2015/ Jan 2016)[LJIET]

07

19 Assume that Circle is defined using radius and Cylinder is defined using radius and height. Write a Circle class as base class and inherit the Cylinder class from it. Develop classes such that user can compute the area of Circle objects and volume of Cylinder objects. Area of Circle is pie *radius*radius, while volume of Cylinder is pie*(radius * radius)*height.

(Dec 2013)[LJIET]

07

20 Assume that vehicle class is defined as base class with price and year of manufacturing. Derive two classes namely bus and truck from base class with bus with seating capacity and truck with loading capacity. Develop classes with necessary member functions to get and put data. Demonstrate its use in main ().June 2010[LJIET]

07

21 Create a class student that stores roll_no, name. Create a class test that stores marks obtained in five subjects. Class result derived from student and test contains the total marks and percentage obtained in test. Input and display information of a student. (Jan 2015) [LJIET]

(11)

L.J. Institute of Engineering & Technology Semester: IV (2016)

Sr No

UNIT - 6 :Polymorphism Marks

Topic – 1: Pointers in C++, Pointers & Objects, This Pointer, Virtual & Pure Virtual Functions, Implementing , Polymorphism

SHORT QUESTIONS

1 Explain generic pointer. 02

2 What is polymorphism? 1

3 What are the types of polymorphism? 1

4 What the types in compile time polymorphism? 1

5 What is pointer to objects? 1

6 What is this pointer? 1

7 What are pure virtual functions? Write the syntax 1

8 What are virtual functions? 1

DESCRIPTIVE QUESTIONS

1 Define and Discuss Pure Virtual Function. (June 2013)[LJIET] 02 2 Explain this pointer.(June 2013)[LJIET] 03 3 Explain this pointer with example. (June 2015)[LJIET] 04 4 Explain need and usage of this pointer. 04 5 How they differ?

Char const *ptr

Char *const ptr(June 2013)[LJIET]

02

6 How is polymorphism achieved at compile time & run time. ( June 2013)[LJIET] 03 7 Differentiate Compile time polymorphism and Runtime polymorphism.(June

2015)[LJIET]

03

8 Explain this pointer. Discuss effect of C++ statement delete this in the program(Jan 2016)[LJIET]

04

9 Write a C++ program that creates inventory of items by storing item_code, item name and qty. Access the data using pointers. (June 2014)[LJIET]

07

10 Create a class ITEM with item_code, item_rate and quantity as data members. Create an array of pointers to objects of class ITEM. Write a member function which will calculate the amount of item. Print item_code and amount of item. (Jan 2015)[LJIET]

07

11 Explain pointer to objects. What is this pointer? Write a complete program to illustrate the use of this pointer.(Dec 2013/Jan 2015)[LJIET]

07

12 Explain Runtime polymorphism. Explain and demonstrate, how virtual function to achieve runtime polymorphism? (Dec 2013)[LJIET]

07

13 What is a virtual function? Write rules for virtual function. Explain with example.

(Dec 2012)[LJIET]

07

14 Describe the following terms in C++ with example. (Jan 2016)[LJIET]

i) Default Argument (Jan2016)[LJIET]ii) Function Overloading iii) Destructor iv) this pointer

07

15 What is polymorphism? How can we implement it in C++? (June 2014)[LJIET] 07 16 What is polymorphism? How is it achieved in C++? Explain with suitable example. 07

(12)

L.J. Institute of Engineering & Technology Semester: IV (2016) (Jan 2016)[LJIET]

17 Declare a class called logic_gate to represent logic gates. The class has two data members - input1 and input2 to represent two inputs of the gate and a virtual function member called get_gate_output. Derive two classes from the base class logic_gate, namely and_gate and or_gate to represent „logical and gate‟ and „logical or gate‟ respectively. Define function get_gate_output in both of these classes to get the output of the gate. Show use of above classes and functions to have dynamic polymorphism in function main. (June 2015/ Jan 2016)[LJIET]

07

18 Declare a class called my_string having char * str_ptr as a member, used to point to a string. Define a constructor for initializing member. Define an overloaded operator + to be applied on two operands of type class my_string for concatenating strings pointed by str_ptr of operands. The resultant string is placed in a new object of type class my_string which is returned. Define main to show the usage of these functions (Jan 2016) [LJIET]

07

19 Write a C++ program demonstrating use of the pure virtual function with the use of base and derived classes (June 2011)[LJIET]

07

Sr No

UNIT - 7 : I/O and File Management Marks

Topic – 1: Concepts of Streams, cin and cout objects, C++ Stream classes

SHORT QUESTIONS

1 What are streams? 1

2 What are the stream classes for console operations? 1 3 Draw the console stream classes for hierarchy 1

DESCRIPTIVE QUESTIONS

1 Explain Function : seekp(), tellg()(June 2015/ Jan 2016)[LJIET] 03 2 Explain seekg(), tellg() (Jan 2016)[LJIET] 04 3 Define following with examples

(1) Object (2) Macro (3) Binary File (4) Portability(June 2014)[LJIET]

07

4 What is a stream? Describe various stream classes for console I/O operations.

(Dec 2013)/(Jan 2015)/(Jan 2016)[LJIET]

07

5 Explain the class istream and class ostream with hierarchy along with their member.

(June 2015)[LJIET]

07

Topic – 2: Unformatted & Formatted I/O, manipulators, File Stream

SHORT QUESTIONS

1 List out some of the unformatted I/O operators. 1 2 List out some of the formatted I/O operation 1

3 List some of the ios functions 1

(13)

L.J. Institute of Engineering & Technology Semester: IV (2016)

DESCRIPTIVE QUESTIONS

1 (i) Write output for the following (Assume all libraries has been included): (June 2013)[LJIET] 1. int main() { float f = -76.54321; cout.fill („*‟); cout.precision(3); cout.setf(ios::internal, ios::adjustfield); cout.setf(ios::scientific, ios:floatfield); cout.width(15); cout << f << “\n”; } 2. int main() { float f = 123.4; cout.setf(ios::showpoint); cout.setf(ios::showpos); cout.precision(3); cout.setf(ios::fixed, ios::floatfield); cout.setf(ios::internal, ios:adjustfield); cout.width(10); cout << f << “\n”; } 04

2 Explain ios::ate and ios::binary (June 2015/ Jan 2016)[LJIET] 03 3 Explain manipulators by giving example. (June 2015/ Jan 2016)[LJIET] 03/3.5 4

List functions with equivalent manipulators in C++. Explain any one manipulator with example. (Dec 2013)[LJIET]

07

Topic – 3: File Stream Classes, File management functions, File modes, Binary & Random Files

SHORT QUESTIONS

1 What is a file? 1

2 List some of the file modes 1

3 What are the functions that the file stream class provides? 1 4 What are steps involved in using a file in a C++ program. 1 5 What does the “current position” mean when applied to files? 1 6 What is the advantage of saving data in binary form? 1

DESCRIPTIVE QUESTIONS

1 List the file mode parameters. (June 2014)[LJIET] 04

2 List error handling file functions in C++ (June 2014)[LJIET] 02

3 Explain characteristics of binary and random files (Jan 2016)[LJIET] 03 4 Explain different constructors of ifstream (Jan 2016)[LJIET] 03 5 Explain various constructors of ofstream. (June 2015)[LJIET] 03 6 Write a program that reads a text file and creates another file that is identical 07

(14)

L.J. Institute of Engineering & Technology Semester: IV (2016)

except that every character is in upper case.(June, 2013)[LJIET]

7 Explain File Pointers and functions for their manipulation.(Dec, 2013)[LJIET] 07 8 Write a program that reads a text file and creates another text file that is identical except that

every letter must be converted to lower case irrespective of its original case (e.g „a‟ or „A‟ will become ‟a‟). (Jan, 2015)[LJIET]

07

9 Explain various file mode parameters in C++. Write a program to copy the contents of a source file student1.txt to a destination file student2.txt character by character.

(Jan, 2016)[LJIET]

07

10 Write a program that opens two text files for reading data. It creates a third file that contains the text of first file and then that of second file (text of second file to be appended after text of the first file, to produce the third file). (June 2015)[LJIET]

07

UNIT - 8 : Templates, Exceptions & STL Marks

Topic – 1: What is template? Function template & Class template

SHORT QUESTIONS

1 List the components of STL 1

2 What is container? 1

3 What is an algorithm? 1

4 What is template? 1

5 What are types of template? 1

DESCRIPTIVE QUESTIONS

1 Explain Structure of Template class. (June, 2014)[LJIET] 02

2 What is STL? Describe the use of STL. (June, 2015)[LJIET] 03

3 What is Generic Programming? How it is implemented in C++.Write General format of class templates and function Template. Write program to swap Number using Function Template. Function prototype is given below:

void swap(int, int , float , float )

Swap two integer number and swap two float number.(June, 2013)[LJIET]

07

4 Explain with the help of an example why templates are used in programming?

(Dec, 2013)[LJIET]

07

5 What is template? Explain function templates and class templates with example.

(June, 2015)[LJIET]

07

6 What is the purpose of using template in C++? Explain template function and template class with example. (Jan, 2016)[LJIET](Jan, 2016)[LJIET]

07,04

7 Explain STL with its core components. (Jan, 2015)[LJIET] 07

8 It is required to find roots of quadratic equation ax2 + bx + c = 0. Write a program that reads values of a, b & c and finds roots if roots are real; otherwise raises and handles exception (if roots are complex). (Jan, 2016)[LJIET]

07

9 Create a generic class (using template), called my_class having following data members : - an array to store numbers

- an array of flags to indicate whether the location is occupied or free Define following member functions:

- to insert a number at specified location

- to remove a number from specified location, if the specified location is occupied - to search a number in the array.

(15)

L.J. Institute of Engineering & Technology Semester: IV (2016)

Define function main to crate two objects of type class my_class to store int & float numbers respectively. Also show usage of member functions in the main.

(Jan, 2016)[LJIET]

10 Declare a template class called exam having an array of generic type as a data member, named elements[10]. Define following generic (template) member functions:

- sort to arrange elements in ascending order

- find_max to find and return maximum from the array

Define main to illustrate usage of these functions to process two different types of data. (June, 2015)[LJIET]

07

Topic – 2: Introduction to exception, try-catch, multi catch, catch all

SHORT QUESTIONS

1 What are Exceptions? 1

2 What are the blocks used in the Exception Handling? 1

3 Write the syntax of catch construct 1

4 Write the syntax of throw construct 1

5 List out the tasks to be performed for error handling code 1

DESCRIPTIVE QUESTIONS

1 Explain try….catch….throw (June 2014)[LJIET] 04 2 Explain generic exception handler (Jan 2016)[LJIET] 03 3 Components of STL. (June 2014)[LJIET] 04 4 What is Exception? Explain Exception Handling Mechanism. Write a program that

demonstrates use of multiple catch. Add at least three catch block in your Program

(June, 2013)[LJIET]

07

5 What is an exception? What are the advantages of using exception handling in a program? Illustrate C++ exception handling mechanism.(Dec, 2013)[LJIET]

07

6 What is Exception? Explain Exception Handling Mechanism. Give example with multiple catch blocks. (Jan, 2015)[LJIET]

07

7 What is Exception Handling and how is it implemented in C++? Write a C++ program that throws an arithmetic exception whenever the result of arithmetic computation becomes odd.

(June, 2015)[LJIET]

07

8 Explain the mechanism of keywords try, throw and catch to handle Exceptions in C++. Explain with an example like “division by zero” situation. (Jan, 2016)[LJIET]

07

9 Explain catch all exception and multiple catch exception with example.(Jan, 2016)[LJIET] 07 10 By giving an example, illustrate use and working of nested try blocks and re -throwing of an

exception. (June, 2015)[LJIET]

References

Related documents

For example, the notes explained that the Committee had “not included a clause on the right [of] voters to recall their representatives” contrary to the Subcommittee’s provision

562 Tuition to Other School Districts outside the State (including Charter Schools) – Tuition paid to other school districts for students, including charter schools and

// Define the function displayInfo() that you declared within the Grad class in the header file // See expected output in question file?. Q3: Add Friend function changeRollNo()

Contact the organization and find out what would benefit the population they serve (e.g., tube socks, canned vegetables, blankets for puppies, books for inner city schools).. Decide

Write a JavaScript code to ask user to enter at least two numbers and output the sum and average of these two numbers in alert box using a function... Write a script code to

  4  Lumina Foundation. “New Jersey”. http://www.luminafoundation.org/state_work/new_jersey/. 

Figure 44: Contour plot of horizontal instantaneous velocity for Libeccio wind simulation, at three different horizontal planes: (A) sea surface, (B) three meters under sea surface,

This means when a potential client searches for a practice like yours, your Website shows up closer to the top of the search results page.. keyword or term assigned to an entry