CS304 Final Term Examination Spring 2006 Time Allowed: 150 Minutes. + operator for the complexclass?

Similar documents
3.Constructors and Destructors. Develop cpp program to implement constructor and destructor.

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

Object Oriented Programming(OOP).

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

END TERM EXAMINATION

Come and join us at WebLyceum

VALLIAMMAI ENGINEERING COLLEGE

C++ 8. Constructors and Destructors

PROGRAMMING IN C AND C++:

For Teacher's Use Only Q No Total Q No Q No

CS 162, Lecture 25: Exam II Review. 30 May 2018

More C++ : Vectors, Classes, Inheritance, Templates

More C++ : Vectors, Classes, Inheritance, Templates. with content from cplusplus.com, codeguru.com

Short Notes of CS201

CS201 - Introduction to Programming Glossary By

Babaria Institute of Technology Computer Science and Engineering Department Practical List of Object Oriented Programming with C

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

VB.NET. Exercise 1: Creating Your First Application in Visual Basic.NET

Object Oriented Design

Recharge (int, int, int); //constructor declared void disply();

C++ Important Questions with Answers

FINAL TERM EXAMINATION SPRING 2010 CS304- OBJECT ORIENTED PROGRAMMING

Page. No. 1/15 CS201 Introduction to Programmming Solved Subjective Questions From spring 2010 Final Term Papers By vuzs Team

Lecture 18 Tao Wang 1

C++ (Non for C Programmer) (BT307) 40 Hours

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

CSC1322 Object-Oriented Programming Concepts

7. C++ Class and Object

CS201 Latest Solved MCQs

Constructors for classes

M Introduction to Visual Basic.NET Programming with Microsoft.NET 5 Day Course

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

Inheritance, and Polymorphism.

Constructor - example

Classes. Logical method to organise data and functions in a same structure. Also known as abstract data type (ADT).

public : int min, hour ; T( ) //here constructor is defined inside the class definition, as line function. { sec = min = hour = 0 ; }

Introduction to C++ Introduction to C++ Dr Alex Martin 2013 Slide 1

CS 6456 OBJCET ORIENTED PROGRAMMING IV SEMESTER/EEE

And Even More and More C++ Fundamentals of Computer Science

2559 : Introduction to Visual Basic.NET Programming with Microsoft.NET

1. An object of a class can be treated as an object of its corresponding class.

Data Structures using OOP C++ Lecture 3

Come and join us at WebLyceum

Object Oriented Programming with c++ Question Bank

Java Programming Lecture 7

Chapter 10 Introduction to Classes

Padasalai.Net s Model Question Paper

SRM ARTS AND SCIENCE COLLEGE SRM NAGAR, KATTANKULATHUR

CLASSES AND OBJECTS IN JAVA

THE BIG FOUR FRIEND FUNCTIONS

Object-Oriented Design (OOD) and C++

6.096 Introduction to C++ January (IAP) 2009

Chapter 3 Function Overloading

M.C.A DEGREE EXAMINATION,NOVEMBER/DECEMBER 2010 Second Semester MC 9222-OBJECT ORIENTED PROGRAMMING (Regulation 2009)


INHERITANCE PART 2. Constructors and Destructors under. Multiple Inheritance. Common Programming Errors. CSC 330 OO Software Design 1

University of Utah School of Computing

Review Questions for Final Exam

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

Lecture-5. Miscellaneous topics Templates. W3101: Programming Languages C++ Ramana Isukapalli

CSC 210, Exam Two Section February 1999

Chapter 15: Inheritance, Polymorphism, and Virtual Functions

THE NAME OF THE CONSTRUCTOR AND DESTRUCTOR(HAVING (~) BEFORE ITS NAME) FUNCTION MUST BE SAME AS THE NAME OF THE CLASS IN WHICH THEY ARE DECLARED.

Get Unique study materials from

PROGRAMMING IN C++ (Regulation 2008) Answer ALL questions PART A (10 2 = 20 Marks) PART B (5 16 = 80 Marks) function? (8)

Instantiation of Template class

Quiz Start Time: 09:34 PM Time Left 82 sec(s)

C++ PROGRAMMING LANGUAGE: CLASSES. CAAM 519, CHAPTER 13

Keyword this. Can be used by any object to refer to itself in any class method Typically used to

1. Which of the following is the correct expression of character 4? a. 4 b. "4" c. '\0004' d. '4'


Ch02. True/False Indicate whether the statement is true or false.

Introduction to Programming Using Java (98-388)


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

Time: 3 HOURS Maximum Marks: 100

Object Oriented Programming. Solved MCQs - Part 2

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

Special Member Functions

Course Text. Course Description. Course Objectives. StraighterLine Introduction to Programming in C++

Object-Oriented Languages and Object-Oriented Design. Ghezzi&Jazayeri: OO Languages 1

COMS W3101 Programming Language: C++ (Fall 2016) Ramana Isukapalli

F I N A L E X A M I N A T I O N

cout<< \n Enter values for a and b... ; cin>>a>>b;

Midterm Exam 5 April 20, 2015

Advanced Systems Programming

I pledge by honor that I will not discuss this exam with anyone until my instructor reviews the exam in the class.

