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

Question:
 An object can be used to represent _________

1.A real world entity

2.A real function

3.Some real data only

4.Some function only


Question:
 Exception handling is a feature of OOP.

1.True

2.False

3.all of the above

4.None of the mentioned


Question:
 If the object is not to be passed to any function but the values of the object have to be used then?

1.The data members should be passed separately

2.The data members and member functions have to be passed separately

3. The values should be present in other variables

4.The object must be passed


Question:
 Immutable object are used _________

1.To set up as a fixed state

2. To set up variable object

3.To set up an object of abstract class

4. To set up an object of derived class


Question:
 Passing object to a function _______

1.Can be done only in one way

2.Can be done in more than one ways

3.Is not possible

4.Is not possible in OOP


Question:
 What are the constant member functions?

1. Functions which doesn’t change value of calling object

2.Functions which doesn’t change value of any object inside definition

3.Functions which doesn’t allow modification of any object of class

4.Functions which doesn’t allow modification of argument objects


Question:
 Which among doesn’t illustrates polymorphism?

1.Function overloading

2.Function overriding

3.Operator overloading

4.Virtual function


Question:
 Which among the following is the main use of object?

1.To create instance of a function

2.To create instance of a program

3.To create instance of class

4.To create instance of structures


Question:
A factory object is used ______

1.To create new classes

2.To create new function

3.To create new data members

4.To create new objects


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

1.True

2.False

3.all of the above

4.None of the mentioned


Question:
A single object can be used ________

1.As only two class types at a time

2.As only three class types at a time

3.As only one class type at a time

4.As of as many class types as required


Question:
Can a constructor function be constant?

1. Yes, always

2.Yes, only if permissions are given

3.No, because objects are not involved

4.No, never


Question:
Can data members be passed to a function using the object?

1. Yes, it can be passed only inside class functions

2.Yes, only if the data members are public and are being passed to a function outside the class

3.No, can’t be passed outside the class

4.No, can’t be done


Question:
Copy constructor definition requires ________

1.Object to be passed by value

2.Object not to be passed to it

3.Object to be passed by reference

4.Object to be passed with each data member value


Question:
Does OOP provide better security than POP?

1. Always true for any programming language

2.May not be true with respect to all programming languages

3. It depends on type of program

4.It’s vice-versa is true


Question:
If a const object calls a non-const member function then _________

1.Run time error may get produced

2.Compile time error may get produced

3. Either compile time or run time error is produced

4.The program can’t be compiled


Question:
If an object is passed by value, __________

1.Temporary object is used in the function

2. Local object in the function is used

3. Only the data member values are used

4.The values are accessible from the original object


Question:
If object is passed by value _________

1.Copy constructor is used to copy the values into another object in the function

2.Copy constructor is used to copy the values into temporary object

3. Reference to the object is used to access the values of the object

4.Reference to the object is used to created new object in its place


Question:
If same object name is given to different objects of different class then ____

1. Its compile time error

2.Its runtime error

3.It’s not an error

4.Program suns smooth


Question:
In which type is new memory location will be allocated?

1.Only in pass by reference

2. Only in pass by value

3.Both in pass by reference and value

4.Depends on the code


Question:
Java Compiler translates the source code into?

1. Machine code

2.Assembly code

3.Byte code

4.JVM code


Question:
Non-const functions ___________

1.Can be called only from non-const object

2.Can be called only from const object

3.Can be called both by const and non-const object

4.Can’t be called with object


Question:
Object cout and cin _______

1.Can be used directly with << and >> symbols respectively

2.Can be used directly with >> and << symbols respectively

3.Must be used as a function which accepts 2 arguments

4.Must be used as a function which accepts 3 arguments


Question:
Objects can be used _______

1.To access any member of a class

2. To access only public members of a class

3.To access only protected members of a class

4.To access only private members of a class


Question:
Objects type _________

1. Can be changed in runtime

2.Can’t be changed in runtime

3.Can be changed in compile time

4.May or may not get changed


Question:
Pass by reference and pass by value can’t be done simultaneously in a single function argument list.

