Sie sind auf Seite 1von 17

Chapter I: Principles of Object-Oriented Programming 1. d) None of the above 2. c) Procedure-oriented programming 3.

c) Does not reflect real world problems 4. d) None 5. c) Polymorphism 6. a) Inheritance 7. b) Inheritance 8. a) Both i and ii 9. a) i only 10. d) iv only

Chapter II: Beginning With C++ 1. d) iv only 2. c) Both ii and iv 3. a) // 4. b) output operator 5. c) <stdlib.h> 6. c) No output 7. d) Both a and c 8. c) Missing = sign between str_name and a

9. b) <iostream.h> 10. a) Client-server model

Chapter III: Tokens, Expressions and Control Structures 1. a) 2. d) 3. c) 4. a) 5. a) 6. c) 7. b) 8. d) 9. d) 10. b) 11. d) 12. c) 13. c) 14. b) 15. a) 16. a) Keyword ii, iii and iv ii, iii, and iv array X=sqrt(a+b) *(c/d); function header line outside the function No error All of the above :: iv only Both a and b Chained assignment Type conversions branching C++ statement

Chapter IV: Functions in C++ 1. c) 2. d) 3. c) 4. b) 5. a) 6. c) 7. b) 8. b) 9. c) 10. c) A function may be called whenever it is necessary All of the above Semicolon is not found void sample_calc(double, double); Call by reference Both I and IV X=sub1(5,6.5); p,n, and q Both b and c inline function

Chapter V: Classes and Objects 1. d) 2. a) 3. c) 4. b) 5. d) 6. b) Both a and b private Encapsulation {num=a;} None of the above Data members x and y, Constructor, and member functions calc() and output_calc() 7. c) 8. c) 9. d) 10. c) It can be initialized whenever necessary class-name :: function-name; All of the above I, II, III and IV

Chapter VI: Constructors and Destructors 1. c) 2. a) 3. b) 4. a) 5. a) 6. c) 7. b) 8. d) 9. a) 10. a) They cannot be called more than once in a program A :: A() I, II, and IV xyz(){ } simple s(welcome); Line 5 cannot include void All are correct All of the above Both I and II sample :: ~sample() {cout << Welcome; }

Chapter VII: Operator Overloading and Type Conversions 1. d) 2. b) 3. d) 4. a) 5. b) 6. d) 7. c) 8. b) 9. a) 10. d) All of the above compile-time polymorphism All of the above operator function void sample : : operator-() { } None of the above II, III and IV Binary arithmetic operators (+,-,*,/) need not return a value sample :: operator double() { } All of the above

Chapter VIII: Inheritance: Extending Classes 1. c) Reusability 2. a) public and protected class members 3. a) I only 4. d) None of the above 5. c) get_a(), void put_a() 6. c) When a class is inherited in public mode, the private members of the base class cannot be inherited 7. d) All of the above 8. d) All of the above 9. b) Class A is the parent class of both the classes B and C, which do not have any relationship between them 10. b) Multilevel Inheritance 11. b) Virtual base class 12. a) Containership

Chapter IX: Pointers, Virtual Functions and Polymorphism 1. a) 2. d) A pointer is a data type The value of the variable that the pointer ptr is pointing to is assigned to the

variable p 3. d) 4. c) 5. b) 6. a) 7. d) 8. a) 9. a) 10. b) 11. c) All of the above run time polymorphism III only <hexadecimal address> 0 Compiler error this->x=5; virtual void X_output(float ); This is from class B A virtual function, which is not equated to zero is called a pure virtual function

Chapter X: Managing Console I/O Operations 1. d) 2. b) 3. a) 4. c) 5. d) 6. b) 7. b) 8. a) 9. c) 10. d) None of the above ostream cin.getline(book,20); Managing Consol All of the above unsetf() 846.21 width() I/O Operations$$$$$$ Both a and b

Chapter XI: Working with Files 1. b) 2. c) 3. a) 4. c) 5. c) 6. b) 7. c) 8. b) 9. d) 10. b) fstreambase fstream ofstream out_strobj(sample); ofstream_object.open(sample, ios::out); Line 3 Working n 20 Both a and b file_obj.read((char *) & aval, sizeof (aval));

Chapter XII: Templates 1. b) 2. d) 3. a) 4. a) 5. c) generic programming None of the above sample <char> characterArray; template <class temp1, class temp2> Declares a sample() function template that receives a value of given data type and returns no value 6. d) 7. a) 8. a) 9. d) 10. c) None of the above Line1 0 All of the above Both II and IV

Chapter XIII: Exception Handling 1. c) 2. b) 3. c) 4. b) 5. c) 6. d) 7. c) 8. a) 9. a) Syntax error Catch block Both I and III Normal Execution is completed Abort() function is invoked Both I and IV throw; Caught Divide by zero error inside main type function(arg-list) throw(type-list) { ........ ........ Function body ........ } 10. b) Abrupt program termination

Chapter XIV: Introduction to the Standard Template Library 1. c) 2. b) 3. d) 4. a) 5. a) 6. d) 7. c) 8. d) 9. b) 10. d) array 24 20 38 24 I-B, II-C, III-D, IV-A 25 3 The functioning of Iterators is similar to pointers Line 9 Inserts a list into the invoking list Both I and IV (*i).first, (*i).second None of the above

Chapter XV: Manipulating Strings 1. b) 2. b) 3. a) 4. c) 5. d) 6. c) 7. a) 8. d) 9. a) 10. c) class getline( ) count( ) ex2468e Equal , Not Equal swap( ) at( ) 9 9 17 0 26

Both I and III +=

Chapter XVI: New Features of ANSI C++ Standard 1. d) 2. b) 3. a) 4. c) 5. a) 6. d) 7. c) 8. c) 9. d) 10. b) Both a and b 51 wide_character 2literal reinterpret_cast b Either a or b mutable namespace namespace_name{.} Both I and II (a not_eq b) > (compl( a bitand b) and_eq (a xor b))

Chapter XVII: Object-Oriented Systems Development 1. a) 2. b) 3. d) 4. c) 5. c) 6. b) 7. a) 8. c) 9. b) 10. c) Fountain model Water-fall model All of the above Both a and b Either a or b Inheritance relationship Use relationship Both a and b It is the process of time consuming and expensive Both a and b

Das könnte Ihnen auch gefallen