Set No.

1

Code No. 220504 II B.Tech. II Semester Supplementary Examinations, November-2003

.in

OBJECT ORIENTED PROGRAMMING (Common to Computer Science and Engineering, Computer Science and Information Technology, Computer Science and Systems Engineering and Electronics and Computer Engineering) Time: 3 hours Max. Marks:80 Answer any Five questions All questions carry equal marks --1. Explain about the concepts of object-oriented programming. What is C preprocessor? Explain various preprocessor directives? Write a C program that reverses a string.

3.a) b) c)

Illustrate dynamic allocation with new operator Vs with malloc operator Write a C program to find the prime numbers in the range 1..100. Explain the significance and usage of the return statement illustrately.

4.

Implement a circle class. Each object of this class will represent a circle, storing its radius and the x and y coordinates of its center as float. Include a default constructor, access functions (to accept and to print), an area( ) function, and a circumference () function.

5.a)

Develop an object oriented programming in C++ to prepare the mark sheet of an university examination with the following items read from the keyboard: Name of the student Roll number Subject name Subject code Internal marks External marks

nt

uW

or ld

2.a) b)

Aj

b)

Design a base class consisting of the data members such as name of the student, roll number and subject name. The derived class consists of the data member’s viz., subject code, internal marks and external marks. The program must be able to build a table, list a table, insert a new entry and deleting a new entry. Explain about the ambiguity in inheritance with any specific program example.

Contd…2.

Code No.220504

-2-

Set No.1

Write an example program to illustrate i) Virtual member function ii) Pure virtual member function

7.a) b)

Why do subscript operators usually come in pairs? Explain. What is the difference between the i) get( ) function and the getline( ) function. ii) get( ) function and the read( ) function.

8.a)

Write a class template to represent a generic vector. Include member functions to perform the following tasks: i) to create the vector ii) to modify the value of a given element iii) to multiply by a scalar value iv) to display the vector in the form (10,20,30,……) b) Explain the differences between Templates and Macros.

or ld

.in

6.

Aj

nt

uW

-x-

Set No.

2

Code No. 220504 II B.Tech. II Semester Supplementary Examinations, November-2003

.in

OBJECT ORIENTED PROGRAMMING (Common to Computer Science and Engineering, Computer Science and Information Technology, Computer Science and Systems Engineering and Electronics and Computer Engineering) Time: 3 hours Max. Marks:80 Answer any Five questions All questions carry equal marks --1. Explain about hybrid design methods and justify their use with suitable examples. Write a C program to transpose a matrix. What is conditional inclusion of code during preprocessing? Illustrate four functions in the header file.

3.a) b) c)

Write short notes on the scope of variables. Write a C program to test whether a number is prime or not Contrast static variable in C with static member variable in C++

4.

Implement a square class. Each object of this class will represent a square, storing its side as float. Include a default constructor, access functions (to accept and to print), an area( ) function, and a perimeter( ) function.

5.a)

Explain the order of initialization of different classes constructors in multilevel inheritance with proper example program. Develop an object oriented program in C++ to create a pay roll system of an organization with the following information read from the keyboard: Employee name Employee code Designation Account number Date of joining Basic pay DA,HRA, and CCA Deduction like PPF,LIC etc.

uW

nt

b)

or ld

2.a) b) c)

Aj

Design a base class consisting of employee name, code and designation and another base class consisting of the data member, such as account number and date of joining. The derived class consists of the data member of basic pay plus other earnings and deductions. The program must build a master table, list a table, inset a new entry edit entry and search for a record that is to be printed. Contd…2.

Code No.220504

-2-

Set No.2

Explain function overloading in base and derived classes and illustrate it with a program.

7.a)

How do the following two statements differ in operation? cin >> c; cin.get(c); Write a function to reverse a string in place (i.e without duplicating all the characters). Why is it necessary to include the file iostream in all our programs?

b) c)

