Explore topic-wise MCQs in Technical Programming.

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.

301.

Which call is correct for public members of a nested class?

A. Can be called from object of enclosing class
B. Can be called within enclosing class only with direct names
C. Direct names should be used for the nested classes
D. Only with help of nested class object pointer
Answer» B. Can be called within enclosing class only with direct names
302.

Which is not a proper way to access public members of a class?

A. Using object pointer with arrow operator
B. Using object of class in main function
C. Using object of class with arrow operator
D. Using object anywhere in the program
Answer» D. Using object anywhere in the program
303.

How many public members are allowed in a class?

A. Only 1
B. At most 7
C. Exactly 3
D. As many as required
Answer» E.
304.

In java, which rule among the following is applicable?

A. Keyword public can’t be preceded with all the public members
B. Keyword public must be preceded with all the public members
C. Keyword public must be post mentioned the function declaration
D. Keyword public is not mandatory
Answer» C. Keyword public must be post mentioned the function declaration
305.

Which syntax is applicable to declare public member functions in C++?

A. public:
B. public()
C. public void
D. public::
Answer» B. public()
306.

Which syntax among the following is correct for public member functions?

A. public::void functionName(parameters)
B. public void functionName(parameters)
C. public(void functionName(parameters))
D. public:-void functionName(Parameters)
Answer» C. public(void functionName(parameters))
307.

Which type of member functions get inherited in the same specifier in which the inheritance is done? (If private inheritance is used, those become private and if public used, those become public)

A. Private member functions
B. Protected member functions
C. Public member functions
D. All member functions
Answer» D. All member functions
308.

Which among the following is true for public member functions?

A. Public member functions doesn’t have a return type
B. Public member functions doesn’t have any security
C. Public member functions are declared outside the class
D. Public member functions are declared outside the class
Answer» E.
309.

What are public member functions?

A. Functions accessible outside the class but not in derived class
B. Functions accessible outside the class directly
C. Functions accessible everywhere using object of class
D. Functions that can’t be accessed outside the class
Answer» D. Functions that can’t be accessed outside the class
310.

If a function in java is declared private then it __________________

A. Can’t access the standard output
B. Can access the standard output
C. Can’t access any output stream
D. Can access only the output streams
Answer» C. Can’t access any output stream
311.

Can main() function be made private?

A. Yes, always
B. Yes, if program doesn’t contain any classes
C. No, because main function is user defined
D. No, never
Answer» E.
312.

Which error will be produced if private members are accessed?

A. Can’t access private message
B. Code unreachable
C. Core dumped
D. Bad code
Answer» B. Code unreachable
313.

A private function of a derived class can be accessed by the parent class.

A. True
B. False
Answer» C.
314.

If private members are to be called outside the class, which is a good alternative?

A. Call a public member function which calls private function
B. Call a private member function which calls private function
C. Call a protected member function which calls private function
D. Not possible
Answer» B. Call a private member function which calls private function
315.

Which function among the following can’t be accessed outside the class in java in same package?

A. public void show()
B. void show()
C. protected show()
D. static void show()
Answer» D. static void show()
316.

Private member functions ____________

A. Can’t be called from enclosing class
B. Can be accessed from enclosing class
C. Can be accessed only if nested class is private
D. Can be accessed only if nested class is public
Answer» B. Can be accessed from enclosing class
317.

How to access a private member function of a class?

A. Using object of class
B. Using object pointer
C. Using address of member function
D. Using class address
Answer» D. Using class address
318.

How many private member functions are allowed in a class ?

A. Only 1
B. Only 7
C. Only 255
D. As many as required
Answer» E.
319.

In java, which rule must be followed?

A. Keyword private preceding list of private member’s
B. Keyword private with a colon before list of private member’s
C. Keyword private with arrow before each private member
D. Keyword private preceding each private member
Answer» E.
320.

If private member functions are to be declared in C++ then _____________

A. private:
B. private
C. private(private member list)
D. private :- <private members>
Answer» B. private
321.

Which syntax among the following shows that a member is private in a class?

A. private: functionName(parameters)
B. private(functionName(parameters))
C. private functionName(parameters)
D. private::functionName(parameters)
Answer» D. private::functionName(parameters)
322.

Which member can never be accessed by inherited classes?

A. Private member function
B. Public member function
C. Protected member function
D. All can be accessed
Answer» B. Public member function
323.

Which is private member functions access scope?

A. Member functions which can only be used within the class
B. Member functions which can used outside the class
C. Member functions which are accessible in derived class
D. Member functions which can’t be accessed inside the class
Answer» B. Member functions which can used outside the class
324.

Use of const member function in a program _________________________

A. Is mandatory, always
B. Is optional, always
C. Is mandatory, if objects are used
D. Is optional, if const objects are used
Answer» C. Is mandatory, if objects are used
325.

Which among the following is recommended for const functions?

A. Const function use should be reduced in a program
B. Const function use should be more in a program
C. Const function use should not matter in a program
D. Const function use should be able to modify the values
Answer» C. Const function use should not matter in a program
326.

