Object Oriented Programming. Solved MCQs - Part 2

Similar documents
STRUCTURING OF PROGRAM

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

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

C++ Important Questions with Answers

Introduction to Programming Using Java (98-388)

Object Oriented Programming with c++ Question Bank

Short Notes of CS201

SRM ARTS AND SCIENCE COLLEGE SRM NAGAR, KATTANKULATHUR

CS201 - Introduction to Programming Glossary By

Interview Questions of C++

CS201- Introduction to Programming Current Quizzes


CHAPTER 1 Introduction to Computers and Programming CHAPTER 2 Introduction to C++ ( Hexadecimal 0xF4 and Octal literals 031) cout Object

AN OVERVIEW OF C++ 1

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

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

I BSc(IT) [ Batch] Semester II Core: Object Oriented Programming With C plus plus - 212A Multiple Choice Questions.

CS 6456 OBJCET ORIENTED PROGRAMMING IV SEMESTER/EEE

VALLIAMMAI ENGINEERING COLLEGE

PROGRAMMING IN C++ COURSE CONTENT

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

Instantiation of Template class

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

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

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

Object Oriented Paradigm

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

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

INHERITANCE: EXTENDING CLASSES

CS304 Object Oriented Programming Final Term

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

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

C++ Inheritance and Encapsulation

Absolute C++ Walter Savitch

VIRTUAL FUNCTIONS Chapter 10

SRI SARASWATHI MATRIC HR SEC SCHOOL PANAPAKKAM +2 IMPORTANT 2 MARK AND 5 MARK QUESTIONS COMPUTER SCIENCE VOLUME I 2 MARKS

END TERM EXAMINATION

Fast Introduction to Object Oriented Programming and C++

Polymorphism. Zimmer CSCI 330

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

Introduction to C++ Introduction. Structure of a C++ Program. Structure of a C++ Program. C++ widely-used general-purpose programming language

Object Oriented Programming in Java. Jaanus Pöial, PhD Tallinn, Estonia

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

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

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING OBJECT ORIENTED PROGRAMMING CLASS : THIRD SEMESTER CSE

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

STUDY NOTES UNIT 1 - INTRODUCTION TO OBJECT ORIENTED PROGRAMMING

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

Introduction to C++ with content from

1. Describe History of C++? 2. What is Dev. C++? 3. Why Use Dev. C++ instead of C++ DOS IDE?

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

Padasalai.Net s Model Question Paper

OOPs Concepts. 1. Data Hiding 2. Encapsulation 3. Abstraction 4. Is-A Relationship 5. Method Signature 6. Polymorphism 7. Constructors 8.

CS201 Some Important Definitions

An Object Oriented Programming with C

CLASSES AND OBJECTS IN JAVA

XII- COMPUTER SCIENCE VOL-II MODEL TEST I

What are the characteristics of Object Oriented programming language?

Preface to the Second Edition Preface to the First Edition Brief Contents Introduction to C++ p. 1 A Review of Structures p.

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

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

OOP THROUGH C++(R16) int *x; float *f; char *c;

Get Unique study materials from

CS201 Latest Solved MCQs

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

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

C++ 8. Constructors and Destructors


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

CS250 Final Review Questions

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

Data Abstraction. Hwansoo Han

CGS 2405 Advanced Programming with C++ Course Justification

Object-Oriented Programming (OOP) Fundamental Principles of OOP

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

B.C.A 2017 OBJECT ORIENTED PROGRAMMING USING C++ BCA303T MODULE SPECIFICATION SHEET

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

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

C++ Inheritance and Encapsulation

Object oriented programming. Encapsulation. Polymorphism. Inheritance OOP

POLYMORPHISM 2 PART Abstract Classes Static and Dynamic Casting Common Programming Errors

POLYMORPHISM 2 PART. Shared Interface. Discussions. Abstract Base Classes. Abstract Base Classes and Pure Virtual Methods EXAMPLE

Sahaj Computer Solutions OOPS WITH C++

Computer Science (330)

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

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

CSE 303: Concepts and Tools for Software Development

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

C++ Programming: Polymorphism

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

CS304 Object Oriented Programming

VALLIAMMAI ENGNIEERING COLLEGE SRM Nagar, Kattankulathur DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK

Increases Program Structure which results in greater reliability. Polymorphism

CS3157: Advanced Programming. Outline

CS250 Final Review Questions

Chapter 6 Introduction to Defining Classes

Object-Oriented Programming

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

Java Object Oriented Design. CSC207 Fall 2014

CSE 307: Principles of Programming Languages

Transcription:

Object Oriented Programming Solved MCQs - Part 2

Object Oriented Programming Solved MCQs - Part 2 It is possible to declare as a friend A member function A global function A class All of the above What will be the result of the expression 13 & 25? 38 25 9 12 A function call mechanism that passes arguments to a function by passing a copy of the values of the arguments is Call by name Call by value Call by reference Call by value result The members of a class, by default, are Public Protected Private Mandatory to specify

Which of the following is a string literal constant? Visual C++ 137.45 A All of the above Which of the following statements is NOT valid about operator overloading? Only existing operators can be overloaded Overloaded operator must have at least one operand of its class type The overloaded operators follow the syntax rules of the original operator None of the above What is the output of the following code char symbol[3]={ a, b, c }; for (int index=0; index<3; index++) cout << symbol [index]; a b c abc abc abc Which of the statements is true in a protected derivation of a derived class from a base class? Private members of the base class become protected members of the derived class Protected members of the base class become public members of the derived class Public members of the base class become protected members of the derived class Protected derivation does not affect private and protected members of the derived class

