OOPS/OOPS Mcq Question Set 3 Sample Test,Sample questions

Question:
 A member function can _____ of the same class.

1. Call other member functions

2.Call only private member functions

3.Call only static member functions

4.Call only const member functions

Posted Date:-2022-02-25 08:29:09


Question:
 How many types of member functions are generally there in C++?

1.2

2.3

3.4

4.5

Posted Date:-2022-02-25 08:24:06


Question:
 How many types of member functions are possible in general?

1.2

2.3

3. 4

4.5

Posted Date:-2022-02-25 08:14:49


Question:
 Member functions ______

1.Must be defined inside class body

2. Can be defined inside class body or outside

3.Must be defined outside the class body

4.Can be defined in another class

Posted Date:-2022-02-25 08:20:10


Question:
 The static members are _______

1.Created with each new object

2.Created twice in a program

3. Created as many times a class is used

4.Created and initialized only once

Posted Date:-2022-02-25 08:48:26


Question:
 We can use the static member functions and static data member _______

1.Even if class object is not created

2.Even if class is not defined

3.Even if class doesn’t contain any static member

4.Even if class doesn’t have complete definition

Posted Date:-2022-02-25 08:51:30


Question:
 What are static member functions?

1. Functions which use only static data member but can’t be accessed directly

2.Functions which uses static and other data members

3. Functions which can be accessed outside the class with the data members

4.Functions using only static data and can be accessed directly in main() function

Posted Date:-2022-02-25 08:16:10


Question:
 Which among the following best describes the inline member functions?

1.Functions defined inside the class only

2.Functions with keyword inline only

3.Functions defined outside the class

4.Functions defined inside the class or with the keyword inline

Posted Date:-2022-02-25 08:18:15


Question:
 Which among the following is not possible for member function?

1. Access protected members of parent class

2.Definition without return type

3.Access public members of subclass

4.Access static members of class

Posted Date:-2022-02-25 08:29:58


Question:
 Which keyword should be used to declare the static member functions?

1.static

2. stat

3. const

4.Common

Posted Date:-2022-02-25 08:50:20


Question:
All type of member functions can’t be used inside a single class.

1.True

2.False

3.all of the above

4.None of the mentioned

Posted Date:-2022-02-25 08:20:45


Question:
Correct syntax to access the static member functions from the main() function is _______

1.classObject::functionName();

2. className::functionName();

3.className:classObject:functionName();

4.className.classObject:functionName();

Posted Date:-2022-02-25 08:17:02


Question:
For overloading “( )”, “[ ]” or “->” operators, a class _____

1.Must use static member functions

2.Must use non-static member functions

3.Must be non-static member and should not be friend of class

4.Must use static member function or a friend member function

Posted Date:-2022-02-25 08:26:29


Question:
Functions which differ in const-ness are considered _________

1.To have same signature

2. To have different signature

3. To produce compile time error

4. To produce runtime error

Posted Date:-2022-02-25 08:12:46


Question:
How can a static member function be called in the main function?

1. Using dot operator

2.Using arrow operator

3.Using dot or arrow operator

4.Using dot, arrow or using scope resolution operator with class name

Posted Date:-2022-02-25 08:24:36


Question:
How can static member function can be accessed directly in main() function?

1. Dot operator

2.Colon

3.Scope resolution operator

4.Arrow operator

Posted Date:-2022-02-25 08:16:40


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

1.Function overriding

2. Function prototyping

3.Function overloading

4.Function declaring

Posted Date:-2022-02-25 08:11:42


Question:
How to access members of the class inside a member function?

1. Using this pointer only

2. Using dot operator

3.Using arrow operator

4. Used directly or with this pointer

Posted Date:-2022-02-25 08:26:06


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

1.const functionName(parameters);

2.const returnType functionName(parameters);

3.const functionName(returnType)(Parameters);

4.const (functionName(parameters));

Posted Date:-2022-02-25 08:12:25


Question:
If a virtual member function is defined _________

1. It should not contain any body and defined by subclasses

2. It must contain body and overridden by subclasses

3. It must contain body and be overloaded

4. It must not contain any body and should not be derived

Posted Date:-2022-02-25 08:27:14


Question:
If const version of a function when overloading is used, the function ______

1.Returns reference to object

2. Returns volatile reference

3.Returns mutable reference

4.Returns const reference

Posted Date:-2022-02-25 08:13:08


Question:
If static data member are made inline, ______

1.Those should be initialized outside the class

2.Those can’t be initialized with the class

3. Those can be initialized within the class

4. Those can’t be used by class members

Posted Date:-2022-02-25 08:52:15


Question:
Member function of a class can ______

1.Access all the members of the class

2.Access only Public members of the class

3. Access only the private members of the class

4.Access subclass members

Posted Date:-2022-02-25 08:28:18


Question:
Member functions of a generic class are ______

1.Not generic

2.Automatically generic

3.To be made generic explicitly

4.Given default type as double

Posted Date:-2022-02-25 08:27:35


Question:
Simple member functions are ________

1.Ones defined simply without any type

2.Ones defined with keyword simple

3.Ones that are implicitly provided

4.Ones which are defined in all the classes

Posted Date:-2022-02-25 08:15:17


Question:
The keyword static is used ______

1.With declaration inside class and with definition outside the class

2.With declaration inside class and not with definition outside the class

3. With declaration and definition wherever done

4.With each call to the member function

Posted Date:-2022-02-25 08:50:47


Question:
The static data member ________

