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

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

What is Polymorphism? Quotes from Deitel & Deitel s. Why polymorphism? How? How? Polymorphism Part 1

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

Polymorphism Part 1 1

Lecture 5: Inheritance

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

Data Structures and Other Objects Using C++

Object Oriented Programming. Solved MCQs - Part 2

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

Midterm Review. PIC 10B Spring 2018

CS 6456 OBJCET ORIENTED PROGRAMMING IV SEMESTER/EEE

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

Introduction to Programming Using Java (98-388)

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

Inheritance, and Polymorphism.

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

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

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

CS201 Latest Solved MCQs

Passing arguments to functions by. const member functions const arguments to a function. Function overloading and overriding Templates

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

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

CPSC 427: Object-Oriented Programming

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

VALLIAMMAI ENGINEERING COLLEGE

Object Oriented Programming with c++ Question Bank

CSCI 102L - Data Structures Midterm Exam #1 Fall 2011

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

Object-Oriented Programming (OOP) Fundamental Principles of OOP

FINAL TERM EXAMINATION SPRING 2010 CS304- OBJECT ORIENTED PROGRAMMING

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

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

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

UNIVERSITI TEKNIKAL MALAYSIA MELAKA FACULTY INFORMATION TECHNOLOGY AND COMMUNICATION (FTMK) BITE 1513 GAME PROGRAMMING I.

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)

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

CS201- Introduction to Programming Current Quizzes

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

C++ 8. Constructors and Destructors

CS32 - Week 4. Umut Oztok. Jul 15, Umut Oztok CS32 - Week 4

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

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

Absolute C++ Walter Savitch

Object Oriented Programming CS250

CS250 Final Review Questions

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:

VIRTUAL FUNCTIONS Chapter 10

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

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

SRM ARTS AND SCIENCE COLLEGE SRM NAGAR, KATTANKULATHUR

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

Lecture 18 Tao Wang 1

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

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

Short Notes of CS201

IS 0020 Program Design and Software Tools

What does it mean by information hiding? What are the advantages of it? {5 Marks}

CS250 Final Review Questions

CS201 - Introduction to Programming Glossary By

C++ Important Questions with Answers

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

Polymorphism. Zimmer CSCI 330

Chapter 15: Inheritance, Polymorphism, and Virtual Functions

Welcome to Teach Yourself Acknowledgments Fundamental C++ Programming p. 2 An Introduction to C++ p. 4 A Brief History of C++ p.

CS105 C++ Lecture 7. More on Classes, Inheritance

COEN244: Class & function templates

Object-Oriented Concept

W3101: Programming Languages C++ Ramana Isukapalli

Modern C++ for Computer Vision and Image Processing. Igor Bogoslavskyi

Programming, numerics and optimization

C++ Crash Kurs. Polymorphism. Dr. Dennis Pfisterer Institut für Telematik, Universität zu Lübeck

Inheritance and Polymorphism

CGS 2405 Advanced Programming with C++ Course Justification

CS250 Final Review Questions

Object-Oriented Programming

Tokens, Expressions and Control Structures

AN OVERVIEW OF C++ 1

CS-202 Introduction to Object Oriented Programming

24. Inheritance. Java. Fall 2009 Instructor: Dr. Masoud Yaghini

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

C++ Inheritance and Encapsulation

Come and join us at WebLyceum

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

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

10CS36: Object Oriented Programming with C++

Why use inheritance? The most important slide of the lecture. Programming in C++ Reasons for Inheritance (revision) Inheritance in C++

This examination has 11 pages. Check that you have a complete paper.

Extending Classes (contd.) (Chapter 15) Questions:

(12-1) OOP: Polymorphism in C++ D & D Chapter 12. Instructor - Andrew S. O Fallon CptS 122 (April 3, 2019) Washington State University

22. Inheritance. Java. Summer 2008 Instructor: Dr. Masoud Yaghini

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

C++ TEMPLATES. Templates are the foundation of generic programming, which involves writing code in a way that is independent of any particular type.

STRUCTURING OF PROGRAM

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

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

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

