

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.
651. |
The nested class can be declared ___________________ |
A. | Public |
B. | Private |
C. | Protected |
D. | Public, Protected, Private or Package private |
Answer» E. | |
652. |
Static nested classes doesn’t have access to _________________ from enclosing class. |
A. | Private members |
B. | Protected members |
C. | Public members |
D. | Any other members |
Answer» E. | |
653. |
Non-static nested classes have access to _____________ from enclosing class. |
A. | Private members |
B. | Protected members |
C. | Public members |
D. | All the members |
Answer» E. | |
654. |
How many categories are nested classes divided into? |
A. | 2 |
B. | 3 |
C. | 4 |
D. | 5 |
Answer» B. 3 | |
655. |
Which feature of OOP reduces the use of nested classes? |
A. | Encapsulation |
B. | Inheritance |
C. | Binding |
D. | Abstraction |
Answer» C. Binding | |
656. |
Which among the following best describes a nested class? |
A. | Class inside a class |
B. | Class inside a function |
C. | Class inside a package |
D. | Class inside a structure |
Answer» B. Class inside a function | |
657. |
Which among the following is main advantage of using local classes? |
A. | Make program more efficient |
B. | Makes program execution faster |
C. | Helps to add extra functionality to a function |
D. | Helps to add more members to a function |
Answer» D. Helps to add more members to a function | |
658. |
Can a function, other than the enclosing function of local class, access the class members? |
A. | Yes, using object |
B. | Yes, using direct call |
C. | Yes, using pointer |
D. | No, can’t access |
Answer» E. | |
659. |
What is the scope of local class? |
A. | Within the class only |
B. | Within the function |
C. | Within the program |
D. | Within the program |
Answer» C. Within the program | |
660. |
Can two different functions have local class with same name? |
A. | Yes, since local |
B. | No, names must be different |
C. | No, scope doesn’t work here |
D. | No, ambiguity arises |
Answer» B. No, names must be different | |
661. |
All the data members of local class must be ___________ |
A. | Defined with declaration |
B. | Defined in constructor |
C. | Declared and defined in constructor |
D. | Declared using a member function |
Answer» C. Declared and defined in constructor | |
662. |
How many local classes can be defined inside a single function? |
A. | Only 1 |
B. | Only 3 |
C. | Only 5 |
D. | As many as required |
Answer» E. | |
663. |
Which language can use inheritance with local classes? |
A. | Kotlin |
B. | Java |
C. | SmallTalk |
D. | SAP ABAP |
Answer» E. | |
664. |
The enclosing function has no special access to the members of local class. (True/False) |
A. | True |
B. | False |
Answer» B. False | |
665. |
All the member functions of local classes are __________ by default. |
A. | Static |
B. | Inline |
C. | Inline |
D. | Virtual |
Answer» D. Virtual | |
666. |
Can static variables be declared inside a local class? |
A. | Yes, with public access specifier |
B. | Yes, anywhere as required |
C. | No, not possible in private access specifier |
D. | No, not possible anyway |
Answer» E. | |
667. |
Local classes can access the type names and enumerators defined by the enclosing function. |
A. | True |
B. | False |
Answer» B. False | |
668. |
Which type of data can a local class access from the function in which it is defined? |
A. | Static and extern |
B. | Abstract and static |
C. | Void and extern |
D. | Const and static |
Answer» B. Abstract and static | |
669. |
Can local class members access/use the general local variables (except static, abstract etc.) of the function in which it is defined? |
A. | Yes, it can access with arrow operator |
B. | No, it can’t access with dot operator |
C. | Yes, it can access using dot operator |
D. | No, it can’t access In anyway |
Answer» E. | |
670. |
All member functions of a local class must be ___________ |
A. | Defined outside class body |
B. | Defined outside the function definition |
C. | Defined inside the class body |
D. | Defined at starting of program |
Answer» D. Defined at starting of program | |
671. |
What are local classes? |
A. | Classes declared inside a package |
B. | Classes declared inside a function |
C. | Classes declared inside a class |
D. | Classes declared inside structure |
Answer» C. Classes declared inside a class | |
672. |
Which among the following is not possible for member function? |
A. | Access protected members of parent class |
B. | Definition without return type |
C. | Access public members of subclass |
D. | Access static members of class |
Answer» D. Access static members of class | |
673. |
Which member function doesn’t require any return type? |
A. | Static |
B. | Constructor |
C. | Const |
D. | Constructor and destructor |
Answer» E. | |
674. |
A member function can _______________ of the same class |
A. | Call other member functions |
B. | Call only private member functions |
C. | Call only static member functions |
D. | Call only const member functions |
Answer» B. Call only private member functions | |
675. |
Member function of a class can ____________ |
A. | Access all the members of the class |
B. | Access only Public members of the class |
C. | Access only the private members of the class |
D. | Access subclass members |
Answer» B. Access only Public members of the class | |
676. |
Member functions of a generic class are _____________ |
A. | Not generic |
B. | Automatically generic |
C. | To be made generic explicitly |
D. | Given default type as double |
Answer» C. To be made generic explicitly | |
677. |
If a virtual member function is defined, ___________ |
A. | It should not contain any body and defined by subclasses |
B. | It must contain body and overridden by subclasses |
C. | It must contain body and be overloaded |
D. | It must not contain any body and should not be derived |
Answer» B. It must contain body and overridden by subclasses | |
678. |
For overloading “( )”, “[ ]” or “->” operators, a class __________ |
A. | Must use static member functions |
B. | Must use non-static member functions |
C. | Must be non-static member and should not be friend of class |
D. | Must use static member function or a friend member function |
Answer» D. Must use static member function or a friend member function | |
679. |
How to access members of the class inside a member function? |
A. | Using this pointer only |
B. | Using this pointer only |
C. | Using arrow operator |
D. | Used directly or with this pointer |
Answer» E. | |
680. |
Static member functions _____________ |
A. | Contains “this” pointer for data members |
B. | Contains “this” pointer if used for member functions |
C. | Doesn’t contain “this” pointer |
D. | Doesn’t contain “this” pointer if member functions are referred |
Answer» D. Doesn’t contain “this” pointer if member functions are referred | |
681. |
What happens if non static members are used in static member function? |
A. | Compile time error |
B. | Runtime error |
C. | Executes fine |
D. | Executes if that member function is not used |
Answer» B. Runtime error | |
682. |
What are inline member functions? |
A. | Member functions which can be called without object |
B. | Member functions whose definition is expanded in place of its call |
C. | Member functions whose definition is faster than simple function |
D. | Member function which is defined in single line |
Answer» C. Member functions whose definition is faster than simple function | |
683. |
How can a static member function be called in main function? |
A. | Using dot operator |
B. | Using arrow operator |
C. | Using dot or arrow operator |
D. | Using dot, arrow or using scope resolution operator with class name |
Answer» E. | |
684. |
How many types of member functions are generally there in C++? |
A. | 2 |
B. | 3 |
C. | 4 |
D. | 5 |
Answer» E. | |
685. |
Which among the following best describes member functions? |
A. | Functions which are defined within the class |
B. | Functions belonging a class |
C. | Functions in public access of a class |
D. | Functions which are private to class |
Answer» C. Functions in public access of a class | |
686. |
Which among the following is not allowed for data member declaration? |
A. | int a; |
B. | static int a; |
C. | abstract a; |
D. | Boolean a; |
Answer» D. Boolean a; | |
687. |
The arguments passed to member functions by reference are considered as data members of class. |
A. | True |
B. | False |
Answer» C. | |
688. |
Which data members can be inherited but are private to a class? |
A. | Private |
B. | Protected |
C. | Protected and Static |
D. | Privately inherited |
Answer» C. Protected and Static | |
689. |
What is the keyword used to make data members have same value? |
A. | static |
B. | Const |
C. | double |
D. | abstract |
Answer» C. double | |
690. |
A class can have self-referential data members. |
A. | True |
B. | False |
Answer» C. | |
691. |
The static member functions can only use ________ |
A. | Static data members |
B. | Private data members |
C. | Protected data members |
D. | Constant data members |
Answer» B. Private data members | |
692. |
Which among the following is true for use of setter() and getter() function? |
A. | Considered best for manipulating data values |
B. | Considered the only proper way to manipulate the values |
C. | Considered specially for private members manipulation |
D. | Considered a red flag, and not recommended for large scale use |
Answer» E. | |
693. |
To create a pointer to a private data member of a class, outside the class, which among the following is correct? |
A. | Return the address of the private data member using a member function |
B. | Access the private member using a pointer outside class |
C. | Declare the member as pointer inside the class |
D. | Not possible to create pointer to a private member |
Answer» B. Access the private member using a pointer outside class | |
694. |
How to access data members of a class? |
A. | Dot operator |
B. | Arrow operator |
C. | Dot or arrow as required |
D. | Dot, arrow or direct call |
Answer» D. Dot, arrow or direct call | |
695. |
How many data members can a class contain? |
A. | 27 |
B. | 255 |
C. | 1024 |
D. | As many as required |
Answer» E. | |
696. |
What should be done for data member to be of user defined structure type? |
A. | The structure must have been defined before class. |
B. | The structure must have been defined after the class definition |
C. | The structure must be predefined |
D. | The structure type data members can’t be used |
Answer» B. The structure must have been defined after the class definition | |
697. |
Which among the following is true for data members? |
A. | Private data members can be initialized with declaration in class |
B. | Static members are initialized in constructors |
C. | Protected data members can be initialized in class directly |
D. | Static data members are defined outside class, not in constructor |
Answer» E. | |
698. |
Data members ________________ (C++) |
A. | Can be initialized with declaration in classes |
B. | Can be initialized only with help of constructors |
C. | Can be initialized either in declaration or by constructor |
D. | Can’t be initialized |
Answer» C. Can be initialized either in declaration or by constructor | |
699. |
What is the term used to indicate the variable and constants of a class? |
A. | Data members |
B. | Variables of class |
C. | Data characters |
D. | Constants |
Answer» B. Variables of class | |
700. |
Which specifier allows to secure the public members of base class in inherited classes? |
A. | Private |
B. | Protected |
C. | Public |
D. | Private and Protected |
Answer» E. | |