[go: up one dir, main page]

0% found this document useful (0 votes)
267 views6 pages

C++ Pu Final

1. The document is a practice exam for an Object Oriented Programming Using C++ course with 75 multiple choice questions covering topics like inheritance, templates, file I/O, classes, and more. 2. The exam is divided into sections on inheritance, templates, file I/O operations, classes, constructors, and virtual functions. 3. Students are instructed to attempt any 75 questions out of the total 75 questions in a time limit of 1.5 hours for the exam.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
267 views6 pages

C++ Pu Final

1. The document is a practice exam for an Object Oriented Programming Using C++ course with 75 multiple choice questions covering topics like inheritance, templates, file I/O, classes, and more. 2. The exam is divided into sections on inheritance, templates, file I/O operations, classes, constructors, and virtual functions. 3. Students are instructed to attempt any 75 questions out of the total 75 questions in a time limit of 1.5 hours for the exam.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Axis Institute of Higher Education (KN115)

Pre-University Examination 2022-23 (Even Semester)

Program: BCA Semester: 2 Roll No.:


Course: Object Oriented Programming Using C++ Course Code: BCA 2001
Time- 1.30Hrs Total Marks- 75
Note: Attempt any 75 questions. C. A template is used for creating the attributes
D. None of the above
1. What is Inheritance in C++? 10. Which of the following best defines the syntax for
a) Wrapping of data into a single class template function ?
b) Deriving new classes from existing classes A. template return_type Function_Name(Parameters)
c) Overloading of classes B. template return_type
d) Classes with same names Function_Name(Parameters)
2. How many specifies are used to derive a class? C. Both A and B
a) 1 b) 2 c) 3 d) 4 D. None of the above
3. Which specifier makes all the data members and 11. Which is private member functions access scope?
functions of base class inaccessible by the derived class? a) Member functions which can used outside the class
a) Private b) protected c) Public d) both private and b) Member functions which are accessible in derived class
protected c) Member functions which can only be used within
4. If a class is derived privately from a base class then the class
a) no members of the base class is inherited d) Member functions which can't be accessed inside the
b) all members are accessible by the derived class class
c) all the members are inherited by the class but are 12. By default, the value of the first name in enum data
hidden and cannot be accessible type is?
d) no derivation of the class gives an error A. 0 B. 1 C. 2 D. 3
5. What is a virtual function in C++? 13. How many kinds of entities are directly
a) Any member function of a class parameterized in c++?
b) All functions that are derived from the base class A. 1 B. 2 C. 3 D. 4
c) All the members that are accessing base class data 14. From where does the template class derived?
members A. Regular non-templated C++ class
d) All the functions which are declared in the base B. Templated class
class and is re-defined/overridden by the derived class C. Both A or B
6. Which is the correct syntax of declaring a virtual D. None of the above
function? 15. Can we have overloading of the function templates?
a) virtual int func(); b) virtual int func(){}; A. Yes B. No C. May Be D. Can't Say
c) inline virtual func(); d) inline virtual (); 16. A container class is a class whose instances are
7. Which statement is incorrect about virtual function. A. Containers B. Functions C. Strings D. None
a) They are used to achieve runtime polymorphism 17. Which header file is required to use file I/O
b) They are used to hide objects operations?
c) Each virtual function declaration starts with the virtual a) <ifstream> b) <ostream>
keyword c) <fstream> d) <iostream>
d) All of the mentioned 18. Which of the following is used to create a stream that
8. What is a pure virtual function? performs both input and output operations?
a) A virtual function defined inside the base class a) ofstream b) ifstream
b) A virtual function that has no definition relative to the c) iostream d) fstream
base class 19. Which of the following is not used as a file opening
c) A virtual function that is defined inside the mode?
derived class a) ios::trunk b) ios::binary
d) Any function that is made virtual c) ios::in d) ios::ate
9. What is a template? 20. By default, all the files in C++ are opened in
A. A template is a formula for creating a generic _________ mode.
class a) Text b) Binary c) ISCII d) VTC
B. A template is used to manipulate the class
BCA 2001/ Object Oriented Programming Using C++/AIHE(KN115)
int *ptr = NULL;
delete ptr;
21. Identify the incorrect statement? a) The program is not semantically correct
a) Namespace is used to mark the beginning of the b) The program is compiled and executed
program successfully
b) used to mark the beginning & end of the program c) The program gives a compile-time error
c) to separate the class, objects d) The program compiled successfully but throws an error
d) All of the above during run-time
22. It is not possible to combine two or more file opening 33. Data members which are static
mode in open () method. A) cannot be assigned a value
a) True b) False B) can be only used in static function
23. What is the general syntax for accessing the C) cannot be defined in a union
namespace variable? D) cannot be accessed outside the class
a) namespace::operator 34. What happens if the following program is executed in
b) namespace,operator C and C++?
c) namespace#operator #include <stdio.h>
d) namespace$operator int main(void)
24. __________ is return type of is_open() function. {
a. int b. bool c. float d. char * int new = 5;
25. To perform File Input operations, we must use printf("%d", new);
_____________ header file. }
a. < ifstream> b. < ofstream> a) Error in C and successful execution in C++
c. < fstream> d. Any of these b) Error in both C and C++
26. Who invented C++? c) Error in C++ and successful execution in C
a) Dennis Ritchie b) Ken Thompson d) A successful run in both C and C++
c) Brian Kernighan d) Bjarne Stroustrup 35. Which of the following is not correct for virtual
27. What is C++? function in C++ ?.
a) C++ is an object oriented programming A. Virtual function can be static.
language B. Virtual function should be accessed using
b) C++ is a procedural programming language pointers
c) C++ supports both procedural and object C. Virtual function is defined in base class
oriented programming language D. Must be declared in public section of class
d) C++ is a functional programming language 36. How can we make a class abstract?
28. Which of the following user-defined header file A. By declaring it abstract using the static keyword
extension used in c++? B. By declaring it abstract using the virtual
a) hg b) cpp c) h d) hf keyword.
29. Which of the following is not a type of C. By making at least one member function as pure
Constructor in C++? virtual function
a) Default constructor D. By making all member functions constant
b) Parameterized constructor 37. In the case of …………….. function, arguments may
c) Copy constructor be passed either by value or by reference.
d) Friend constructor A) private B) friend C) member D) public
30. Which of the following approach is used by C++? 38. Which of these following members are not accessed
a) Left-right b) Right-left by using direct member access operator?
c) Bottom-up d) Top-down A. Public B. Private
31. What is virtual inheritance in C++? C. Protected D. Both B & C
a) C++ technique to enhance multiple inheritance 39. Which is also called as abstract class?
b) C++ technique to ensure that a private member A. Virtual function
of the base class can be accessed somehow B. Derived class
c) C++ technique to avoid multiple inheritances of classes C. Pure virtual function
d) C++ technique to avoid multiple copies of the base D. None of the mentioned
class into children/derived class
32. What happens if the following C++ statement is
compiled and executed?
BCA 2001/ Object Oriented Programming Using C++/AIHE(KN115)
40. Which of the followings is/are automatically added to 51. Which symbol is used to create multiple inheritance?
every class, if we do not write our own. A. Dot B. Comma C. Dollar D. None
A. Copy Constructor.
B. Assignment Operator 52. Which of the following function / types of function
C. A constructor without any parameter cannot have default parameters?
D. All of the above A. Member function of class
41. Which of the following gets called when an object is B. Main()
being created? C. Member function of structure
A. Constuctor B. Virtual Function D. Both B and C
C. Destructors D. Main
42. Destructor has a same name as the constructor and it 53. Which of the following in Object Oriented
is preceded by? Programming is supported by Function overloading and
A. ! B. ? C. ~ D. $ default arguments features of C++.
43. Like constructors, can there be more than one A. Inheritance B. Polymorphism
destructors in a class? C. Encapsulation D. None of these
A. Yes B. No C. May Be D. Can't Say 54. scope resolution operator is denoted by
44. Which contructor function is designed to copy object A. ! ! B. % % C. : D. : :
of same class type? 55. Which is the correct statement about operator
A. Copy constructor overloading in C++?.
B. Create constructor A. Only arithmetic operators can be overloaded
C. Object constructor B. Associativity and precedence of operators does not
D. Dynamic constructor change
45. When the inheritance is private, the private methods in C. Precedence of operators are changed after
base class are __________ in the derived class (in C++). overlaoding
A. Inaccessible B. Accessible D. Only non-arithmetic operators can be
C. Protected D. Public overloaded
46. Which design patterns benefit from the 56. Which of the following operators cannot be
multiple inheritances? overloaded?
A. Adapter and observer pattern A. .* (Pointer-to-member Operator )
B. Code pattern B. :: (Scope Resolution Operator)
C. Glue pattern C. .* (Pointer-to-member Operator )
D. None of the mentioned D. All of the above
47. What is meant by multiple inheritance? 57. While overloading binary operators using member
A. Deriving a base class from derived class function, it requires ___ argument?
B. Deriving a derived class from base class A. 2 B. 1 C. 0 D. 3
C. Deriving a derived class from more than one base 58. Which of the following operators should be preferred
class to overload as a global function rather than a member
D. None of the mentioned method?
48. Inheritance allow in C++ Program? A. Postfix ++
A. Class Re-usability B. Comparison Operator
B. Creating a hierarchy of classes C. Insertion Operator <<
C. Extendibility D. prefix ++
D. All of the above 59. : We can overload which of the following C++
49. Can we pass parameters to base class operators.
constructor though derived class or derived class A) Arithmetic operator (+, -, , /)
constructor? B) Class Member Access Operators (., .)
A. Yes B. No C. May Be D. Can't Say C) Size operator(sizeof)
50. Which of the following advantages we lose by using D) all of above
multiple inheritance? 60. Class internal area defaultly
A. Dynamic binding (A) Private (B) Public
B. Polymorphism (C) Auto (D) Protected
C. Both Dynamic binding & Polymorphism 61. Which keyword is used to represent a friend function?
D. None of the mentioned A. friend B. Friend
C. friend_func D. Friend_func
BCA 2001/ Object Oriented Programming Using C++/AIHE(KN115)
62. What is the output of below program? int main()
int main() { int a=10;
{ int b,c;
int a = 10; b = a++;
cout<<a++; c = a;
return 0; cout<<a<<b<<c;
} return 0;
(A) 10 (B) 11(C) 12 (D) Not defined }
63. Which operator has highest precedence? (A) 111011 (B) 111111
(A) () (B) = (C) * (D) ++ (C) 101011 (D) 101010
64. cin is a/an __________ . 72. Can this pointer point to another class?
A.operator B.function C.object D.macro (A) Yes (B) No
65. What is abstract class? 73. How many types of polymorphisms are supported by
(A) A class with abstract keyword C++?
(B) A class with no functions in it A.1 B.2 C.3 D.4
(C) A class with atleast one pure virtual function
(D) Empty Class 74. What is output of below program?
66. What is the output of below program? int main()
class Mycpp {
{ int i=0,x=0;
}; for(i=1;i<10;i*=2)
int main() {
{ x++;
Mycpp obj; cout<<x;
return 0; }
} cout<<x;
(A) Compilation Error - Constructor Missing return 0;
(B) Nothing would be printed }
(C) Undefined (A) 1234567899 (B) 12345678910
(D) In constructor (C) 123455 (D) 12344
67. What is the output of below program? 75. Which of the following is the correct syntax to read
class Mycpp the single character to console in the C++
{ a) Read ch() b) Getline vh()
int Mycpp() C) get(ch) d) Scanf(ch)
{ 76. Binary operators overloaded through a member
cout<<"Constructor"; function take one ____ argument.
return 0; (A) Default (B) Complete
} (C) Implicit (D) Explicit
}; 77.The operator function must be ____
int main() (A) A member function
{ (B) A friend function
Mycpp obj; (C) Either member or friend function
return 0; (D) None of the given
} 78.What is the output of below program?
(A) Constructor (B) 0 int main()
(C) Compilation Error (D) Runtime Error {
68. C++ is superset of which langauge? if(0)
(A) BASIC (B) VB (C) PASCAL (D) C {
69. What is size of void in C++? cout<<"Hi";
(A) 2 Bytes (B) 4 Bytes (C) Undefined (D) 0 }
70. Can any function call itself? else
(A) Yes (B) No {
(C) Compilation Error (D) Runtime Error cout<<"Bye";
71. What is output of below program? }
BCA 2001/ Object Oriented Programming Using C++/AIHE(KN115)
return 0; 89.Can destructors be private in C++?
} (A) Yes (B) No
(A)Hi (B) Bye (C) HiBye (D) NONE 90. Which of the following is true?
79. What is an exception in C++ program? (A) Static methods cannot be overloaded.
a) A problem that arises during the execution of a (B) Static data members can only be accessed by static
program methods.
b) A problem that arises during compilation (C) Non-static data members can be accessed by static
c) Also known as the syntax error methods.
d) Also known as semantic error (D) Static methods can only access static members
80. By default, what a program does when it detects an (data and methods)
exception? 91. Which of the following is used for generic
a) Continue running programming?
b) Results in the termination of the program a) Virtual functions
c) Calls other functions of the program b) Modules
d) Removes the exception and tells the programmer about c) Templates
an exception d) Abstract Classes
81. Why do we need to handle exceptions? 92. Which of the following is correct about templates?
a) To avoid unexpected behaviour of a program a) It is a type of compile time polymorphism
during run-time b) It allows the programmer to write one code for all data
b) To let compiler remove all exceptions by itself types
c) To successfully compile the program c) Helps in generic programming
d) To get correct output d) All of the mentioned
82. How Exception handling is implemented in the C++ 93. Which header file is used to declare the standard
program? exception?
a) Using Exception keyword a) #include<exception>
b) Using try-catch block b) #include<except>
c) Using Exception block c) #include<error>
d) Using Error handling schedules d) #include<exce>
83. Which part of the try-catch block is always fully 94. Where are standard exception classes grouped?
executed? a) namespace std b) error
a) try part b) catch part c) catch d) final
c) finally part d) throw part 95. How many types of standard exception are there in c+
84. Which of the following is an exception in C++? +?
a) Divide by zero a) 9 b) 5 c) 6 d) 7
b) Semicolon not written 96. Which of the following concepts provides facility of
c) Variable not declared using object of one class inside another class?
d) An expression is wrongly written A.Encapsulation B.Abstraction
85. What is an error in C++? C.Composition D.Inheritance
a) Violation of syntactic and semantic rules of a 97. What is virtual inheritance?
languages a) C++ technique to avoid multiple copies of the base
b) Missing of Semicolon class into children/derived class
c) Missing of double quotes b) C++ technique to avoid multiple inheritances of classes
d) ALL c) C++ technique to enhance multiple inheritance
86. What is the difference between error and exception? d) C++ technique to ensure that a private member of the
a) Both are the same base class can be accessed somehow
b) Errors can be handled at the run-time but the 98. How are the constants declared?
exceptions cannot a) const keyword
c) Exceptions can be handled at the run-time but the b) #define preprocessor
errors cannot c) both const keyword and #define preprocessor
d) Both can be handled during run-time d) $define
87. What are the different types of exceptions? 99. Polymorphism is achieved through ___
a) 1 b) 2 c) 3 d) 4 (a) Overloading (b) Encapsulation
88.Which keyword is used to throw an exception? (c) Friend (d) Abstraction.
a) try b) throw c) throws d) except
BCA 2001/ Object Oriented Programming Using C++/AIHE(KN115)
100. Which operator is used to signify the namespace in
c++?
(a) conditional operator
(b) ternary operator
(c) scope operator
(d) None of the mentioned.

BCA 2001/ Object Oriented Programming Using C++/AIHE(KN115)

You might also like