Module Contact: Dr Geoff McKeown, CMP Copyright of the University of East Anglia Version 1

Intro to OOP Visibility/protection levels and constructors Friend, convert constructor, destructor Operator overloading a<=b a.

AIMS Embedded Systems Programming MT 2017

Assignment 1: grid. Due November 20, 11:59 PM Introduction

Cpt S 122 Data Structures. Course Review Midterm Exam # 2

A506 / C201 Computer Programming II Placement Exam Sample Questions. For each of the following, choose the most appropriate answer (2pts each).

C++ Inheritance and Encapsulation

CSc 328, Spring 2004 Final Examination May 12, 2004

Shapes leading to CAD system project

CS250 Final Review Questions

The mechanism that allows us to extend the definition of a class without making any physical changes to the existing class is called inheritance.

Kapil Sehgal PGT Computer. Science Ankleshwar Gujarat

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

Transcription:

www.vustuff.com WWW.VUTUBE.EDU.PK CS304 Final Term Examination Spring 2006 Time Allowed: 150 Minutes Question No. 1 What is the name of the function that overloads 1. add the 2. complex add 3. + 4. operator + 5. operator + operator for the complexclass? Question No. 2 Marks : 3 Within a member function, the *this always refers to expression 1. the objects passes as an argument to the n 2. functio the address of an 3. object a temporary object created within the 4. function the object that called the 5. function the object that will be returned from the function Question No. 3 Marks : 3 Write two classes Customer and Account. Declare Account as a friend class of Customer. Private data memb i. cusname ii. cusaddress iii. cusbalance ers of Customer class are: Priv ate data of Account class are: i. members AccTitle ii. AccBalance a) Write parameterized constructors for both classes i. Customer and Account, to initialize their data e. members. For Customer class initialize cusbalance to zero.

b) Write a member function of Account class, named setbalance ( ) to assign AccBalance to cusbalance, which is a data member ofcustomer class. Write a member function for the Customer class, named displaytdata ( ) to display the values of C ustomer s cusname, cusaddress and cusbalance. Question No. 4 Gi ven below is a code snippet: Class You rclass { private: YourCl ass(); // other private met hods public: mbers // public me } void main() { Y ourclass *Yclass; Yclass = new YourClass[3]; } Do you see any problem with the code above? 1. The class name is invalid 2. The public members should be ided above the private members in the 3. prov The constructor is declared private class an array is being created in the function main, but the statement will result in an or therefore, 4. err The array creating syntax is incorrect 5. Return type of main () is not int Question No. 5 a) Write a C+ + program which creates a class Employee with the following attribute 1. name This class should have a parameterized and destructor, the getter/setter functions and virtual member function constructor called pay () that returns the salary of the Employee. a b) Create a class named as Salaried that inherits from class Employee. A Salaried object has the following attribute 1. salary This class should also have parameterized and a pay () member function. constructor and default destructor, setter/getter functions c) Similarly, develop a class named as Hourly that inherits from class Employee. An Hourly object is distinguished by the following attributes 1. hours 2. rate

This class should also have a parameterized, default, setter/getter functions a pay () member function. constructor destructor and Y our program should create objects Salaried and Hourly classes and then invoke the pay () function of of these classes polymorphicly (through Employee Object) Question No. 6 The co de for an inline function 1. is inserted into the ogram in the place of each of function 2. pr is not generated by the callcompiler tself, but by the 3. itakes extra memory processor 4. occurs only once in the 5. program is merely symbolic; it is not actually executed Question No. 7 Write a C++ program to determine area and perimeter of rectangleaccording to the lengthand width the entered by the user. Your code should include template <class T>. a Your rectangleclass has the following data member. 1: length 2: width T he area and perimetershould be calculated for each int, float and doubletype data member. Hence data member of the class should be of type Template as well. the rectangle Your program should have following member functions of a template <class T>. 1: area (); T his member function will calculate the area of the rectangle. The area of a rectangle can be calculated by the following formula: Area = length * width 2: perimeter (); T his member function will calculate the perimeter of the rectangle is rectangle where the formula for perimeter of Perimeter = 2 *(length + width) Area() and perimeter() member functions should return the same type on which the data is manipulating.for example If the area is calculating for a rectangle of int type length and width, then this member function should return an integer numberand vice versa. Take three instances of one of each type of data in main members (). int, float, and double for the class rectangle A lso write setterand getterfor the data member of theclass rectangle. Questio nno. 8 There i sa class Student, Which one of the following is a valid destructor for this class

1. Student(); 2. Student(int); 3. ~ Student(); 4. int~ Student(); 5. ~ Student(int); Question No. 9 Is there any difference between abstract and base class? If yes, then what is it? Question No. 10 Marks : 3 Question No. 11 Marks : 3 Question No. 12 0 Question No. 13 Question No. 14 Question No. 15 Question No. 16 Question No. 17 Question No. 18 0 Question No. 19

Question No. 20 Question No. 21 Question No. 22 Question No. 23 Question No. 24 Question No. 25 Marks : 3 Question No. 26 Question No. 27 Question No. 28 Question No. 29 Question No. 30 Question No. 31 Marks :1

Question No. 32