Thursday 10 January 2019

OOPC Quiz 11/1/2019

1). How many specifiers are present in access specifiers in class?
a) 1
b) 2
c) 3
d) 4

2) Which is used to define the member of a class externally?
a) :
b) ::
c) #
d) none of the mentioned

3) Which of the following is a valid class declaration?
a) class A { int x; };
b) class B { }
c) public class A { }
d) object A { int x; };

4) Constructors are used to
a) initialize the objects
b) construct the data members
c) both initialize the objects & construct the data members
d) none of the mentioned

5) When struct is used instead of the keyword class means, what will happen in the program?
a) access is public by default
b) access is private by default
c) access is protected by default
d) none of the mentioned

6) Correct way of creating an object of a class called Car is
a) Car obj;
b) Car *obj = new Car();
c) Only B
d) A & B both

7) In C++ programming, cout is a/an
a) Function
b) Operator
c) Object
d) macro

8) Which function can be called without using an object of a class in C++
a) Static function
b) Inline function
c) Friend function
d) constant function

9) Overloaded functions in C++ oops are
a) Functions preceding with virtual keywords.
b) Functions inherited from base class to derived class.
c) Two or more functions having same name but different number of parameters or type.
d) None of above

10) Function overloading is also similar to which of the following?
a) operator overloading
b) constructor overloading
c) destructor overloading
d) none of the mentioned



Thursday 3 January 2019

OOPC Quiz 04/01






1) Constant variables can be created in CPP by using ________ .

a. enum
b. const
c. #define
d. All of these

2) In CPP, cin and cout are the predefined stream __________

a. Operator
b. Functions
c. Objects
d. Data types

3) Classes in CPP are________ .

a. derived data types
b. User defined data types
c. built-in data types
d. All of these

4)  In CPP, it is mandatory and must to initialize const variables.

a. True
b. False

5.  Logical expressions produce ____________ type results.

a. explicit
b. garbage
c. bool
d. static

6.  If a program uses Inline Function, then the function is expanded inline at ___________

a. Compile time
b. Run time
c. Both a and b
d. None of these

7. By default, members of the class are ____________ in nature.

a. protected
b. private
c. public
d. static

8. Function overloading can also be achieved if two or more functions differ only in their return types

a. True
b. False

9. Assigning one or more function body to the same name is called ____________

a. Function Overriding
b. Function Overloading
c. Both a and b
d. None of the above

10. Default values for a function are specified when ____ .

a. function is defined
b. function is declared
c. Both a and b
d. None of these

11. Default return type of functions in CPP is ____ .

a. void
b. long
c. char
d. int