Object Oriented Programming in C++(OOP) 22316 MCQ with answer pdf I-scheme msbte
Hi, guys today I will be sharing Object-Oriented Programming in C++(OOP) MCQ for practice and for educational purposes.
Students should practice daily with Mcq for practice for downloading the pdf at the last of the post you will find the download button from there you can download the pdf for future reference.
1. High-level languages like C, Fortran are also known as —-.
a. procedural languages
b. Object oriented language
c. form-based language
d. both a and b
2. One of the basic concepts in Object Oriented Programming approach is bundling both data and functions into one unit known as —-.
a. Simple variable
b. object
c. bundle
d. both a and b
3. Which of the following shows the Operator overloading feature in C++
a. Polymorphism
b. inheritance
c. message passing
d. both a and b
4. One of the alternatives to nested if is the —–
a. break statement
b. Jump statement
c. switch statement
d. both a and b
5. In the switch case statement, every case should have a —- statement as the last statement
a. Jump
b. break
c. exit
d. both a and b
6. Conditional operator (?:) is a handy operator which acts as a shortcut for —-
a. if-else statement
b. switch statement
c. break statement
d. goto statement
7. Arrays are —– data types.
a. Primitive
b. Non-primitive
c. user-defined
d. both b and c
8. In two-dimensional arrays, elements can be accessed by —– indexes.
a. One
b. four
c. three
d. two
9. Strings are nothing but —– arrays
a. character
b. integer
c. floating point
d. both c and b
10. If there is no value returned by the function, then the function return type should be specified as —–
a. void
b. Function name only
c. int
d. float
11. Every user-defined function should be declared in the program —–.
a. after it is used
b. before it is used
c. at the time of its invocation
d. both a and b
12. More than one user-defined functions can have the same name and perform different operations. This is a powerful feature of C++ and is known as —-
a. inheritance
b.operator loading
c. function overloading
d. both c and b
13. Classes provide users with a method to create —–data types
a. characteR
b. Primitive
c. integer
d. user-defined
14. Private data and functions can be accessed only by the —- of the class
a. Member data
b. member functions
c. friend function
d.both a and b
15. Constructors are member functions of a class that have the same name as the —–
a. class name name
b.data member
c. class name
d. other class data member
16. When using operator overloading, the operator should perform only the —-. Otherwise, it will lead to more confusion.
a. most obvious function
b. Local function
c. global function
d. both b and c
17. Which of the following operator cannot be overload?
a. Addition
b. scope resolution operator
c. multiplication
d. division
18. Operator overloading works similar to any —– of a class
a. member function
b. friend function
c. data member
d. both b and c
19. The features of the base class are said to be inherited by the —-
a. constructor
b. Protected class
c. private class
d. derived class
20. The data members in a class are usually declared —–
a. Protected
b. public
c. private
d. both a and c
21. Data members which will be inherited will have to be declared as —–
a. protected
b. public
c. private
d. both b and c
22. Multiple Inheritances is the process of inheriting a class from —– class
a. single parent
b. more than one child
c. more than one parent
d. Only one child
23. For inheritance, parent class member functions are invoked using the —- operator
a. Dot
b. scope resolution
c. colon
d.->
24. Virtual functions are primarily used in —–
a. inheritance
b. operator overloading
c. encapsulation
d. data binding
25. The header file—- is a header file containing the declarations of cin and cout classes
a. system.h
b. Stdio.h
c. iostream.h
d . process.h
26. The class istream is derived from —- which contains all the necessary functions for handling input
a. Base class
b. ios class
c. derived class
d. both a and c
27. The class fstream inherited from both iostream and fstreambase is used for files that will perform —-
a. only output
b.only input
c. both input and output
d.none of them
28. The function —– will return the last read character and will move the inside pointer, one with -1 char.
a) getline()
b) flush()
c) peek()
d) putback()
29. —- is an identifier that can be inserted into an output stream or extracted from an input stream in order to produce the desired effect.
a)Stream
b) Manipulator
c) this
d) Flag
30. A class generated from a class template is called —-
a) Inherited class
b) derived class
c) generated class
d) base class
31. When the compiler generates a class, function or static data members from a template, it is referred to as —–
a. template instantiation
b. template specialization
c. partial specialization
d. function specialization
32. What are the two basic models in the exception handling theory.
a. caught and uncaught
b. termination and resumption
c. try and block
d. none of these
33. which of these is/are the exception classes derived from logic_error
i) domain_error ii) out_of_range iii) bad_cast iv) bad_alloc
a. i),ii),iii) only
b. iv) only
c. i) and iv) only
d. iii) only
34. Stack is an example of —– structure.
a. SISO
b. FIFO
c. LIFO
d. LILO
35. The standard sequence containers include —-
i) vector ii) deque iii) list iv) stack
a. and ii) only
b. i), ii) and iii)
c. and iv) only
d. i),ii),iii) and iv)
36. The —- diagram shows the change of an object through time.
a. Activity
b. Collaboration
c. Use case
d. State
37. Which of these links is used to avoid repetition of scenarios in multiple use cases.
a. Include
b. Generalization
c. Extends
d. None of these
38. —– is a mechanism of reusing and extending existing classes without modifying them, thus producing hierarchical relationships between them.
a. Static Binding
b. Dynamic Binding
c. Inheritance
d. Virtual class
39. —– allows you to create a derived class that inherits properties from more than one base class.
a. Multilevel inheritance
b. Multiple inheritances
c. Hybrid Inheritance
d. Hierarchical Inheritance
40. —- pointers are not modifiable.
a. that
b. this
c. indirection
d. address
41. The —– and —- statements which we were using for input from keyboard and output to display screen C++.
a. Cin, cout
b. scanf, printf
c.system.out.println, printwriter
d. cin, scanf
42. The destructor is used for
a. initializing of variables
b. deallocation of memory
c. construction of variable
d. all of the above
43. #include<iostream.h>
#include<iomanip.h>
const int size=10;
void main()
{
Char str[size];
Cout<<”enter a string”;
Cin>>setw(size)>>str;
}
for the above program, maximum how many characters can be stored in the array.
a. 11 character
b. 10 character
c. 9 character
d. 8 character
44. Every function can have —- or —– arguments
a. no, only one
b. one, maximum two
c.one, any number of
d. no, any number of
45. When the object of any class, obj is created, automatically the constructor is —- and data is initialized to —–.
a. Invoked, one
b. Invoked, zero
c.declare, default
d. declare, one
46. Operator overloading provides a flexible way to work with —– and can make —- look obvious
a. object, object
b. simple varriables, program code
c. Classes, program code
d. classes, assembly code
47. The functions of the derived class can access —- members of the base class but not the —- members of the base class.
a. public and protected, private
b. private and protected, public
c. private, protected
d. private, public and protected
48. A pure virtual function is an example of —–which does not have —-.
a run time polymorphism, any function to operate.
b. polymorphism, any function to operate
c. run time polymorphism, anybody
d. class, anybody
49. Data in the program was created by —- and if more than one functions had to access data, —— were used
a. variables, local variable
b. Variables, global variables
c.program name, automatic variable
d. variable, register variable
50. which of these file open mode do you use to write into the file.
a. ios ::ate
b. ios ::in
c. ios::out
d. ios ::app
51. The current reading position, which is the index of the next byte that will be read from the file is called —–.
a. get pointer
b. set pointer
c. curr pointer
d. put pointer
52. To perform identical operations for each type of data compactly and conveniently, we use —–
a. Inline function
b. function templates.
c. this pointer
d. friend function
53. A static data member-generated from a static data member template is called —– static data member
a. inherited
b. base
c. generated
d. derived
54. Exceptions should not be used for—-
a. asynchronous events
b. ordinary error condition
c. flow of control
d. all of the above
55. —– is the exception class derived from runtime_error.
a. range_error
b. lengh_error
c. bad_typeid
d. met_error
56. From the following list identify iterator adaptors?
a. reverse iterator
b. insert iterator
c. raw storage iterator
d. all of these
57. When you wish to show the sequence of events on a broader scale, use —-
a. activity diagram
b. state diagram
c. both A) and B)
d. either A) or B)
58. State true or false
i) Attributes that are static only exist once for all instances of the class.
ii) If an attribute is declared final, its value can be changed.
a. true, false
b. true, true
c. false, false
d. false, true
59. If a function is declared virtual in its base class, you can still access it directly using the —-
a. Virtual Keyword
b. scope resolution Operator
c. Indirection Operator
d. Address Operator
60. —- is the ability of objects belonging to different types to respond to method calls of methods of the same name, each one according to appropriate type-specific behaviour.
a. Inheritance
b. Virtuality
c. Polymorphism
d. None of these.
hope you have an educational day.
Download the pdf from here.
Comments
Post a Comment