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

Similar documents
Object-Oriented Design (OOD) and C++

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

C++ Programming: From Problem Analysis to Program Design, Fifth Edition. Chapter 12: Classes and Data Abstraction

Full file at Chapter 2 - Inheritance and Exception Handling

Object Oriented Design Final Exam (From 3:30 pm to 4:45 pm) Name:

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

KLiC C++ Programming. (KLiC Certificate in C++ Programming)

C++ 8. Constructors and Destructors

Object Oriented Programming. Solved MCQs - Part 2

Short Notes of CS201

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

CS201 - Introduction to Programming Glossary By

Object Oriented Design

Object Oriented Design

QUIZ. How could we disable the automatic creation of copyconstructors

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

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

Syllabus of C++ Software for Hands-on Learning: This course offers the following modules: Module 1: Getting Started with C++ Programming

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

Paytm Programming Sample paper: 1) A copy constructor is called. a. when an object is returned by value

CS201 Latest Solved MCQs

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

QUIZ. How could we disable the automatic creation of copyconstructors

Function Overloading

CS304 Object Oriented Programming Final Term

QUIZ How do we implement run-time constants and. compile-time constants inside classes?

Inheritance and Polymorphism

10. Abstract Data Types

Microsoft Visual Basic 2005: Reloaded

Module 10 Inheritance, Virtual Functions, and Polymorphism

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

Final exam. Final exam will be 12 problems, drop any 2. Cumulative up to and including week 14 (emphasis on weeks 9-14: classes & pointers)

FINAL TERM EXAMINATION SPRING 2010 CS304- OBJECT ORIENTED PROGRAMMING

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

C++ (classes) Hwansoo Han

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

Padasalai.Net s Model Question Paper

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

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

AN OVERVIEW OF C++ 1

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

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

Data Structures and Other Objects Using C++

Chapter 02 Building Multitier Programs with Classes

Object-Oriented Programming

Interview Questions of C++

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

Inheritance. OOP components. Another Example. Is a Vs Has a. Virtual Destructor rule. Virtual Functions 4/13/2017

Introduction to Programming session 24

Lecture 18 Tao Wang 1

C++ Inheritance and Encapsulation

Data Abstraction. Hwansoo Han

Abstraction in Software Development

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

The Foundation of C++: The C Subset An Overview of C p. 3 The Origins and History of C p. 4 C Is a Middle-Level Language p. 5 C Is a Structured


Chapter 5 Object-Oriented Programming

CS 6456 OBJCET ORIENTED PROGRAMMING IV SEMESTER/EEE

Lesson Plan. Subject: OBJECT ORIENTED PROGRAMMING USING C++ :15 weeks (From January, 2018 to April,2018)

IS0020 Program Design and Software Tools Summer, 2004 August 2, 2004 in Class

KOM3191 Object Oriented Programming Dr Muharrem Mercimek OPERATOR OVERLOADING. KOM3191 Object-Oriented Programming

Inheritance, and Polymorphism.

CS201- Introduction to Programming Current Quizzes

Get Unique study materials from

Absolute C++ Walter Savitch

Introduction to C++ Systems Programming

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

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.

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

Functions and Recursion

Object Oriented Programming with c++ Question Bank

COEN244: Class & function templates

SRM ARTS AND SCIENCE COLLEGE SRM NAGAR, KATTANKULATHUR

The Notion of a Class and Some Other Key Ideas (contd.) Questions:

Operator overloading

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

CSCI 123 Introduction to Programming Concepts in C++

C++ Inheritance and Encapsulation

Dynamic memory in class Ch 9, 11.4, 13.1 & Appendix F

Government Polytechnic, Muzaffarpur. Name of the Lab: OBJECT ORIENTED PROGRAMMING

Object Oriented Paradigm

Instantiation of Template class

CMSC 202 Final May 19, Name: UserID: (Circle your section) Section: 101 Tuesday 11: Thursday 11:30

Chapter 10 Introduction to Classes

Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson

Classes: A Deeper Look

Practice for Chapter 11

