Sie sind auf Seite 1von 18

Model Question Paper Subject Code: MT0042 Subject Name: Object Oriented Programming Credits: 2 Part A (One mark

questions)
1. Procedure oriented Programs are called as A) Structured programming B) Object oriented programming C) Functional programming D) None of the above 2. A _____________ is a class whose instances themselves are classes. A) subclass B) abstarct class C) metaclass D) object class 3. _______________ enables you to hide, inside the object, both the data fields and the methods that act on that data. A) Encapsulation B) Polymorphism C) Inheritance D) Overloading

Book ID : B0012

Marks: 70

4. For a 16 bit word length Integer data type values lie between ________________ A) 32768 to 32767. B) 0 to 32767 C) -128 to 128 D) 0 to 128 5. The __________ operator is known as insertion operator A) >> B) > C) << D) < 6. Which of the following is NOT a Relational Operator A) == B) > C) % D) != 7. A __________ is an abstract idea that can be represented with data structures and functions. A) class B) object C) loop D) data type 8. Automatic Initialization of object is carried out using a special member function called ____________________ A) friend B) casting c) reference parameter

D) constructor. 9. A class can allow non-member functions and other classes to access its own private data, by making them as _________________. A) private B) protected C) Friend D) public 10. ____________________ is the process of creating new classes, called derived classes, from existing classes called base class

A) Inheritance B) encapsulation C) Polymorphism D) overloading 11. A ___________ class can share selected properties of its base classes, A) abstarct B) derived C) subclass D) both b & c 12. A _______________ is the address of a memory location and provides an indirect way of accessing data in memory. A) Constant B) variable C) Pointer D) object

13. To perform identical operations for each type of data compactly and conveniently we have to use A) Exception B) constant parameter C) function templates D) None of the above 14. _____________ function writes a string of text to a window. A) cputs ( ) B) put () C) gets () D) tputs () 15. In graphics mode the basic element is a __________ A) character B) text C) table D) pixel 16. The ________________ objects have values that can be tested for various error conditions.

A) osstream B) ofstream C) stream D) ifstream 17. Which function return the current position of the get or put pointer in bytes. A) tellg () B) tellp ()

C) tell () D) Both A and B 18. ________________ is a technique that allows the user considerable flexibility in the way the programs are used A) Redirection B) manipulation C) Detecting D) None of the above 19. Operator such as ______________ cannot be overloaded. a. + b. ++ c. :: d. == 20. In c++ ___________ Operator is used for Dynamic memory allocation a. Scope resolution b. Conditional c. New d. Membership access

Part B (Two mark questions)


21. The advantages of OOP are , 1. increased programming productivity 2. decreased maintenance costs. 3. less time to execute 4. easy to understand A) 1& 3 B) 1& 2 C) 3& 4 D) 2& 3 22. Find the Hierarchy Of Data Types 1. Long double 2. Double 3. Float 4. Long 5. Int 6. Char A) 1-2-3-4-5-6 B) 1-3-2-4-5-6 C) 1-2-3-5-4-6 D) 1-2-4-3-5-6

23. State True or False 1. A static member function cannot be declared virtual, whereas a non-static member functions can be declared as virtual 2. A static member function cannot have access to the 'this' pointer of the class. A) 1-T,2-F B)1-F,2-T C) 1-T,2-T D)1-F,2-F 24. State True or False 1. The this pointer is used as a pointer to the class object instance by the member function. 2. By using polymorphism, you cannot create new objects that perform the same functions as the base object A) 1-T,2-F B) 1-T,2-T C) 1-F,2-F D) 1-T,2-T 25. Which functions return the maximum pixels in each row (number of columns) and each column (number of rows) of the screen A) getmar() and getmac() B) maxx() and maxy() C) getmaxx() and getmaxy() D) getmayy() and getmaxy()

26. what does this program do # include <fstream.h> void main() { const int max = 80; char buffer[80];

ifstream infile ("out.txt"); while (infile) { infile.getline(buffer,max); cout << buffer; } } A) check a ACII charcter in a File. B) reads an String File. C) reads an Ascii String File. D) check a String File. 27. Find the output of the following program #include <iostream.h> Void main () { int age=15; if (age > 12 && age < 20)

