OOPS
OOPS
OOPS
1. The default access for members of a class is ____ A) Public B) Private C) Global D) Protected 2. Which of the following do you think is used to separate the base classes in a base class list? A) Comma (,) B) Colon (:) C) Semi-colon (;) D) Tilde (~) 3. If a data item in a class is defined as ____, then only one such item is created for the entire class, no matter how many objects there are A) Public B) Private C) Protected D) Static 4. ____ is a self contained unit or module of data and code A) Object B) Class C) Function D) Member 5. ____ decribes the data and its behaviour or functionality A) Object B) Function C) Class D) Member 6. What is used to convert a class type to Basic type? A) Constructor in source B) Constructor destination C) Conversion function in destination D) Conversion function in source
A) template<T class> B) template<class T> C) template class <T> D) template T<class> 8. Which operator obtains memory from the operating system and returns a pointer to its strating point? A) alloc B) malloc C) get D) new 9. Which files are created by storing a block of memory? A) ASCIL B) Text C) Binary D) Sequential 10. What is the use of the following statement? Seekg (-5,ios::end); A) moves the get pointer from the end of the file B) moves the get pointer 5 the beginning of the file C) moves the put pointer from the end of the file D) moves the put pointer 5 the beginning of the file 5 bytes backward bytes forward from 5 bytes backward bytes forward from
11. The command line parameters used by a C++ program is A) argc B) argv C) Both A) and B) D) Neither A) nor B) 12. Virtual functions which are declared with the keyword virtual in the ____ class A) Derived B) Base C) Destination D) Source
is
used
to
declare
13. Separate code to handle the error is written in which section? [email protected] Page 1 of 16
Helpdesk: 66710528
KARROX COLLEGE OF TECHNOLOGY & MANAGEMENT C) the member name D) an index number 21. Object oriented programming by A) Software development technique B) Set of operations C) Set of instructions D) Set of blocks 22. The first operation to be done after scanning source file is A) Run Linking B) Run compiling B) Run Run D) None of these 23. The short cut keys used to run the C++ program is A) CTRL + F8 B) CTRL + F9 B) CTRL + F5 D) ALT + F5 24. Out of the following choose the correct statement. A) String constant can be split B) # include <headerfile> are written in multiple line C) / / is used to indicate white spaces D) Escape sequences are denoted by\operator 25. The max permissible characters in a variable name is A) 16 B) 32 C) 64 D) None of these 26. _____occupies 4 bytes storage space A) Int B) Long int C) Unsigned Int D) Float
14. ____ members can be accessed members and objects of the class A) Public B) Protected C) Private D) Static
15. ____ function appears to perform different activities depending on the kind of data to be sent to it. A) Virtual B) Static C) Overloaded D) None of the above 16. An abstract class is useful when A) no objects should be instantiated from it B) no classes should be derived from it C) there are multiple paths from one derived class to another D) You want to defer the declaration of the class 17. To write data that contains variables of type float to an object of type of stream, you should use A) the insertion operator B) seekg () C) write () D) Put () 18. The && and // operators A) compares two numeric values B) combines two numeric values C) compares two Boolean values D) combines two Boolean values 19. Which of the following is used to identify the copy constructor? A) (X&) B) X(&X) C) X(X&) D) X(X) 20. An array element is accessed using A) a first-in first-out approach B) the dot operator www.karrox.com Helpdesk: 66710528
27. Array is collection of A) Declared data B) Un declared data C) Homogeneous data [email protected] Page 2 of 16
KARROX COLLEGE OF TECHNOLOGY & MANAGEMENT C) Indicate the base class name in the calling statement D) You can not derive such functions. 34. The user define header file can be included A) Any where in the program code B) Before use of functions in the program code C) In the first few line of program code D) As first few line before main function of program code 35. The highest address for 640k memory is
A) Does not allow to redefine member functions B) Can not add new member functions C) Allow to use all member function of base class D) Not supported in c++ 29. The function not use to concatenation of two strings is A) strcpy B) strcat C) + D) get() 30. Out of following choose the correct one
A) 65535 B) 131040 C) 125535 D) None of these 36. The most common bug with pointer is
A) Public items are not accessible from own class B) Protected items are accessible from objects out side the class C) Private items are accessible from derived class D) Protected items are accessible from derived class 31. class used to derive other class are A) Base class B) Derived class C) Abstract class D) Inherit class 32. The syntax for multiple inheritance is A) de name (): be name1()+be name2() {} B) de name1 ()+dename2(): be name1()+be name2(){} C) de name () : be name1 () be name2 () {} D) de name1 (),de anme2(): be name1(), bename2() {}
A) Invalid address in pointer address B) Encoding pointer within other loop C) Pointer pointing to the object D) In the sorting operation 37. ____ function writes string of text to the window A) cputs () B) putch C) window cputs () D) window putch () 38. The first graphic library function to be executed is A) detectgraph () B) initgraph () C) window () D) None of these 39. ____ function sets the fill pattern and color A) floodfill () B) setcolor () C) setfillstyle () D) fillstyle ()
33. In multiple inheritance, when both base class have function with same name A) You can not call the function B) You have to call the function indicating the derived class in the statement www.karrox.com Helpdesk: 66710528
40. The base class for stream class is A) ios B) istream C) ostream D) None of these [email protected] Page 3 of 16
OOPS KARROX COLLEGE OF TECHNOLOGY & MANAGEMENT 41. Function is used to draw a circle in graphics 48. What is the output of the following mode expression when executed? int y--5; int x = y > = 2 ? y < 10 ? I : 0 1 cout < < X ; A) arc ( ... ) B) circle ( ... ) A) 10 C) ellipse ( ... ) B) I D) None of these C) 0 D) = - I 42. Can be viewed as a "fill in the blanks" version of a class 49. Items declared as _ are private within a class and are available for access in the derived A) Template class to. B) Meta class C) Friend class A) private D) None of these B) public C) protected 43. Name the function that is used to clear the D) None of the above screen and position the cursor at 0, 0 in the graphics mode 50. ____ is a data type, which is used to define a heterogeneous set of data types or a set of A) clearscreen data items belonging to different data types B) clrscr ( ) C) cleardevice A) void D) None of these B) char C) structure 44. Is to used to change a sentence str into D) array upper case A) toUpperCase (str) 51. ____ is used in C++ to create a symbolic B) strupr (str) constant C) stmcat (str) D) All of these A) const keyword B) # define directive 45. To handle exceptions, the keyword to b e C) typedef keyword used is D) None of these A) throw B) catch C) DETECT D)None of these 46. Dynamic memory can be deallocated using A) destructor function B) delete keyword C) a heap D) None of these 52. Which of these is not a feature of C++? A) Multiple Inheritance B) Pointers to class members C) Data Extraction D) None of these 53. An event that causes suspension of normal application execution is called A) Exception B) Abnormality C) Template D) None of these 54. The _ concept of OOP allows hiding of both the data fields and the methods that act on the data, inside the object A) Inheritance B) Polymorphism C) Encapsulation D) None of these Helpdesk: 66710528 [email protected] Page 4 of 16
47. ____ implies a kind of " relationship A) Aggregation B) Polymorphism C) Containership D) None of these
www.karrox.com
KARROX COLLEGE OF TECHNOLOGY & MANAGEMENT 62. If "sum 10 20 30" is typed at the command 55. Base classes are ___ while derived classes prompt what is the value of*argv [3] in the are ____ main ( )? A) specializations, sub classes B) generalizations, specializations C) generalizations, super classes D) None of these 56. Which of these interfaces of an object must be defined when creating an instance of a template? A) The "public" interface B) The "inheritance" intert'acc C) The "parameter" interface D) All of these 57. Making a date object frorn a month object, a day object and a year object is an example of A) Aggregation B) Specialization C) Instantiation D) None of these 58. ____ is a class whose instances themselves are classes A) Parametrized class B) Monolithic class C) Metaclass D) None of these 59. Which of these is an example of an assignment operator? A) && B) || C) = = D) = 60. _____ statement in C++ can be use to accomplish multi-way branching A) goto construct B) Nested if -then-else construct C) switch-case construct D) All of these 61. The ____ statements can not be used outside a loop A) break B) continue C) Both A) and B) D) None of these A) 30 B) 20 C) undefined D) None of these 63. ___ parameter receives the argument passed to it and works on it directly A) Value parameter B) Default parameter C) Reference parameter D) None of these 64. ____ variables -are automatically initialized to zero A) Register B) Static C) Global D) Both B) and C) 65. The string.h file does not contain - function A) strcmp B) strcat C) gets D) None of these 66. The default access permission for a class member is A) private B) protected C) public D) None of these 67. To solve the problem of ambiguity when inheriting from a common base class, the ____ keyword is applied before its name in the derived class header A) abstract B) virtual C) static D) None of these 68. Which of these statements about the 'this' pointer is false? A) It stores the address of the class instance to enable pointer access of' (lie members to the member functions of the class B) It is not accessible by static member functions C) It cannot be modified Helpdesk: 66710528 [email protected] Page 5 of 16
OOPS
www.karrox.com
OOPS D)None of these 69. Which of these is not valid in ci-f? A) I+47 as integer value B) "2000" as string constant C) 12.5 as float constant D) None of these
KARROX COLLEGE OF TECHNOLOGY & MANAGEMENT 75. If a is an object of class A and b is a pointer to the object a, which of these is an incorrect way to access the static display function defined in class A? A) a.display ( ); B) (*b).display C) A:display( ) D) None of these 76. When overloading a function in the same class, which of these has to be the same? A) the return type B) the types of the parameters C) the number of parameters D) the name of the function 77. ____ function operator is used to identify a destructor A) ~ B) >> C) & D) None of these 78. If y = 2, what is the value of x after executing the expression x = ++y ? A) 2 B) 3 C) 1 D) None of these 79. ___ function is used as a limit to the compiler to expand and substitute the body of the function in place of the call A) Friend B) Virtual C) Inline D) Static
70. is the base class in the 1/0 stream class hierarchy of C++ A) istream B) ostream C) ios D) ofstream 71. To write date directly in to an ASCII file, using the insertion operator (<<), we need an object of class A) istrearn B) ostream C) ios D) ofstream 72. Redirection of files is implemented by using ____ operator A)>> B) < C) > D) None of these 73. C++ uses binding of ______ functions by default A) static B) virtual C) dynamic D) None of these
74. ____ class cannot be instantiated, though pointers can be declared to it A) virtual B) friend C) abstract D) superclass
80. Given-char str [256]; how many characters at most can be actually stored in the array? A) 256 B) 255 C) 0 D) None of these
www.karrox.com
Helpdesk: 66710528
[email protected] Page 6 of 16
OOPS
PART B 81. Identify the statements that have error 1) cout << x= x; 2) cin>>x;>>y; 3) /9Addition */z = x+y; 4) cout<</n Name;<<name; A) 2), 3), 4) B) 1), 3) C) 1), 2), 4) D) 1), 2), 3), 4) 82. Match the following Set A 1) :: 2) :: 3) Set B a) Pointer to member declarator b) Pointer to member operator c) Scope resolution operator A) 1) c), 2) a), 3) b) B) 1) a), 2) b), 3) c) C) 1) c), 2) b), 3) a) D) 1) b), 2) c), 3) a) 83. Identify the situations where inline expansion may not work 1) If a loop, a switch or goto exists in functions returning values 2) If a return statement exists, for functions not returning valves 3. If functions contain static variables 4. If functions are recursive A) 1), 2), 3) B) 2), 3), 4) C) 1), 3), 4) D) 1), 2), 3), 4) 87. The ostream class includes 1) Put() 2) get() 3) putline() 4) getline() 5) write() 6) read() A) 1), 3) and 5) B) 2), 4) and 6) C) 1), 2), 3) and 4) D) 3), 4), and 5) [email protected] Page 7 of 16 3) It is visible and its lifetime is only within the class A) 1), 3) B) 1), 2) C) 2), 3) D) 1), 2), 3) 85. Which of the following are legal C++ variable names? 1) Counter 1 2) 123 3) register 4) tor_sal A) 1), 3) B) 2), 3), 4) C) 1), 3) D) 1), 2), 3), 4) 86. The advantages of OOP are 1) increased programming productivity 2) increased maintenance cost 3) decreased programming productivity 4) Decreased maintenance cost A) Only 1) B) 2) and 3) C) Only 2) D) 1) and 4)
84. Which statement are true with respect to static data members? 1) It id initialized to zero when the first object of its class is created 2) Only one copy of that member is created for the entire class www.karrox.com Helpdesk: 66710528
OOPS 88. What is the value of a and x? int i=5; a=i++; x=++i; A) a=5, x=6 B) a=5, x=7 C) a=6, x=7 D) a=5, x=5
KARROX COLLEGE OF TECHNOLOGY & MANAGEMENT C) Program; data segment D) Function; stack segment 94. In C++ ___ denotes escape characters and ___ denotes single line comment A) // and / B) / and */ C) / and // D) * and /n 95. The output of the following code if input is 32767 #include<iostream.h> void main() { int union; cout<<Enter the integer; cin>union; cout>> The next number in the series is<< **union; } A) 23768 B) Run time error C) Compilation error D) 32767 96. The ____ can be used to declared structure variable and ____ within the template. A) tag-name; can not be initialized B) tag-name; can be initialized C) key word; can not be initialized D) key word; can be initialized 97. ____ and____ operators can not be over loaded A) :: : + B) *; :: C).:* D)-;.
89. What does the following code represent? Class A {}; class B {A a;} A) Inheritance B) Derived class C) Containership D) Polymorphism 90. The different modes for opening files are 1) in 2) out 3) inout 4) ate 5) app A) 1), 2), 4) and 5) B) 1), 2), 3) and 4) C) 2), 3), 4) and 5) D) 1), 2) and 3) 91. What is the result in the variable len after execution of the following statements? int len; char strl[] = {39 March Road}; len=strlen( strl); A) 11 B) 12 C) 13 D) 14 92. ____ describes data and its functionality and its member are called____ A) functions; object B) class; object C) class; functions D) objects; class 93. The life time of static storages are for ____ and storage is done in _____ A). Program; stack segment B) Function; data segment www.karrox.com Helpdesk: 66710528
98 in C++ 1. A member function in base class can be used by objects if derived class 2. The protection can be decreased in derived classes 3. Base class can not use any data members of derived class A) Only 1 and 3 are correct B) Only 1 and 2 are correct C) Only 2 and 3 are correct D) All 1, 2 and 3 are correct [email protected] Page 8 of 16
KARROX COLLEGE OF TECHNOLOGY & MANAGEMENT D) None of these 104. Consider the following command given at the DOS prompt _ CA> multiply 10 20 30 Here "multiply" is _ i) the name of the function performing multiplication ii) the name of the file containing the program for multiplication A) i) only B) ii) only C) Both A) and B) D) None of these 105. Consider the following c++ program segment char p[20]; char *s = "string": int length = strlen (s); for (i =0; i< length ; i++) P[i] stlength - il cout << P; what is the output of the above code? A) gnirts B) string C) grurt D) No output is printed
1. User define header files are specified as # include abc.h 2. User defined header files are defined as # include abc.h 3. The template written for a base class can be used in derived class A) Only 1and 2 are correct B) Only 1 and 3 are correct C) Only 2 and 3 are correct D) Only 3 are correct 100. The base class of flow of data is 1. 2. 3. 4. iostream ios istream ostream
A) Only 1 and 2 B) Only 2 C) Only 2, 3 and 4 D) Only 1 101. What is the Output of the following function int f; int n =5; static int i =1; if(n>=5) return i; else return n; A) 5 B) 6 C) 7 D) 8 102. Which of the following operators can be overloaded in C++ ? A) > B) = C)? : D) None of these 103. Which of the following is a valid signature for overloading the preincrement operator? i) void operator ++ ( ) ii) void operator ++ (float) A) i) only B) ii) only C) Both A) and B) www.karrox.com Helpdesk: 66710528
106. In the following code segment, locate the errors and correct them this code is written to calculate area of a triangle using the formula A =1/2 * base * height // upto two digits of precision class Shape ( int base, int height) // Line 1 public: compute ( int b, int h) // Line2 return l/2*b*h // line3
getdata cin>>base>>height; Shape ( ) 1 base = 0; height = 0; // line4 A) Computation at line 3 will always result in zero; type-casting is required
[email protected] Page 9 of 16
OOPS KARROX COLLEGE OF TECHNOLOGY & MANAGEMENT B) Line 2 has to be modified to allow compute 111. What is the output of the following code to return a real number upto 2 digits of fragment when executed? int n = 1; for ( ; n ; ) precision if (n > 2) C) Both A) and B) continue; D) There are no errors ; now the function is else required that will call compute ( ) and get the cout << n +; result A) Compilation errors 107.How would you make use of the class B) Runtime errors defined in Q.46 above and get-breadth of a C) output of I and 2 & then terminates triangle computed if base and height are equal D) output of I and 2 and then infinite loop to 10 112. Assuming the Nbr variable has to be A) main() f Shapes (10, 10); cout << declared as a reference variable, which of the s.compute following is a valid way to do it? B) main shape s1 * s2; s2 & sl; A) int &Nbr; s1.getdata //H 10, 10 should be B) int& Nbr; entered by H user C) int & Nbr: cout << * s2.compute D) All of above C) main shape tri; tri. getdata //Huser 113." A home ___ house that ____ a family & enters 10, 10 pets" cout << tri.compute D)None of the above A) has a, is a B) is part of, is a 108. Which of these gives the correct C) is a, has a ' hierarchy of C++ operators from highest to D) None of these lowest precedence ? A) +, < =, && B) ++, + =, && C) &&1 ++1 < =1 = D) ++, < =, &&, +
109. Which of these is not a correct way to initialize arrays in C++? A) char n(5); For (int i=1; i<=5; i++) Cin >> n[i]; B) char name [5] = "0011"; C) static int n[2] [31 = 1 1 2, 4, 1 1, 2, 3 D) None of the above 110.Which of these is the correct way to accept a sentence of 25 characters maximum, from the user into char str [25] in C ++? A) scatift"%s", str), B) cin.getLine (str, 25, '\n'); C) cin.getline (str, '\'n'), D) None of these www.karrox.com Helpdesk: 66710528
114. Which of these is true? i) Private members can be accessed only by the class in which they are declared and by any friend classes & functions ii) Protected members are private within the class in which they are declared & are available for private access in the derived class A) i) only B) ii) only C) Both i) and ii) D) None of these 115. Fill in the blanks i) When an object of a _____ is created, the base class constructor is executed followed by its own constructor ii) ___ are applied in the reverse order in a class hierarchy [email protected] Page 10 of 16
OOPS A) friend class, templates B) derived class, destructors C) base class, constructors D) abstract class, inline function
KARROX COLLEGE OF TECHNOLOGY & MANAGEMENT B) i) and iv) C) iii) and iv) D) None of these 118. Identify the valid modes for opening files in C++. i) app ii) binary iii) ate iv) out A) i) and iii) B) ii) and iv) C) i) and iv) D) All of i) to iv) 119. Which of these code fragments gives the correct way to declare an array of pointers to object of class 'person' and initialize them using a predefined function 'getdata ( ) ? A) person *p ~ new person [10], for (int i = 0 ; i < 10 ; i + +) p[i]->getdata ( ); B) person *P [10] = new person; for (int i = 0 ; i < 10; i++) p[i]->getdata C) Both A) and B) D) None of these 120. Match the flollowing terms in Set A with their definitions in Set B Set-A i) Static variable ii) Register variable iii) Extern variable Set-B a. global variable defined in a file and referred to in other files b. a local ly-access ib le variable with global lifetime C. a temporary variable used for fast and frequent access d. a local I yacce ssib le variable with local scope A) i) - d, ii) - b, iii) - a B) i) ~ a, ii) - d, iii) - c C) i) - b, ii) - c, iii) - a D) None of these
116. Which of these declarations of functions that use default arguments is wrong'? A) void Error (char*msg, int severity = 0); B) void Error (char*msg = "Bomb", int severity); C) Both A) and B) D) None of these
117. Fill in the blanks from the given set of words. "Run-time polymorphism is implemented by using i) Operator overloading ii) Inheritance iii) Virtual functions iv) Function overloading A) ii) and iii)
PART C 121. What is the correct sequence of exception handling? 1) Controls enters the try block 2) The member function throws an exception 3) Control transfers to the exception handler following the try block 4) Code is executing normally outside try block 5) An statement in the try block causes an error in a member function www.karrox.com Helpdesk: 66710528
A) 3), 1), 2), 4), 5) B) 1), 2), 3), 4), 5) C) 5), 3), 1), 4), 2) D) 4), 1), 5), 2), 3) 122. What are the advantages of linked list? 1) We can preserve the physical order through we have a random logical order. [email protected] Page 11 of 16
OOPS KARROX COLLEGE OF TECHNOLOGY & MANAGEMENT 2) Optimum use of memory 3) New nodes can be inserted at any point A) All of the above 4) Nodes cannot be deleted B) 1), 3), 4) C) 2), 3), 4) A) 1), 2), 3) D) 3), 4) B) 2), 3) C) 1), 3), 4) 127. Identify which of the following function D) 1), 2), 3), 4) calls are allowed given the prototype declaration 123. Given the following code int sum(int a, int b-1, int c=o); struct std { A) cout<<sum(1); char name[20], grade; B) cout<<sum(1, 2); int rollno; int mark[2] C) cout<<sum(); }; D) cout<<sum(2, 2, 4); What are the valid ways to access the members? 128. Class ABC { A) std.name std.grade, std.rollno, std.mark[0] private: B) std.name[0], std.grade, std.rollno, public: std.mark[0] } C) std.name, std.grade, * std.rollno, std.mark int main() D) * std.name, * std.grade, * std.rollno, * { std.mark ABC a; Cout<<The size of class ABC is <<size of (a); 124. Assume a class C with objects obj1, obj2 } and obj3. For the statement obj3=obj1-obj2 to The output of the above program will be work correctly, the overloaded operator must 1) take two arguments A) The size of class ABC is 0 2) return a value B) The size of class ABC is 1 3) create a named temporary object C) The size of class ABC is 100 4) use the object of which it is a member as an D) Indeterminate operand A) 1), 2) B) 3), 4) C) 2), 4) D) 1), 4) 125. A pure virtual function is a virtual function that 1) causes its class to be abstract 2) returns nothing 3) is used in a base class 4) takes no arguments A) 1), 3) B) 2), 4) C) None of the above D) All of the above 126. Which of the following would be a valid class declaration header for a derived class m, with base classes n and o 1)class m: n, o 2) class m: class n, class o 3) class m: public n, public o 4) class m: public n, o www.karrox.com Helpdesk: 66710528 129. Consider the following section of code: if (base < height ) cout << Top heavy structure << endl; else cout << Stable structure << endl; Which of the following possible values for base and height cause the message Stable structure to be printed? 1. base = 5, height =3 2. base = 8, height =8 3. base = 2, height =7 A) Only 1 B) Only 1 and 2 C) Only 1 and 3 D) All 1, 2 and 3 130. What would be the output from the following program when the input is -1? void change(void) { int x; x = 1; } [email protected] Page 12 of 16
OOPS void main() { int x, z; x=0 cout>> Enter a number ; cin<<z; change(); cout<< x << endl; } A) 0 B) 1 C) -1 D) 2
KARROX COLLEGE OF TECHNOLOGY & MANAGEMENT Which functions can carry out an assignment score=1.0; to the private member variable score? A) Both f and g can carry out the assignment B) f can carry out the assignment, but not g C) g can carry out the assignment, but not f D) Neither f nor g can carry out the assignment 134. Carefully go through the following program 1. # include <iostrem.h> 2. class myclass{ 3. private 4. int num 5. public 6. myclass() {num = 0;} 7. myclass(int n) { num = n;} 8. myclass(); 9. void getdata() 10. { cin>> num;} 11. void dispdata(); 12. { cout<< endl<<NUMBER=<<num; 13. }; 14. void main(){ 15. myclass a1 16. myclass b1(5); 17. a1. dispdata();b1.dispdata(); 18. a1 getpdata(), b1.getdata(); 19. a1.dispdata(); b1.dispdata(); 20. } In the above program which lines have errors? A) 1, 6, 8, 15, 18, 20 B) 3, 8, 11, 15, 18 C) 2, 5, 10, 12, 16, 19 D) 3, 10, 14, 17, 20 135. Select correct Syntaxes 1. for (initialization; test condition; modifier expression;) 2. for (initialization1, initialization2; test conditon1, test condition2; modifier1, modifier2) { body of the loop}; 3. while (test condition) { body of the loop} 4. do { body of the loop} while (condition); A) B) C) D) 1 1 and 2 2, 3 All the above
131. What would be output by the following segment of C++? int fact I; fact = 1 i=2 while(i < =6) fact *= i; i++; cout << fact; A) 2, 6, 24, 120, 720 B) 1, 2, 6, 24, 120 C) 2, 2, 6, 24, 120 D) 1, 1, 1, 6, 24 132. Out of the following statements 1. Register is a C++ key word 2. Constant is one which has fixed value only through out the class 3. Int sample[3] [5] indicates a table of 5 rows and 3 columns 4. The first member of an enum gets value 1 5. Arrays are not allowed while declaring the structures 6. To expressions connected by an arithmetic operator is an expression A) 1, 3 and 6 are correct B) 1 and 6 are correct C) 2, 3, 5 are correct D) 2, 4 and 6 are correct 133. Consider this class definition: class quiz { public; quiz; int f(); int g() const; private; double score; } www.karrox.com Helpdesk: 66710528
136. Which of these is not a category of suffered operations? i) Primitive operations ii) Selectors iii) Selective operators [email protected] Page 13 of 16
OOPS iv) Constructors v) Exceptions A) ii) and iii) B) i) and v) C) iii), iv) and D) None of these
KARROX COLLEGE OF TECHNOLOGY & MANAGEMENT A) Compilation errors at line 1, 3, 4, 5, 6 and 7 B) Compilation errors at line I and 6 C) Compilation errors at line 5, 6 and 7 D) None of these
137. Select one of the following functions to replace the comment 4,1/here" so that the display of Base class is overridden to give output after execution as b =1 class Base int i; public: Base i=5; void display ( ) ~ cout <<"i = "<< i; class Sub : public Base int b; public : Sub b=0; A) void display ( ) 1 cout << -b="<< + + b ; ) B) display ( ) b = - cout << b = "<< b; return b;) C) void display cout << "b= << b + + D) None of these 138. Match the following pre-defined functions with then parameters, if any Set-A i) initgraph ii) closegraph iii) window iv) putch Set-B a. (char C) b. (int *gd, int mode, char*c) c. ( ) d. ( int L, int T, Int R, int B) A) i) - a, ii) - d, iii) - c, iv) - b B) i) - d, ii) - c, iii) - a, iv) - b C) i) - b, ii) - d, iii) - a, iv) - c D) None of these 139. Spot the errors in the following program Hline Hline Hline Hline Hline Hline Hline 1Class test1 int m; 2public : void getdata cin >> m; 3 main ( ) ( test *p; 4void display ( ) cout << in; 5 p = new test; 6 p.getdata ( ); 7 (*p).display ( ); Helpdesk: 66710528
140. What call you correctly infer about the following two statements? time T2 (T1); //line 1 time T2 = T1 ; //line 2 i) time is a class and TI andT2 are its objects ii) line 2 is an example of operator overloading functions used for iii) line1 is a valid example of copy constructor iv) line 2 is a valid example of tile copy T2 created in line 1 being initialized with the values of the members of object T1 A) i), ii) and iii) B) i), iii) and iv) C) i) and ii) D) None of these 141. Which of these statements is false? i) A static member function call have access to the 'this' pointer of the class ii) A static member function can access only static member data and functions of the class as well as functions outside the class iii) A static member function cannot be declared as virtual iv) A static member function has to be called only by using the instance of the class A) i), ii) and iii) B) ii) and iii) C) i) and iv) D) All of these 142. What does the following code segment do? main() { int x, m, n, y; cin >> m >>n; if m>0 and n>0 x=m; y=n; while ( x ! = y) if (X>Y) x = x y; cout << y; else v = v - x } A) The program computes tile quotient of min using repeated subtraction [email protected] Page 14 of 16
www.karrox.com
OOPS KARROX COLLEGE OF TECHNOLOGY & MANAGEMENT B) The program computer the least common multiple (LCM) of ni and n A) i) and iii) C) The program finds the remainder after B) ii) and iv) dividing m by n using repeated subtraction C) ii) and iii) D) None of these D) All of i) to iv) 143. Using tile precedence of' operators, predict the Output of the following code segment main() int i = 1, j=2 ; if ( i =--j >2) cout<< i<<1l% else cout<<"Bye<<"\n"; cout<<value of i is<<I; A) 1 Value of i is 0 B) Bye Value of i is1 C) 1 Value of D) None of these 144. Given the skeleton C++ code below, which of the following statements is false? abstract class A; //line 1 class B private A //line 2 class C :class A ; //line 3 void main ( ) ~ A //line 4 A) In line 4, compiler error is caused as class A is abstract and hence it can't be instantiated B) In line 2, class B is private derivation of class A and hence public members of class A remain private in class B and can be accessed by the member functions of B only C) In line 3, class C is public derivation of class A and so class A's public member are accessible to the objects of class C D) All of the above 145. Which of the following statements is true about friend functions? i) Friend functions cannot use member names directly; it has to use an object to access any member of the class ii) Friend functions can have objects as arguments iii) Friend class can have access to the p rivate data of the class which made it as a friend iv) Friend functions and classes defeat the purpose of OOP, especially the concepts of encapsulation and data security www.karrox.com Helpdesk: 66710528 146. Which of the following statements is false? i) Pointer of its base class can point to an object of the derived class ii) A base pointer pointing to the derived class object can access base class variables iii) A pointer of a derived class can point to an object of the base class iv) this pointer is not modifiable A) i) and iii) B) ii) and iv) C) iii) only D) None of these 147. Which of these is a correct way to handle exceptions A) throws "out of range" catch B) try throw " Allocation failure" catch (char) catch (int i) C) try i try catch i (int i) throw catch (char s) D) None of the above 148. Match the categories of graphics function in SetA with an example listed in Set-B Set-A i) Text-mode Graphics function ii) Graphics-i-node Drawing function iii) Graphics-mode Text output function iv) Graphics-mode position function Set-B a. circle b. go to xy C. putpixel d. getmax x e. putch A) i) - b, ii) - a, iii) - c, iv) d B) i) - d, ii) - c. in) - e, iv) b C) i) - c, ii) - d, iii) - b, iv) a D) None of these [email protected] Page 15 of 16
OOPS KARROX COLLEGE OF TECHNOLOGY & MANAGEMENT 149. Which of these statements are true? i) The tellp ( ) function returns the current class hierarchy ii) To create an output text file, we need an object of the ofstream class iii)The cin object and the position of the put pointer in bytes extraction operator are part of the istream class iv) The ios class is the base class in the stream A) i) and iii) B) ii) and iv) C) All of i) to iv) D) None of these 150. What is the output after executing the code below'? class A int a ; public : void showA cout << a; class B int b; public: void showB; cout << b; class C :public A, public B void main () b.showB //Hline 1 Char x; x.showC //Hline 2 x.B:: showA (); //line 3 i) compilation error in line 1 ii) compilation error in line 2 iii) compilation error in line 3 A) i) only B) ii) only C) i) and ii) D) ii) and iii) catch
www.karrox.com
Helpdesk: 66710528
[email protected] Page 16 of 16