OBJ. ORI.& MULT. PROG., M.C.Q. BANK, FOR UNIT -2, SECOND YEAR COMP. ENGG. SEM-4, 2012 PATTERN, U.O.P. UNIT-2

JavaScript Functions, Objects and Array

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

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

CMSC 202 Section 010x Spring Justin Martineau, Tuesday 11:30am

C++ Important Questions with Answers

VALLIAMMAI ENGINEERING COLLEGE

Data Structures using OOP C++ Lecture 3

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

Polymorphism Part 1 1


Lecture 5: Inheritance

Come and join us at WebLyceum

Transcription:

Ch02 True/False Indicate whether the statement is true or false. 1. The base class inherits all its properties from the derived class. 2. Inheritance is an is-a relationship. 3. In single inheritance, the derived class is derived from a single base class. 4. A derived class inherits all its data members from the base class; it has none of its own. 5. In multiple inheritance, the derived class is derived from more than one base class. 6. Private members of a base class can be accessed by a derived class. 7. A derived class cannot directly access public members of a base class. 8. The derived class can redefine public member functions of a base class. 9. Overriding a member function is the same as redefining it. 10. Redefining a member function is the same as overloading the member function. 11. A class cannot have a constructor with default parameters. 12. A derived class cannot have a constructor with default parameters. 13. Header files of new classes contain commands that tell the computer where to look for definitions of the base class. 14. A derived class can directly access the protected members of a base class. 15. Composition is a has-a relationship. 16. In C++ the user can create new operators. 17. Default arguments can be used with an overloaded operator. 18. When overloading an operator, the meaning of how an operator works with built-in types remains the same. 19. In C++, every object of a class maintains a hidden pointer to itself, and the name of this pointer is hidden. 20. A friend function is a member function of a class but only has access to the class s public data members. 21. When writing the definition of a friend function, the name of the class and the scope resolution operator do not precede the name of the friend function in the function heading. 22. The function that overloads any of the operators (), [], ->, or = for a class must be declared as a member of the class. 23. For efficiency purposes, wherever possible, you should overload operators as nonmember functions. 24. By using templates, you can write a single code segment for a set of related functions. 25. Just as variables are parameters to functions, data types are parameters to templates. Multiple Choice Identify the choice that best completes the statement or answers the question.

26. Inheritance is an example of a(n) relationship. a. is-a c. friend of b. has-a d. member of 27. The new class that we create from the existing classes is called the. a. base class c. derived class b. modifier class d. extended class 28. In single inheritance, the derived class is derived from base class(es). a. one c. three or more b. two d. virtual 29. If there are three classes, shape, circle, and square, what is the most likely relationship among them? a. The square class is a base class, and shape and circle are derived classes of square. b. The shape class is a base class, and circle and square are derived classes of shape. c. The shape, circle, and square classes are all sibling classes. d. These three classes cannot be related. 30. If class dog has a derived class retriever, which of the following is true? a. In the case of single inheritance, dog can have no other derived classes. b. In the case of single inheritance, retriever is derived from no other class except dog. c. The relationship between these classes implies that dog is a retriever. d. The relationship between these classes implies that retriever has-a dog. 31. To redefine a public member function of a base class in the derived class, the corresponding function in the derived class must have. a. the same name, number, and types of parameters b. only the same name and types of parameters c. only the same name and number d. only the same number and types of parameters 32. We need to ensure that the private member variables that are inherited from the base class are initialized when a of the derived class executes. a. destructor c. copy constructor b. constructor d. friend function 33. The scope resolution operator is. a. : c. :: b. * d. ; 34. When you declare a derived class object, this object inherits the members of the base class, but the derived class object cannot directly access the. a. private data members of the base class b. data members in its own class c. base class constructors d. public data members of the base class 35. A(n) typically serves to initialize the member variables of a derived class. a. inheritor c. deconstructor b. initiator d. constructor 36. A call to the base class constructor is specified in the of a derived class constructor. a. body of the definition c. heading of the definition b. body of the constructor d. heading of the constructor 37. If a class contains the default constructor and no values are specified when the object is declared, the executes and initializes the object. a. default destructor c. last constructor in the program listing