Identify which, if any, of the following template instantiations are valid. Explain why? template class Ptr {…………………}; template< class Type, int size> class Fixed_Array {………}; template class Screen {……………..}; i) const int size = 1024; Ptr < &size > bp1; ii) Ptr < 0 > bp2; iii) int arr[10]; Ptr < arr >bp3; iv) const double db = 3.1415; Fixed_Array < double, db > fa1; v) const int hi = 40; const int wi = 80; Screen < hi, wi+32 > sObj; Write a program that demonstrates how certain exception types are not allowed to be thrown? -x-

Aj

nt

b)

uW

or ld

8.a)

.in

6.

Set No.

3

Code No. 220504 II B.Tech. II Semester Supplementary Examinations, November-2003

.in

OBJECT ORIENTED PROGRAMMING (Common to Computer Science and Engineering, Computer Science and Information Technology, Computer Science and Systems Engineering and Electronics and Computer Engineering) Time: 3 hours Max. Marks:80 Answer any Five questions All questions carry equal marks --1. Explain Grady Booch approach for object oriented design with examples. Illustrate any four functions in the header file. Write a C function to convert upper case characters to lower case.

3.a)

What is recursion? Give recursive definitions for GCD of two numbers and for factorial of a number. Compare recursion with iteration. Write a C program that reads a character array and gives frequency count of each character.

b) c)

or ld

2.a) b)

Implement a rectangle class. Each object of this class will represent a rectangle, storing its sides as float. Include a default constructor, access functions (to accept and to print), an area( ) function, and a perimeter( ) function.

5.a)

Write a program to demonstrate how the destructor member function gets fired from the derived class objects to the base class objects through pointers. Write a program to explain how to define, declare and invoke the destructor members functions under multiple inheritance. Explain how public members of a class can be accessed by the following: i) member function of the class ii) non-member functions of the class iii) member functions of the friend class.

b)

nt

c)

uW

4.

Illustrate the following with an example program for each. i) Virtual member function accessed with pointer ii) Virtual functions and the person class

Aj

6.

Contd…2.

Code No.220504

8.a)

Which, if any, of the following throw expressions are errors? Why? For the valid throw expressions, indicate the type of the exception thrown? i) class exceptionType { }; throw exceptionType( ); ii) int excpObj; throw excpObj; iii) enum mathErr {overflow, underflow, zeroDivide }; throw zeroDivide( ); iv) int *pi = excpObj; throw pi; Name the two template compilation models supported in C++. Explain how programs with function template definitions are organized under each compilation model. -x-

Aj

nt

uW

b)

Why is the use of the << and >> operators called “formatted” I/O, and the use of the functions put( ), get( ), read( ), write( ) etc., call “unformatted” I/O? Why is the default constructor for the ios class declared private? Why is the ios class made to be a virtual base class for the istream and ostream classes?

.in

b) c)

Set No.3

or ld

7.a)

-2-

Set No.

4

Code No. 220504 II B.Tech. II Semester Supplementary Examinations, November-2003

b) 3.a) b)

Write a C function which converts a string of digits into its numeric equivalent. Illustrate any four functions in the header file.

or ld

2.a)

.in

OBJECT ORIENTED PROGRAMMING (Common to Computer Science and Engineering, C omputer Science and Information Technology, Computer Science and Systems Engineering and Electronics and Computer Engineering) Time: 3 hours Max. Marks:80 Answer any Five questions All questions carry equal marks --1. Explain in detail about the responsibility-driven design.

Contrast prefix usage of ++ operator with postfix usage of it. Similarly, contrast the usage of -- operator. Illustrate. Enumerate the bitwise operators in C with their use. Implement a sphere class. Each object of this class will represent a sphere with float data members for radius and the three-dimensional point center. Include a default constructor, access functions (to accept and to print), a surface area( ) function, and a volume( ) function.

5.a)