Object-Oriented Design (OOD) and C++

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

CS11 Introduction to C++ Fall Lecture 7

Object-Oriented Principles and Practice / C++

Transcription:

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

True or False Pointers to a base class may be assigned the address of a derived class object. In C++ polymorphism is very difficult to achieve unless you also use inheritance. You can create a non-member function with one parameter that overloads the relational equal to (==) operator. The standard template library (STL) vector and list classes are examples of sequential containers. Nodes in a linked list are stored in contiguous memory.

True or False C++ enables you to use the friend keyword to declare friend functions and friend classes for a class so these functions and classes can access the class s private members. If a function is declared as returntype functionname(parameterlist) throw (type), this function can only throw the exception of the specified type. A template class allows the class to be used with different data types. If an exception is not caught, it is stored for later use. The following code declares a vector of characters. vector characters<char>;

True or False Destructors are not inherited into the derived class. The assignment operator is inherited from the base class. If a function throws an exception, it must be caught inside that function. In a try block, the throw statement is always executed. The catch block is the group of statements that handle an exception.

To add an int value 5 to a vector v of integers, use. A. v.append(5); B. v.insert(5); C. v.add(5); D. v.push_back(5);

Who can access private data in a class? A. classes derived from the class B. friends of the class C. everyone D. A and B E. no one

Which of the following statements are true? A. A custom exception class must always be derived from class exception. B. A custom exception class must always be derived from a derived class of class exception. C. A custom exception class is just like a regular class in C++. D. A custom exception class must always be derived from class runtime_error.

Which of the following is a pure virtual function? A. virtual double getarea(); B. double getarea() = 0; C. virtual double getarea() = 0; D. virtual double getarea() { };

Suppose Circle and Rectangle classes are derived from GeometricObject and you declared void displaygeometricobject(geometricobject shape) { cout << shape.tostring() << endl; } Which of the following function call is incorrect? A. displaygeometricobject(rectangle(2, 3)); B. displaygeometricobject(geometricobject("black", true)); C. displaygeometricobject(string()); D. displaygeometricobject(circle(5));

Which is the correct way to tell the compiler that the class being declared (ChildClass) is derived from the base class (BaseClass)? A. class ChildClass::public BaseClass B. class ChildClass:public BaseClass C. class ChildClass childof public BaseClass D. class ChildClass derived BaseClass

Give a base class with at least one public member function, how many child classes can redefine that member function? A. 1 B. 0 C. all of them D. none of the above

If the member variables in the base class are listed as protected, then who can access or modify those variables? A. members of the base class B. members of the derived class C. outside the base or derived classes D. A and B E. All of the above

If a base class has public member functions that are not listed by a derived class, then these functions A. are not available to the derived class B. are inherited unchanged in the derived class C. are private to the derived class D. do not exist in the derived class

If you have a copy constructor in the base class, but do not have a copy constructor for the derived class, then A. you will have a syntax error B. a copy constructor for the derived class is automatically created for you C. you cannot use pointer variables D. the default constructor is used

Given a class A that derives from a class B that derives from a class C, when an object of class A goes out of scope, in which order are the destructors called? A. C, B, then A B. A, B, then C C. unable to determine D. depends on how the code is written for the destructors

If the Pet class had a non-virtual member function named print, and a pointer variable of that class is pointing to a Dog object, then the code pptr- >print( ); calls A. the base class print function B. the derived print function C. both the derived and base print functions D. it causes a run-time error

Polymorphism refers to A. the ability to change the behavior of a function at runtime. B. overriding base class functions. C. overloading functions D. none of the above

In order to tell the compiler to wait to decide which version of a function to use, you must precede the function declaration in the base class with the keyword A. operator B. friend C. virtual

Which of the following operations do forward iterators have? A. Overloaded operator+ to add an int value to the iterator to move the place the iterator points forward by the argument number of elements. B. Overloaded operator* to multiply the iterator by an int value to move the place the iterator points by a number of elements equal to the argument. C. Overloaded operator++ to move the place the iterator points forward by one element. D. Overloaded operator-- to move the place the iterator points backward by one element.