b. first destructor in the program listing d. default constructor 38. To define new classes, you create new files. a. header c. prototype b. friend d. placeholder 39. The definitions of member functions can be placed in a separate file whose extension is. a..cxx c..cpp b..c d..cc 40. To include a system-provided header file, such as iostream, in a user program, you enclose the header file between. a. curly brackets c. asterisks b. angular brackets d. square brackets 41. To include a header file in a program, you use the preprocessor command. a. pragma c. pull b. fetch d. include 42. For a base class to give access to a member to its derived class and still prevent its direct access outside the class, you must declare that member under the member access specifier. a. private c. public b. protected d. shared 43. In, one or more members of a class are objects of another class type. a. inheritance c. composition b. redefinition d. encapsulation 44. Composition is a(n) relationship. a. is a c. was a b. has a d. had a 45. The arguments to the constructor of a member object are specified in the part of the definition of the constructor of the class. a. body c. scope b. pragma d. heading 46. The ability to combine data and operations is called. a. inheritance c. redefinition b. encapsulation d. composition 47. By using templates, you can write a single code segment for a set of related functions, called a. a. function template c. class set b. function type d. class template 48. Like function templates, are used to write a single code segment for a set of related classes. a. function types c. inherited classes b. class templates d. protected members 49. Class templates are called types. a. abstract c. template b. general d. parameterized 50. Passing parameters to a function has an effect at time. a. compile c. run b. link d. build

Ch02 Answer Section TRUE/FALSE 1. ANS: F PTS: 1 REF: 60 2. ANS: T PTS: 1 REF: 60 3. ANS: T PTS: 1 REF: 60-61 4. ANS: F PTS: 1 REF: 60 62 5. ANS: T PTS: 1 REF: 61 6. ANS: F PTS: 1 REF: 62 7. ANS: F PTS: 1 REF: 62 8. ANS: T PTS: 1 REF: 62 9. ANS: T PTS: 1 REF: 63 10. ANS: F PTS: 1 REF: 63 11. ANS: F PTS: 1 REF: 71 12. ANS: F PTS: 1 REF: 71 13. ANS: T PTS: 1 REF: 75 14. ANS: T PTS: 1 REF: 78 15. ANS: T PTS: 1 REF: 79 16. ANS: F PTS: 1 REF: 86 17. ANS: F PTS: 1 REF: 87 18. ANS: T PTS: 1 REF: 87 19. ANS: F PTS: 1 REF: 87 20. ANS: F PTS: 1 REF: 91 21. ANS: T PTS: 1 REF: 91 22. ANS: T PTS: 1 REF: 94 23. ANS: F PTS: 1 REF: 102 24. ANS: T PTS: 1 REF: 108 25. ANS: T PTS: 1 REF: 109 MULTIPLE CHOICE 26. ANS: A PTS: 1 REF: 60 27. ANS: C PTS: 1 REF: 60 28. ANS: A PTS: 1 REF: 60-61 29. ANS: B PTS: 1 REF: 61 30. ANS: B PTS: 1 REF: 61 31. ANS: A PTS: 1 REF: 63 32. ANS: B PTS: 1 REF: 63 33. ANS: C PTS: 1 REF: 67 34. ANS: A PTS: 1 REF: 69 35. ANS: D PTS: 1 REF: 69 36. ANS: C PTS: 1 REF: 70 37. ANS: D PTS: 1 REF: 70 38. ANS: A PTS: 1 REF: 75

39. ANS: C PTS: 1 REF: 76 40. ANS: B PTS: 1 REF: 76 41. ANS: D PTS: 1 REF: 76 42. ANS: B PTS: 1 REF: 78 43. ANS: C PTS: 1 REF: 79 44. ANS: B PTS: 1 REF: 79 45. ANS: D PTS: 1 REF: 83 46. ANS: B PTS: 1 REF: 84 47. ANS: A PTS: 1 REF: 108 48. ANS: B PTS: 1 REF: 111 49. ANS: D PTS: 1 REF: 111 50. ANS: C PTS: 1 REF: 112