Write a program to show how to define and declare a class which consists of both virtual members and virtual destructors under multiple inheritance. Consider a bank maintains two kinds of accounts for customers, savings account and current account. The savings account provides compound interest and withdrawal facilities but no cheque facility. The current account provides cheque book facility but no interest. Create a class account that stores customer name, account number and type of account. From this, derive the classes cur_acct and sav_acct to make them more specific to their requirements. Include necessary member functions in order to achieve the following tasks: (a) Accept deposit from a customer and update the balance. (b) Display the balance. (c) Compute and deposit interest. (d) Permit withdrawal and update the balance.

Aj

nt

b)

uW

4.

Use member functions to initialize the class members.

Contd…2.

Code No.220504

-2-

Set No.4

Write a program for checking the type of a class with dynamic cast. Write a program for changing pointer types with dynamic-cast.

7.a) b)

How do the I/O facilities in C++ differ from that in C? Discuss the various forms of get( ) function supported by the input stream. How are they used?

8.a) b)

Write a program to demonstrate the concept of rethrowing an exception. Identify which of the following function template definitions are illegal. Why?

ii) i) ii)

template+ void fun(A, B) {………………..}; template void fun(A,A) {…………..}; template T fun(T, R) {……………….}; template A fun(int *A) {……………….};

or ld

i)

.in

6.a) b)

Aj

nt

uW

-x-

Code No. 220504 II B.Tech. II Semester ...

Design a base class consisting of the data members such as name of the student, · roll number and subject name. The derived class consists of the data member's · viz., subject code, internal marks and external marks. The program must be able · to build a table, list a table, insert a new entry and deleting a new entry.

157KB Sizes 1 Downloads 133 Views

Recommend Documents

Code No:220255 II-B.Tech. II-Semester Supplementary Examinations ...
starter, (iii) Auto transformer starter limiting the supply line starting current to · twice the full-load value. Find the auto-transformer tapping in this case. - - -.

Code No: 221053 II B.Tech., II-Semester ...
OR · 7.a) What is photo resister? Explain briefly. b) Explain the following laws of thermocouple behaviour. i) · law of intermediate metals and · ii) · law of intermediate temperature · 8.a) List the detectors used in radiation and optical pyrometers

Code No: RR-220104 II-B.Tech II-Semester-Regular-Examinations ...
108 kN at a distance of 2m from C. Find the support moments and support reactions. ... b) Three wires AD, BD and CD having the same cross sectional area and of same ... A moving load of 50kN/m and, 4m long, crosses a girder of 16m span.

Code No. 220304 II B.Tech. II Semester Supplementary Examinations ...
a) Follower moves outwards through 40mm during 60° of cam rotation. ... Draw the profile of the cam when the axis of the follower is offset 20mm towards.

Code No:220555 II-B.Tech. II-Semester Examinations ...
examples. 3.a) Explain the PROG features of lisp. b) What is scope and extent? Explain the Dynamic Scoping rules. 4.a) Explain the different methods of parameter passing mechanism. b) What is “type checking”? Discuss the various types of type che

Code No. NR-221854 II Year II-Semester ...
If the annular space is filled with oil of viscosity · 14 poise; calculate the speed of descent of piston in vertical position. The weight · of load on piston including self weight is 12 N. 2. a) Define stream function and velocity potential. How is

Code No: NR220201 II B.Tech II Semester ... Accounts
MANAGERIAL ECONOMICS & PRINCIPLES OF ACCOUNTANCY · ( Common to Electrical & Electronic Engineering, Electronics & · Instrumentation Engineering ...

Code No:221501 II B.Tech., II-Semester Supplementary Examinations ...
SIMULA. b) What is concurrency ? Briefly explain the concurrency features in ADA. 8. Briefly explain the following : · (a) · Basics of LISP · (b) · Type equivalence.

