

MCQOPTIONS
Saved Bookmarks
This section includes 916 Mcqs, each offering curated multiple-choice questions to sharpen your Technical Programming knowledge and support exam preparation. Choose a topic below to get started.
801. |
Which among the following is true for static constructor? |
A. | Static constructors are called with every new object |
B. | Static constructors are used initialize data members to zero always |
C. | Static constructors can’t be parameterized constructors |
D. | Static constructors can be used to initialize the non-static members also |
Answer» D. Static constructors can be used to initialize the non-static members also | |
802. |
When and how many times a static constructor is called? |
A. | Created at time of object destruction |
B. | Called at first time when an object is created and only one time |
C. | Called at first time when an object is created and called with every new object creation |
D. | Called whenever an object go out of scope |
Answer» C. Called at first time when an object is created and called with every new object creation | |
803. |
Why do we use static constructors? |
A. | To initialize the static members of class |
B. | To initialize all the members with static value |
C. | To delete the static members when not required |
D. | To clear all the static members initialized values |
Answer» B. To initialize all the members with static value | |
804. |
Which type of constructor can’t have a return type? |
A. | Default |
B. | Parameterized |
C. | Copy |
D. | Constructors don’t have a return type |
Answer» E. | |
805. |
Which among the following is true? |
A. | Default constructor can’t be defined by the programmer |
B. | Default parameters constructor isn’t equivalent to default constructor |
C. | Default constructor can be called explicitly |
D. | Default constructor is and always called implicitly only |
Answer» D. Default constructor is and always called implicitly only | |
806. |
Which specifier applies only to the constructors? |
A. | Public |
B. | Protected |
C. | Implicit |
D. | Explicit |
Answer» E. | |
807. |
It’s necessary to pass object by reference in copy constructor because: |
A. | Constructor is not called in pass by reference |
B. | Constructor is called in pass by reference only |
C. | It passes the address of new constructor to be created |
D. | It passes the address of new object to be created |
Answer» B. Constructor is called in pass by reference only | |
808. |
Which constructor is called while assigning some object with another? |
A. | Default |
B. | Parameterized |
C. | Copy |
D. | Direct assignment is used |
Answer» D. Direct assignment is used | |
809. |
How many types of constructors are available, in general, in any language? |
A. | 2 |
B. | 3 |
C. | 4 |
D. | 5 |
Answer» C. 4 | |
810. |
For constructor overloading, each constructor must differ in ___________ and __________ |
A. | Number of arguments and type of arguments |
B. | Number of arguments and return type |
C. | Return type and type of arguments |
D. | Return type and definition |
Answer» B. Number of arguments and return type | |
811. |
Data stored in data members won’t be accessible |
A. | Implicit call to a default constructor |
B. | Explicit call to a copy constructor |
C. | Implicit call to a parameterized constructor |
D. | Explicit call to a constructor |
Answer» E. | |
812. |
If the object is passed by value to a copy constructor: |
A. | Only public members will be accessible to be copied |
B. | That will work normally |
C. | Compiler will give out of memory error |
D. | Data stored in data members won’t be accessible |
Answer» D. Data stored in data members won’t be accessible | |
813. |
Which among the following is true for copy constructor? |
A. | The argument object is passed by reference |
B. | It can be defined with zero arguments |
C. | Used when an object is passed by value to a function |
D. | Used when a function returns an object |
Answer» C. Used when an object is passed by value to a function | |
814. |
In multiple inheritance, if class C inherits two classes A and B as follows, which class constructor will be called first: class A{ }; class B{ }; class C: public A, public B{ }; |
A. | A() |
B. | B() |
C. | C() |
D. | Can’t be determined |
Answer» B. B() | |
815. |
If class C inherits class B. And B has inherited class A. Then while creating the object of class C, what will be the sequence of constructors getting called? |
A. | Constructor of C then B, finally of A |
B. | Constructor of A then C, finally of B |
C. | Constructor of C then A, finally B |
D. | Constructor of A then B, finally C |
Answer» E. | |
816. |
Default constructor must be defined, if parameterized constructor is defined and the object is to be created without arguments. |
A. | True |
B. | False |
Answer» B. False | |
817. |
If a programmer defines a class and defines a default value parameterized constructor inside it. He has not defined any default constructor. And then he try to create the object without passing arguments, which among the following will be correct? |
A. | It will not create the object (as parameterized constructor is used) |
B. | It will create the object (as the default arguments are passed ) |
C. | It will not create the object ( as the default constructor is not defined ) |
D. | It will create the object ( as at least some constructor is defined ) |
Answer» C. It will not create the object ( as the default constructor is not defined ) | |
818. |
How many types of constructors are available for use in general (with respect to parameters)? |
A. | 2 |
B. | 3 |
C. | 4 |
D. | 5 |
Answer» B. 3 | |
819. |
In which access should a constructor be defined, so that object of the class can be created in any function? |
A. | Public |
B. | Protected |
C. | Private |
D. | Any access specifier will work |
Answer» B. Protected | |
820. |
Which among the following is not a necessary condition for constructors? |
A. | Its name must be same as that of class |
B. | It must not have any return type |
C. | It must contain a definition body |
D. | It can contains arguments |
Answer» D. It can contains arguments | |
821. |
Which among the following is called first, automatically, whenever an object is created? |
A. | Class |
B. | Constructor |
C. | New |
D. | Trigger |
Answer» C. New | |
822. |
Using higher degree of abstraction __________ |
A. | May get unsafe |
B. | May reduce readability |
C. | Can be safer |
D. | Can increase vulnerability |
Answer» D. Can increase vulnerability | |
823. |
Which among the following is not a level of abstraction: |
A. | Logical level |
B. | Physical level |
C. | View level |
D. | External level |
Answer» E. | |
824. |
A phone is made up of many components like motherboard, camera, sensors and etc. If the processor represents all the functioning of phone, display shows the display only, and the phone is represented as a whole. Which among the following have highest level of abstraction? |
A. | Motherboard |
B. | Display |
C. | Camera |
D. | Phone |
Answer» E. | |
825. |
If two classes combine some private data members and provides public member functions to access and manipulate those data members. Where is abstraction used? |
A. | Using private access specifier for data members |
B. | Using class concept with both data members and member functions |
C. | Using public member functions to access and manipulate the data members |
D. | Data is not sufficient to decide what is being used |
Answer» D. Data is not sufficient to decide what is being used | |
826. |
In terms of stream and files________ |
A. | Abstraction is called a stream and device is called a file |
B. | Abstraction is called a file and device is called a stream |
C. | Abstraction can be called both file and stream |
D. | Abstraction can’t be defined in terms of files and stream |
Answer» B. Abstraction is called a file and device is called a stream | |
827. |
Encapsulation and abstraction differ as: |
A. | Binding and Hiding respectively |
B. | Hiding and Binding respectively |
C. | Can be used any way |
D. | Hiding and hiding respectively |
Answer» B. Hiding and Binding respectively | |
828. |
Higher the level of abstraction, higher are the details. |
A. | True |
B. | False |
Answer» C. | |
829. |
Abstraction principle includes___________ |
A. | Use abstraction at its minimum |
B. | Use abstraction to avoid longer codes |
C. | Use abstraction whenever possible to avoid duplication |
D. | Use abstraction whenever possible to achieve OOP |
Answer» D. Use abstraction whenever possible to achieve OOP | |
830. |
Which among the following can be viewed as combination of abstraction of data and code. |
A. | Class |
B. | Object |
C. | Inheritance |
D. | Interfaces |
Answer» C. Inheritance | |
831. |
Abstraction can apply to: |
A. | Control and data |
B. | Only data |
C. | Only control |
D. | Classes |
Answer» B. Only data | |
832. |
Abstraction gives higher degree of ________ |
A. | Class usage |
B. | Program complexity |
C. | Idealized interface |
D. | Unstable interface |
Answer» D. Unstable interface | |
833. |
Object is ________ abstraction |
A. | Object |
B. | Logical |
C. | Real |
D. | Hypothetical |
Answer» D. Hypothetical | |
834. |
Class is _________ abstraction |
A. | Object |
B. | Logical |
C. | Real |
D. | Hypothetical |
Answer» C. Real | |
835. |
Hiding the implementation complexity can: |
A. | Make the programming easy |
B. | Make the programming complex |
C. | Provide more number of features |
D. | Provide better features |
Answer» B. Make the programming complex | |
836. |
Which among the following best defines abstraction? |
A. | Hiding the implementation |
B. | Showing the important data |
C. | Hiding the important data |
D. | Hiding the implementation and showing only the features |
Answer» E. | |
837. |
Using encapsulation data security is ___________ |
A. | Not ensured |
B. | Ensured to some extent |
C. | Purely ensured |
D. | Very low |
Answer» C. Purely ensured | |
838. |
Encapsulation is the way to add functions in a user defined structure. |
A. | True |
B. | False |
Answer» C. | |
839. |
Which among the following can be a concept against encapsulation rules? |
A. | Using function pointers |
B. | Using char* string pointer to be passed to non-member function |
C. | Using object array |
D. | Using any kind of pointer/array address in passing to another function |
Answer» E. | |
840. |
Which among the following would destroy the encapsulation mechanism if it was allowed in programming? |
A. | Using access declaration for private members of base class |
B. | Using access declaration for public members of base class |
C. | Using access declaration for local variable of main() function |
D. | Using access declaration for global variables |
Answer» B. Using access declaration for public members of base class | |
841. |
Which among the following violates the principle of encapsulation almost always? |
A. | Local variables |
B. | Global variables |
C. | Public variables |
D. | Array variables |
Answer» C. Public variables | |
842. |
How can Encapsulation be achieved? |
A. | Using Access Specifiers |
B. | Using only private members |
C. | Using inheritance |
D. | Using Abstraction |
Answer» B. Using only private members | |
843. |
Which among the following should be encapsulated? |
A. | Which among the following should be encapsulated? |
B. | The data prone to change in long terms |
C. | The data which is intended to be changed |
D. | The data which belongs to some other class |
Answer» B. The data prone to change in long terms | |
844. |
Encapsulation helps in writing ___________ classes in java |
A. | Mutable |
B. | Abstract |
C. | Wrapper |
D. | Immutable |
Answer» E. | |
845. |
Find which of the following uses encapsulation? |
A. | void main(){ int a; void fun( int a=10; cout<<a); fun(); } |
B. | class student{ int a; public: int b;}; |
C. | class student{int a; public: void disp(){ cout<<a;} }; |
D. | struct topper{ char name[10]; public : int marks; }struct topper{ char name[10]; public : int marks; } |
Answer» D. struct topper{ char name[10]; public : int marks; }struct topper{ char name[10]; public : int marks; } | |
846. |
While using encapsulation, which among the following is possible? |
A. | Code modification can be additional overhead |
B. | Data member’s data type can be changed without changing any other code |
C. | Data member’s type can’t be changed, or whole code have to be changed |
D. | Member functions can be used to change the data type of data members |
Answer» C. Data member’s type can’t be changed, or whole code have to be changed | |
847. |
If data members are private, what can we do to access them from the class object? |
A. | Create public member functions to access those data members |
B. | Create private member functions to access those data members |
C. | Create protected member functions to access those data members |
D. | Private data members can never be accessed from outside the class |
Answer» B. Create private member functions to access those data members | |
848. |
Which among the following best describes encapsulation? |
A. | It is a way of combining various data members into a single unit |
B. | It is a way of combining various member functions into a single unit |
C. | It is a way of combining various data members and member functions into a single unit which can operate on any data |
D. | It is a way of combining various data members and member functions that operate on those data members into a single unit |
Answer» E. | |
849. |
If 2 classes derive one base class and redefine a function of base class, also overload some operators inside class body. Among these two things of function and operator overloading, where is polymorphism used? |
A. | Function overloading only |
B. | Operator overloading only |
C. | Both of these are using polymorphism |
D. | Either function overloading or operator overloading because polymorphism can be applied only once in a program |
Answer» E. | |
850. |
Which among the following is not true for polymorphism? |
A. | It is feature of OOP |
B. | Ease in readability of program |
C. | Helps in redefining the same functionality |
D. | Increases overhead of function definition always |
Answer» E. | |