In which case is it mandatory to provide a destructor in a class? Almost in every class Class for which two or more than two objects will be created Class for which copy constructor is defined Class whose objects will be created dynamically The concept of hierarchical classification is related to Abstraction Inheritance Function overloading None Assume that we have constructor function for both Base and Derived classes. Now consider the declaration : main ( ) Base *p = new Derived; In what sequence, the constructor will be executed? Derived class constructor is followed by Base class constructor. Base class constructor is followed by Derived class constructor. Base class constructor is never called. Derived class constructor is never called. If you wanted to sort many large objects or structures, it would be most efficient to Place them in an array and sort the array. Place pointers to them in an array and sort the array. Place them in a linked list and sort the linked list. Place references to them in an array and sort the array.

cfront is the front end of a C compiler is the per-process of a C compiler is a tool that is translated a C++ code to its equivalent C code None of above Usually a pure virtual function Has complete function body Will never be called Will be called only to delete an object Is defined only in derived class A static data member is given a value Within the class definition Outside the class definition When the program is exeuted Never C++ was originally developed by Clocksin and Melish Donald E.Knuth Sir Richard Hadlee Bjarne Stroustrup What is the error in the following code? class t { virtual void print(); } No error

Function print() should be declared as static. Function print() should be defined. Class t should contain data members. If a class C is derived from class B, which is derived from class A, all through public inheritance, then a class C member function can access Protected and public data only in C and B Protected and public data only in C Private data in A and B Protected data in A and B A friend function has access to all private and protected members of the class for which it is a friend Only private Private and protected Only protected None of the above Which of the following cannot be legitimately passed to a function A constant A variable A structure A header file Match the following : (a) Garbage collection in 1. Java (b) Nameless object 2. generic programming (c) Template support 3. defines a class (d) A forward reference 4. member function (e) Derived class inherits from base class

1 5 4 2 3 1 5 2 3 4 5 1 2 3 4 5 4 3 1 2 The polymorphism can be characterized by the phrase One interface,multiple methods Multiple interfaces,one method One interface,one method None of the above A class defined within another class is Nested class Inheritance Containership Encapsulation In multiple inheritance The base classes must have only default constructors Cannot have virtual functions Cannot have virtual classes None of the above Which of the statements are true? I. Function overloading is done at compile time. II. Protected members are accessible to the member of derived class. III. A derived class inherits constructors and destructors. IV. A friend function can be called like a normal function. V. Nested class is a derived class. I, II, III II, III, V

III, IV, V I, II, IV In C++, dynamic memory allocation is accomplished with the operator new this malloc( ) delete Use of virtual functions implies Overloading Overriding Static binding Dynamic binding Which of the following type casts will convert an Integer variable named amount to a Double type? (double) amount (int to double) amount int to double(amount) int (amount) to double The members of a class by default are Public Protected Private Mandatory to specify What will be the output of following program?

#include<iostream.h> void main() { float x; x=(float)9/2; cout<<x; } 4.5 4.0 4 5 Which feature in OOP allows reusing code? Polymorphism Inheritance Encapsulation Data hiding Exception handling is targeted at Run-time error Compile time error Logical error All of the above Overloading a postfix increment operator by means of a member function takes No argument One argument Two arguments Three arguments

Which of the following, if any, are valid names for variables? class friend void None of the above is valid names for variables What does C++ append to the end of a string literal constant? a space a number sign (#) an asterisk (*) a null character A template class Is designed to be stored in different containers Works with different data types Generates objects which must be identical Generates classes with different numbers of member functions A struct is the same as a class except that There are no member functions All members are public Cannot be used in inheritance hierarchy It does have a this pointer An array element is accessed using a first-in-first-out approach the dot operator a member name an index number

Which of the following is not the characteristic of constructor? They should be declared in the public section. They do not have return type. They can not be inherited. They can be virtual. An exception is caused by A hardware problem A problem in the operating system A syntax error A run-time error To access the public function fbase() in the base class, a statement in a derived class function fder() uses the statement.fbase(); fbase(); fder(); base::fbase(); der::fder(); RunTime Polymorphism is achieved by Friend function Virtual function Operator overloading Function overloading Runtime polymorphism is achieved by Friend function Virtual function

Operator overloading Function overloading Pure virtual functions Have to be redefined in the inherited class Cannot have public access specification Are mandatory for a virtual class None of the above If x =5, y =2 then x ^y equals. (where ^ is a bitwise XOR operator) 00000111 10000010 10100000 11001000 Identify the operator that is NOT used with pointers -> & * >> A friend function to a class, C cannot access Private data members and member functions Public data members and member functions Protected data members and member functions The data members of the derived class of C A variable defined within a block is visible

From the point of definition onward in the program From the point of definition onward in the function From the point of definition onward in the block Throughout the function The function whose prototype is void getdata(item *thing); receives a pointer to a structure a reference to a structure a copy of a structure nothing The keyword friend does not appear in The class allowing access to another class The class desiring access to another class The private section of a class The public section of a class