cout<<You are a teen-aged person; else cout<<You are not teen-aged; } a. 15 b. You are a teen-aged person c. 20 d. You are not teen-aged 28. The first index number in an array starts with _________ and the last index number of an array of size n will be ______ a. 0 & n-1 b. 1 & n-1 c. 0 & n d. 1 & n 29. State True or False 1. Public data members can be accessed directly in the main function without an object. 2. Constructors can be overloaded. A. 1-F, 2-F B. 1-F, 2-T C. 1-T, 2-T D. 1-T, 2-F

30. To overload an operator _____________keyword must be used along with the operator to be overloaded.

A. Over B. Overload C. void D. Operator 31. Which one of the following declaration is invalid? A. int a[]; B. int a[]={19, 21, 16, 1, 50}; C. int a[5]={19, b, 16, c, 50}; D. int a[5];

Part C (Four mark questions)

32. Define the relationship

A. 1-is-a, 2. part-of 3.a-kind-of B. 1-is-a, 2.a-kind-of 3. Part-of C. 1 a-kind-of-2.is-a,3. Part-of D. None of the above 33. What is the output of the program # include <iostream.h>

void main() { int n=1; cout <<endl<<"The numbers are ;"<<endl; do { cout <<n<<"\t"; n++;

} while (n<=100); cout<<endl; } A) print natural numbers 0 to 99 B) print natural numbers 1 to 99 C) print natural numbers 0 to 100 D) print natural numbers 1 to 100 34. What is the output of the program # include <iostream.h> class counter { private : int count; public : counter() { count = 0; cout<<"New Object Created\n"; } void inc_count () { count++; } int getcount() { return count; } ~counter() { cout<<"One Object Deleted\n" ; }

}; void main() { counter c1,c2; } Output A) New Object Created New Object Created One Object Deleted B) New Object Created New Object Created C) New Object Created One Object Deleted D) New Object Created New Object Created One Object Deleted One Object Deleted 35. What is the output of the program class Window // Base class for C++ virtual function example { public: virtual void Create() { cout <<"Base class Window"<<endl; }

}; class CommandButton : public Window { public: void Create() { cout<<"Derived class Command Button "<<endl; } }; void main() { Window *x, *y; x = new Window(); x->Create(); y = new CommandButton(); y->Create(); }

A)

Base class Window

B)

Base class Window Derived class Command Button

C)

Derived class Command Button

D)

ERROR

36. What is the output of the program #include <iostream.h> template <class T, int N> class array { T memblock [N]; public: void setmember (int x, T value); T getmember (int x); }; template <class T, int N> array<T,N>::setmember (int x, T value) { memblock[x]=value; } template <class T, int N> T array<T,N>::getmember (int x) { return memblock[x]; } int main () { array <int,5> myints; array <float,5> myfloats; myints.setmember (0,100); myfloats.setmember (3,3.1416); cout << myints.getmember(0) << '\n'; cout << myfloats.getmember(3) << '\n';

return 0; } A) 100 3.1416 B) syntax error C) 100 D) No output 37. What is the use of the this program # include <fstream.h> void main() { ofstream tstfile ("out.dat");

char text[ ] = "This is a text line"; int i=0;

while (text[i]) tstfile. put(text[i++]); }

A) to create a file B) to print a text on monitor C) to read a file D) None of the above

38. In the below Declaration how many copies of x does DC inherits ? Class BC { Private: int x; }; Class BC1: virtual public BC { Private : Float y; }; Class BC2: virtual public BC { Private: float z; }; Class DC: public BC1, Public Bc2 { }; A. One B. Two C. Zero D. Syntax error

Answer Keys
Part - A Q. No. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Ans. Key A C A A C C A D C A D C C A D D B A C C Q. No. 21 22 23 24 25 26 27 28 29 30 31 Part - B Ans. Key B A C A C C B A B D C Q. No. 32 33 34 35 36 37 38 Part - C Ans. Key C D D B A A A

Das könnte Ihnen auch gefallen