If const version of a function when overloading is used, the function ___________________

A. Returns reference to object
B. Returns volatile reference
C. Returns mutable reference
D. Returns const reference
Answer» E.
327.

Functions which differ in const-ness are considered ____________________

A. To have same signature
B. To have different signature
C. To produce compile time error
D. To produce runtime error
Answer» C. To produce compile time error
328.

If a function is to be made const, which is the correct syntax?

A. const functionName(parameters);
B. const returnType functionName(parameters);
C. const functionName(returnType)(Parameters);
D. const (functionName(parameters));
Answer» C. const functionName(returnType)(Parameters);
329.

When both the const and non-const version of a functions are required?

A. Return value have to be different in const
B. Return value have to be same in const
C. Return values have to be ignored
D. Return values have to be suppressed
Answer» B. Return value have to be same in const
330.

How is it possible to have both const and non-const version of a function?

A. Function overriding
B. Function prototyping
C. Function overloading
D. Function declaring
Answer» D. Function declaring
331.

A function can have both the const and non-const version in the same program.

A. True
B. False
Answer» B. False
332.

Can a constructor function be constant?

A. Yes, always
B. Yes, only if permissions are given
C. No, because objects are not involved
D. No, never
Answer» E.
333.

If a const object calls a non-const member function then ____________________

A. Run time error may get produced
B. Compile time error may get produced
C. Either compile time or run time error is produced
D. The program can’t be compiled
Answer» C. Either compile time or run time error is produced
334.

Which is a correct condition on const member functions?

A. Const member functions can’t call non-const member functions
B. Const member functions can’t call any other function
C. Const member functions can call only the functions which are neither const nor non-const
D. Const member functions can call only data members of call not member functions
Answer» B. Const member functions can’t call any other function
335.

Non-const functions _______________________

A. Can be called only from non-const object
B. Can be called only from const object
C. Can be called both by const and non-const object
D. Can’t be called with object
Answer» B. Can be called only from const object
336.

Which objects can call the const functions?

A. Only const objects
B. Only non-const objects
C. Both const and non-const objects
D. Neither const not non-const objects
Answer» D. Neither const not non-const objects
337.

Which keyword must be used to declare a member function as a constant member function?

A. Constant
B. Const
C. FunctionConst
D. Unchanged
Answer» C. FunctionConst
338.

What are constant member functions?

A. Functions which doesn’t change value of calling object
B. Functions which doesn’t change value of any object inside definition
C. Functions which doesn’t allow modification of any object of class
D. Functions which doesn’t allow modification of argument objects
Answer» B. Functions which doesn’t change value of any object inside definition
339.

Which feature of OOP is exhibited by the function overriding?

A. Inheritance
B. Abstraction
C. Polymorphism
D. Encapsulation
Answer» D. Encapsulation
340.

If virtual functions are defined in the base class then _______________

A. It is not necessary for derived classes to override those functions
B. It is necessary for derived classes to override those functions
C. Those functions can never be derived
D. Those functions must be overridden by all the derived classes
Answer» B. It is necessary for derived classes to override those functions
341.

Abstract functions of a base class _________________

A. Are overridden by the definition in same class
B. Are overridden by the definition in parent class
C. Are not overridden generally
D. Are overridden by the definition in derived class
Answer» E.
342.

In Kotlin, the function to be overridden must be ______________

A. Private
B. Open
C. Closed
D. Abstract
Answer» C. Closed
343.

What should be used to call the base class method from the derived class if function overriding is used in Java?

A. Keyword super
B. Scope resolution
C. Dot operator
D. Function name in parenthesis
Answer» B. Scope resolution
344.

In Delphi ______________

A. Method overriding is done implicitly
B. Method overriding is not supported
C. Method overriding is done with directive override
D. Method overriding is done with the directive virtually
Answer» D. Method overriding is done with the directive virtually
345.

In C# ____________________

A. Non- virtual or static methods can’t be overridden
B. Non- virtual and static methods only can be overridden
C. Overriding is not allowed
D. Overriding must be implemented using C++ code only
Answer» B. Non- virtual and static methods only can be overridden
346.

Which language doesn’t support method overriding implicitly?

A. C++
B. C#
C. Java
D. SmallTalk
Answer» C. Java
347.

The functions to be overridden _____________

A. Must be private in base class
B. Must not be private base class
C. Must be private in both derived and base class
D. Must not be private in both derived and base class
Answer» C. Must be private in both derived and base class
348.

How to access the overridden method of base class from the derived class?

A. Using arrow operator
B. using dot operator
C. Using scope resolution operator
D. Can’t be accessed once overridden
Answer» D. Can’t be accessed once overridden
349.

Exactly same declaration in base and derived class includes______________

A. Only same name
B. Only same return type and name
C. Only same return type and argument list
D. All the same return type, name and parameter list
Answer» E.
350.

Which among the following best describes member function overriding?

A. Which among the following best describes member function overriding?
B. Member functions having same name in base class only
C. Member functions having same name in derived class only
D. Member functions having same name and different signature inside main function
Answer» B. Member functions having same name in base class only