Logo educatepk.com
MCQs & Books free for all subjects and educational help  
Subscribe email alerts:
MCQs Online
MCQs on Object Oriented C++ Programming
Books
MCQs on Object Oriented C++ Programming
MCQ related to Object Oriented programming using C++ for general use and also for job preparation of Public Service Commission
Option image

Q No.1 of 10

cout stand for
Option 1
Class output
Option 2
Character output
Option 3
Common output
Option 4
Call output
Q No.2 of 10

Reference is not same as pointer because
Option 1
a reference can never be null
Option 2
a reference once established cannot be changed.
Option 3
reference does not need an explicit dereferencing mechanism
Option 4
All of these
Q No.3 of 10

It a piece of code can be implemented as a macro or as an inline function. Which of the following factors favour implementation as an inline function?
Option 1
Flexibility to manipulate as a pointer
Option 2
Interacting with other components (like variables in an expression) in the correct way.
Option 3
None of these
Option 4
All of these
Q No.4 of 10

The fields in a structure of a C program are by default
Option 1
protected
Option 2
public
Option 3
private
Option 4
none of the above
Q No.5 of 10

the fields in a class, of a C++ program are by default
Option 1
protected
Option 2
public
Option 3
private
Option 4
none of the above
Q No.6 of 10

class A
{ int i1;
protected:
int i2;
public:
int i3;
};
class B : public A
{ public:
int i4;
};
class C : B
{ };
the variable i2 is accessible


Option 1
to a public function in class A
Option 2
to public function in class B
Option 3
to a public function in class C
Option 4
all of these
Q No.7 of 10

class A
{ int i1;
protected:
int i2;
public:
int i3;
};
class B : public A
{ public:
int i4;
};
class C : B
{ };
which variable (s) is/are accessible from the main function?


Option 1
i1
Option 2
i2
Option 3
i3
Option 4
None of the above
Q No.8 of 10

Forgetting to include a file ( like cmath or math.h) that is necessary will result in
Option 1
Compilation error
Option 2
Warning when the program is run
Option 3
Error at link time
Option 4
Warning when the program is compiled
Q No.9 of 10

Assume that the random number generating function - rand ( ) , returns an integer between 0 and 10000 (both inclusive). If you want to simulate the throwing of a die using this random function, use the expression
Option 1
rand ( )% 6
Option 2
rand ( ) % 6+1
Option 3
rand ( ) % 5+1
Option 4
none of the above
Q No.10 of 10

Aassume that the random number generating function - rand ( ) , returns an integer between 0 and 10000 (both inclusive). To randomly generate a number between a rand b (both inclusive ), use the expresison
Option 1

rand (  )% (b-a)


Option 2

(rand ( )% a) + b


Option 3

(rand (  ) % (b-a+1 ))+a 


Option 4

(rand (  )  %  (  b-a +1 )) +a



Correct Answers