Code No. 220555 II B.Tech. II-Semester Supplementary ...
Code No. 220555. II B.Tech. II-Semester Supplementary Examinations November-2003 · PROGRAMMING LANGUAGES · (Common to Computer Science and Engineering and Computer Science and · Information Technology) · Time: 3 hours · Max. Marks:70 · Answer any Fiv

Code No.221153 II-B.Tech. II-Semester Supplementary Examination ...
articular cartilage surfaces. 7.a) With the help of a P-V curve of a lung, explain the normal breathing mechanism. b) What are the lung mechanical parameters.

Code No. 220551 II-B.Tech. II-Semester ... Accounts
How can you determine the fixed and working capital requirements of a project? 6. What are the objectives and methods of pricing? Do different types of markets.

Code No:220854 II B.Tech., II Semester Supplementary Examinations ...
Code No:220854. II B.Tech., II Semester Supplementary Examinations, November-2003 · FLUID MECHANICS · (Chemical Engineering) · Time:3 hours.

Code No: 220852 II B.Tech. II Semester Supplementary Examinations ...
Derive the equation for steady-state heat transfer through a spherical shell of inner · radius r1 and ... C and the outer wall of the annulus is insulated. Neglecting ...

Code No:220803 II B.Tech., II Semester ... Accounts
A cyclone separator is used to remove sand grains from an air stream at ... cyclone body is 0.6 m in diameter and the average tangential velocity is 16 m/s, what.

Code No. 221251 II B.Tech. II-Semester Supplementary ...
What are the different types of Turing Machines? Construct a Turing machine that · can accept the strings over {0,1} containing an even number of 1's . 7.a) What ...

Code No:220255 II-B.Tech. II-Semester Examinations ...
b) What are the various losses that occur in a single phase transformer? c) In a 100KVA, 2000/200V, 50Hz transformer, the full load copper losses and iron · losses are 1500 watts and 1000 watts respectively. Determine the load for which · efficiency

Code No: 220353 II B.Tech. II Semester Supplementary Examinations ...
c) A simple Delavel steam turbine nozzle ring is supplied with 200 kg/hr of dry · steam at 10 ... iii) The dryness of steam just as it leaves the turbine rotor blading.

Code No: 220551 II-B.Tech. II-Semester ... Accounts
“Perfect Competition results in larger output with lower price than a Monopoly”, · Discuss. 7. Define a Joint-stock Company and explain its basic features.

Code No: 220155 II-B.Tech. II-Semester Supplementary Examinations ...
Code No: 220155. II-B.Tech. II-Semester Supplementary Examinations, April/May-2004 · PROBABILITY AND STATISTICS · (Common to Civil Engineering, Mechanical Engineering, Production ... b) If X is normally distributed with mean 8 and S.D 4, find ... 3.a

Code No: 220253 II B.Tech II Semester Supplementary Examinations ...
b) Explain the concept of Tunnel diode in detail. Draw and explain its ... voltage for a P channel JFET with a=2×10-4 cm and channel resistively · ρ=10ohm-cm.

Code No.220155 II-B.Tech. II-Semester Supplementary Examination ...
b) State and prove Chebyshev's inequality. 4. A population consists of the five numbers 2,3,6,8,11. Consider all possible · samples of size two which can be ...

Code No:220853 II B.Tech., II Semester Supplementary Examinations ...
State the second law of thermodynamics and explain how it is applied for · development of heat engine. 6. A reversible heat engine absorbs 252 kcal at 260°C, ...

Code No: 221851 II B.Tech. II-Semester Supplementary Examinations ...
b) Describe MOTT & WHEELER method of test Coke. 2.a) Describe a method for the manufacture of producer gas. b) Mention important properties and uses of ...

Code No. 220551 II B.Tech II-Semester ... Accounts
Code No. 220551. II B.Tech II-Semester Supplementary Examinations November-2003. MANAGERIAL ECONOMICS AND PRINCIPLES OF ACCOUNTANCY.