1.Can be mutable

2.Can’t be mutable

3.Can’t be integer

4.Can’t be characters

Posted Date:-2022-02-25 08:51:55


Question:
The static member functions ______

1.Can’t be declared const

2.Can’t be declared volatile

3.Can’t be declared const or volatile

4.Can’t be declared const, volatile or const volatile

Posted Date:-2022-02-25 08:49:55


Question:
Use of const member function in a program ______

1. Is mandatory, always

2. Is optional, always

3. Is mandatory, if objects are used

4.Is optional, if const objects are used

Posted Date:-2022-02-25 08:14:01


Question:
What are const member functions?

1.Functions in which none of the data members can be changed in a program

2. Functions in which only static members can be changed

3.Functions which treat all the data members as constant and doesn’t allow changes

4.Functions which can change only the static members

Posted Date:-2022-02-25 08:17:50


Question:
What are friend member functions (C++)?

1.Member function which can access all the members of a class

2.Member function which can modify any data of a class

3.Member function which doesn’t have access to private members

4. Non-member functions which have access to all the members (including private) of a class

Posted Date:-2022-02-25 08:18:44


Question:
What are inline member functions?

1. Member functions which can be called without object

2.Member functions whose definition is expanded in place of its call

3.Member functions whose definition is faster than simple function

4.Member function which is defined in single line

Posted Date:-2022-02-25 08:25:28


Question:
What is the syntax of a const member function?

1. void fun() const {}

2.void fun() constant {}

3.void const fun() {}

4.const void fun(){}

Posted Date:-2022-02-25 08:19:22


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

1.Return value have to be different in const

2.Return value have to be same in const

3.Return values have to be ignored

4.Return values have to be suppressed

Posted Date:-2022-02-25 08:12:01


Question:
Which among the following best describes member function overriding?

1.Member functions having same name in base and derived classes

2.Member functions having same name in base class only

3.Member functions having same name in derived class only

4.Member functions having same name and different signature inside main function

Posted Date:-2022-02-25 08:53:08


Question:
Which among the following best describes member functions?

1.Functions which are defined within the class

2.Functions belonging a class

3.Functions in public access of a class

4.Functions which are private to class

Posted Date:-2022-02-25 08:23:20


Question:
Which among the following can’t be used to access the members in any way?

1.Scope resolution

2.Arrow operator

3. Single colon

4.Dot operator

Posted Date:-2022-02-25 08:51:08


Question:
Which among the following is correct definition for static member functions?

1.Functions created to allocate constant values to each object

2.Functions made to maintain single copy of member functions for all objects

3. Functions created to define the static members

4.Functions made to manipulate static programs

Posted Date:-2022-02-25 08:40:53


Question:
Which among the following is not applicable for the static member functions?

1.Variable pointers

2.void pointers

3.this pointer

4.Function pointers

Posted Date:-2022-02-25 08:46:00


Question:
Which among the following is proper syntax for class given below?

class A
{ 
	int a,b;
	public : void disp();
}

1.void disp::A(){ }

2.void A::disp(){ }

3.void A:disp() { cout<<a<<b ; }

4.void disp:A(){ cout<<a<<b; }

Posted Date:-2022-02-25 08:28:43


Question:
Which among the following is recommended for const functions?

1.Const function use should be reduced in a program

2.Const function use should be more in a program

3.Const function use should not matter in a program

4.Const function use should be able to modify the values

Posted Date:-2022-02-25 08:13:38


Question:
Which among the following is true?

1.Static member functions can’t be virtual

2.Static member functions can be virtual

3.Static member functions can be declared virtual if it is pure virtual class

4.Static member functions can be used as virtual in Java

Posted Date:-2022-02-25 08:46:58


Question:
Which among the following is true?

1.Static member functions can be overloaded

2.Static member functions can’t be overloaded

3. Static member functions can be overloaded using derived classes

4. Static member functions are implicitly overloaded

Posted Date:-2022-02-25 08:49:22


Question:
Which among the following is true?

1. Inheritance must not be using when overriding is used

2.Overriding can be implemented without using inheritance

3. Inheritance must be done, to use overriding are overridden

4.Inheritance is mandatory only if more than one functions

Posted Date:-2022-02-25 08:53:39


Question:
Which among the following is true?

1.Member functions can never be private

2.Member functions can never be protected

3.Member functions can never be public

4.Member functions can be defined in any access specifier

Posted Date:-2022-02-25 08:21:17


Question:
Which is correct syntax to access the static member functions with class name?

1.className . functionName;

2. className -> functionName;

3.className : functionName;

4.className :: functionName;

Posted Date:-2022-02-25 08:45:30


Question:
Which keyword is used to define the inline member function?

1. no keyword required

2.inline

3. inlined

4. line

Posted Date:-2022-02-25 08:22:19


Question:
Which keyword is used to define the static member functions?

1.static

2.stop

3.open

4. State

Posted Date:-2022-02-25 08:21:49


Question:
Which keyword is used to make a nonmember function as friend function of a class?

1.friendly

2. new

3. friend

4.Connecting lines

Posted Date:-2022-02-25 08:19:43


Question:
Which member function doesn’t require any return type?

1. Static

2.Constructor

3. Const

4. Constructor and destructor

Posted Date:-2022-02-25 08:29:36


More MCQS

  1. OOPS Mcq Question Set 1
  2. OOPS Mcq Question Set 2
  3. OOPS Mcq Question Set 3
  4. OOPS Mcq Question Set 4
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!