1. True

2.False

3.all of the above

4.None of the mentioned


Question:
Pass by reference of an object to a function ______

1.Affects the object in called function only

2. Affects the object in prototype only

3.Affects the object in caller function

4.Affects the object only if mentioned with & symbol with every call


Question:
The object ________

1.Can be passed by reference

2.Can be passed by value

3. Can be passed by reference or value

4.Can be passed with reference


Question:
What are singleton objects?

1.The only two objects of a class throughout the program

2.The only object of a class throughout the program

3.The objects that are alive throughout the program

4. The objects that are created and then deleted without use


Question:
What exactly is passed when an object is passed by reference?

1.The original object name

2.The original object class name

3. The exact address of the object in memory

4.The exact address of data members


Question:
What is function object?

1.An object with a single function

2.An object with only functions

3.An object with more than one function

4. An object with no functions


Question:
What is the output of this program?

class PrintTest {
    public static void main(String args[])
    {
        int num = 10;
        if (NUM < 100) {
            System.out.println("The value of num is"+ num);
        }
    }
}

1. Compilation error

2.Run time error

3.The value of num is 10

4.None of the mentioned


Question:
What is the output of this program?

class TypeChecking {
    public static void main(String args[]) 
    {
        int num = 10.5;
        System.out.println("Output :The value of num is" +num);
    }
}

1.Output: The value of num is 10.5

2.Run-time error

3.Compilation error

4.None of the mentioned


Question:
What is the type of object that should be specified in the argument list?

1.Function name

2.Object name itself

3. Caller function name

4. Class name of object


Question:
Which among the following is not a property of an object?

1.Identity

2. Properties

3. Attributes

4.Names


Question:
Which among the following is not a use of object?

1.Defining a member function

2. Accessing data members

3.Creating instance of a class

4.Using class members


Question:
Which among the following is true?

1.More than one object can’t be passed to a function

2.Any number of objects can be passed to a function

3.Objects can’t be passed, only data member values can be passed

4.Objects should be passed only if those are public in class


Question:
Which among the following, for a pure OOP language, is true?

1. The language should follow 3 or more features of OOP

2. The language should follow at least 1 feature of OOP

3.The language must follow only 3 features of OOP

4.The language must follow all the rules of OOP


Question:
Which is a named memory location assigned a value by the program?

1.variable

2. literal

3. identifier

4.None of the mentioned


Question:
Which is the correct condition on const member functions?

1.Const member functions can’t call non-const member functions

2.Const member functions can’t call any other function

3.Const member functions can call only the functions which are neither const nor non-const

4.Const member functions can call only data members of call not member functions


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

1.Constant

2.Const

3.FunctionConst

4.Unchanged


Question:
Which object can be used to access the standard input?

1. System.inner

2. cin

3.System.stdin

4.console.input


Question:
Which object can be used to contain other objects?

1. First class object

2.Derived class object

3.Container object

4.Enclosure object


Question:
Which objects can call the const functions?

1. Only const objects

2.Only non-const objects

3.Both const and non-const objects

4. Neither const not non-const objects


Question:
Which of the following approach help us understand better about Real time examples, say Vehicle or Employee of an Organisation?

1.Procedural approach

2.Object Oriented approach

3.Both a and b

4. none of the mentioned


Question:
Which of the following approach is followed by Object Oriented Language during the execution of a program?

1. Bottom up approach

2.Top down approach

3.Both a and b

4. none of the mentioned


Question:
Which of the following is called as ‘Comiplation unit’?

1.Object file

2.Byte code

3.Source file

4.All of the Mentioned


Question:
Which of the following is/are advantage of using object oriented programming?

1.Code Reusability

2.Can create more than one instance of a class without interference

3.Platform independent

4.All of the Mentioned


Question:
Which of the following Paradigm is followed by Object Oriented Language Design?

1.Process-Oriented Model

2.Data Controlling access to code.

3. Both a and b

4.None of the mentioned


Question:
Which symbol should be used to pass the object by reference in C++?

1.&

2.@

3.$

4.$ or &


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!