

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.
701. |
In multi-level inheritance(all public) , the public members of parent/superclass will ________ |
A. | Will continue to get inherited subsequently |
B. | Will not be inherited after one subclass inheritance |
C. | Will not be available to be called outside class |
D. | Will not be able to allocated with any memory space |
Answer» B. Will not be inherited after one subclass inheritance | |
702. |
If a class doesn’t have public members, then________ |
A. | None of its members will be able to get inherited |
B. | None of its instance creation will be allowed |
C. | None of its member function can be called outside the class |
D. | None of its data members will be able to get initial value |
Answer» D. None of its data members will be able to get initial value | |
703. |
Which among the following is true for public class? |
A. | There can be more than one public class in a single program |
B. | Public class members can be used without using instance of class |
C. | Public class is available only within the package |
D. | Public classes can be accessed from any other class using instance |
Answer» E. | |
704. |
Which specifier can be used to inherit protected members as protected in subclass but public as public in subclass? |
A. | Private |
B. | Default |
C. | Public |
D. | Protected |
Answer» D. Protected | |
705. |
A class has its default constructor defined as public. Class B inherits class A privately. The class: |
A. | B will not be able to have instances |
B. | Only A can have instances |
C. | Only B can have instances |
D. | Both classes can have instances |
Answer» E. | |
706. |
Which among the following for public specifier is false? |
A. | The static members can’t be public |
B. | The public members are available in other packages too |
C. | The subclasses can inherit the public members privately |
D. | There can be only one public class in java program |
Answer» B. The public members are available in other packages too | |
707. |
How many public class(s) (outermost) can be there in a java program? |
A. | 1 |
B. | 2 |
C. | 3 |
D. | As required |
Answer» B. 2 | |
708. |
If members of a super class are public, then________ |
A. | All those will be available in subclasses |
B. | None of those will be available in subclasses |
C. | Only data members will be available in subclass |
D. | Only member functions will be available in subclass |
Answer» B. None of those will be available in subclasses | |
709. |
We can reduce the visibility of inherited methods. |
A. | True |
B. | false |
Answer» C. | |
710. |
Which among the following can be used for outermost class access specifier in java? |
A. | Private |
B. | Public |
C. | Default |
D. | Default or Public |
Answer» E. | |
711. |
Which among the following have least security according to the access permissions allowed? |
A. | Private |
B. | Default |
C. | Protected |
D. | Public |
Answer» E. | |
712. |
If the members have to be accessed from anywhere in program and other packages also, which access specifier should be used? |
A. | Public |
B. | Private |
C. | Protected |
D. | Default |
Answer» B. Private | |
713. |
If a class have default constructor defined in private access, and one parameter constructor in protected mode, how will it be possible to create instance of object? |
A. | Define a constructor in public access with different signature |
B. | Directly create the object in the subclass |
C. | Directly create the object in main() function |
D. | Not possible |
Answer» B. Directly create the object in the subclass | |
714. |
Protected access is same as default access that is given implicitly in java if no specifier is mentioned. |
A. | True |
B. | False |
Answer» C. | |
715. |
Which among the following can use protected access specifier? |
A. | Members which may be used in other packages |
B. | Members which have to be secure and should be used by other packages/subclass |
C. | Members which have to be accessed from anywhere in the program |
D. | Members which have to be as secure as private but can be used by main() function |
Answer» C. Members which have to be accessed from anywhere in the program | |
716. |
If protected members are to be accessed from outside the class then__________ |
A. | Members must be inherited publicly in subclass |
B. | Members must accessed using class pointers |
C. | Members must be accessed as usual |
D. | Members must be made public |
Answer» E. | |
717. |
If protected inheritance is used then _____ |
A. | Public members become public in subclass |
B. | Protected members become public in subclass |
C. | Protected members become protected in subclass |
D. | Protected and Public members become protected in subclass |
Answer» E. | |
718. |
If all the members are defined in protected specifier then ( Constructors not considered ): |
A. | Instance of class can’t be created |
B. | Instance of class can be created anywhere |
C. | Instance of class can be created only in subclasses |
D. | Instance of class can be created only in main() function |
Answer» C. Instance of class can be created only in subclasses | |
719. |
Protected members differ from default members as_______ |
A. | Protected members can be accessed outside package using inheritance, but default can’t |
B. | Default members can be accessed outside package using inheritance, but protected can’t |
C. | Protected members are allowed for inheritance but Default members are not allowed |
D. | Both are same |
Answer» B. Default members can be accessed outside package using inheritance, but protected can’t | |
720. |
If the protected members are to be made accessible only to the nearest subclass and no further subclasses, which access specifier should be used in inheritance? |
A. | The sub class should inherit the parent class privately |
B. | The sub class should inherit the parent class as protected |
C. | The sub class should inherit the parent class as public |
D. | The sub class can use any access modifier |
Answer» B. The sub class should inherit the parent class as protected | |
721. |
If a constructor is defined in protected access, then. |
A. | It’s instance can be created inside the subclasses |
B. | It’s instance can be created anywhere in the program |
C. | It’s instance can be created inside the subclasses and main() function |
D. | It’s instance can be created inside the parent class only |
Answer» B. It’s instance can be created anywhere in the program | |
722. |
Which among the following best describes the protected specifier? |
A. | Members are most secure and can’t be used outside class |
B. | Members are secure but can be used outside the class |
C. | Members are secure as private, but can be inherited |
D. | Members are secure like private, but can’t be inherited |
Answer» D. Members are secure like private, but can’t be inherited | |
723. |
Private member functions can be overloaded. |
A. | True |
B. | False |
Answer» B. False | |
724. |
Choose the correct option for the code given below class A{ static int c=0; public: A(){ c++; } }; |
A. | Constructor will make c=1 for each object created |
B. | Constructor will make c=0 for each object created |
C. | Constructor will keep number of objects created |
D. | Constructor will just initialize c=0 then increment by 1 |
Answer» D. Constructor will just initialize c=0 then increment by 1 | |
725. |
Which access specifier is/are most secure during inheritance? |
A. | Private |
B. | Default |
C. | Protected |
D. | Protected |
Answer» B. Default | |
726. |
If private members has to be accessed directly from outside the class but the access specifier must not be changed, what should be done? |
A. | Specifier must be changed |
B. | Friend function should be used |
C. | Other public members should be used |
D. | It is not possible |
Answer» C. Other public members should be used | |
727. |
Which among the following is correct to call a private member from outside the class? |
A. | object.memberfunction( parameters ); |
B. | object->memberfunction( parameters ); |
C. | object->memberfunction( parameteres); or object.memberfunction( parameters ); |
D. | Not possible |
Answer» E. | |
728. |
If a function has to be called only by using other member functions of the class, what should be the access specifier used for that function? |
A. | Private |
B. | Protected |
C. | Public |
D. | Default |
Answer» B. Protected | |
729. |
Which specifier should be used for member functions of a class? |
A. | Private |
B. | Default |
C. | Protected |
D. | Public |
Answer» E. | |
730. |
Which access specifier is usually used for data members of a class? |
A. | Private |
B. | Default |
C. | Protected |
D. | Public |
Answer» B. Default | |
731. |
Which access specifier should be used so that all the parent class members can be inherited and accessed from outside the class? |
A. | Private |
B. | Default or public |
C. | Protected or private |
D. | Public |
Answer» E. | |
732. |
If an abstract class has all the private members, then _________ |
A. | No class will be able to implement members of abstract class |
B. | Only single inheritance class can implement its members |
C. | Only other enclosing classes will be able to implement those members |
D. | No class will be able to access those members but can implement. |
Answer» B. Only single inheritance class can implement its members | |
733. |
If class B inherits class A privately. And class B has a friend function. Will the friend function be able to access the private member of class A? |
A. | Yes, because friend function can access all the members |
B. | Yes, because friend function is of class B |
C. | Yes, because friend function is of class B |
D. | No, because friend function can access private member of class A also |
Answer» D. No, because friend function can access private member of class A also | |
734. |
On which specifier’s data, does the size of a class’s object depend? |
A. | All the data members are added |
B. | Only private members are added |
C. | Only public members are added |
D. | Only default data members are added |
Answer» B. Only private members are added | |
735. |
Which access specifier should be used in a class where the instances can’t be created? |
A. | Private default constructor |
B. | All private constructors |
C. | Only default constructor to be public |
D. | Only default constructor to be protected |
Answer» C. Only default constructor to be public | |
736. |
If class A has add() function with protected access, and few other members in public . Then class B inherits class A privately. Will the user will not be able to call _________ from object of class B. |
A. | Any function of class A |
B. | The add() function of class A |
C. | Any member of class A |
D. | Private, protected and public members of class A |
Answer» E. | |
737. |
If a class has all the private members, which specifier will be used for its implicit constructor? |
A. | Private |
B. | Public |
C. | Protected |
D. | Default |
Answer» C. Protected | |
738. |
Which specifier allows a programmer to make the private members which can be inherited? |
A. | Private |
B. | Default |
C. | Protected |
D. | Protected and default |
Answer» D. Protected and default | |
739. |
Which access specifier is used when no access specifier is used with a member of class (java)? |
A. | Private |
B. | Default |
C. | Protected |
D. | Public |
Answer» C. Protected | |
740. |
Which among the following can restrict class members to get inherited? |
A. | Private |
B. | Protected |
C. | Public |
D. | All three |
Answer» B. Protected | |
741. |
Which among the following can be used together in a single class? |
A. | Only private |
B. | Private and Protected together |
C. | Private and Public together |
D. | All three together |
Answer» E. | |
742. |
How many types of access specifiers are provided in OOP (C++)? |
A. | 1 |
B. | 2 |
C. | 3 |
D. | 4 |
Answer» D. 4 | |
743. |
What happens when an object is passed by reference? |
A. | Destructor is not called |
B. | Destructor is called at end of function |
C. | Destructor is called when function is out of scope |
D. | Destructor is called when called explicitly |
Answer» B. Destructor is called at end of function | |
744. |
When an object is passed to a function, its copy is made in the function and then: |
A. | The destructor of the copy is called when function is returned |
B. | The destructor is never called in this case |
C. | The destructor is called but it is always implicit |
D. | The destructor must be user defined |
Answer» B. The destructor is never called in this case | |
745. |
Which among the following is correct for destructors concept? |
A. | Destructors can be overloaded |
B. | Destructors can have only one parameter at maximum |
C. | Destructors are always called after object goes out of scope |
D. | There can be only one destructor in a class |
Answer» E. | |
746. |
When is it advised to have user defined destructor? |
A. | When class contains some pointer to memory allocated in class |
B. | When a class contains static variables |
C. | When a class contains static functions |
D. | When a class is inheriting another class only |
Answer» B. When a class contains static variables | |
747. |
Global destructors execute in ___________ order after main function is terminated |
A. | Sequential |
B. | Random |
C. | Reverse |
D. | Depending on priority |
Answer» D. Depending on priority | |
748. |
Destructors can be ________ |
A. | Abstract type |
B. | Virtual |
C. | Void |
D. | Any type depending on situati |
Answer» C. Void | |
749. |
Destructors doesn’t accept parameters. |
A. | True |
B. | False |
Answer» B. False | |
750. |
How the constructors and destructors can be differentiated? |
A. | Destructor have a return type but constructor doesn’t |
B. | Destructors can’t be defined by the programmer, but constructors can be defined |
C. | Destructors are preceded with a tilde (~) symbol, and constructor doesn’t |
D. | Destructors are same as constructors in syntax |
Answer» D. Destructors are same as constructors in syntax | |