On This Page

This set of Object Oriented Programming OOP Multiple Choice Questions & Answers (MCQs) focuses on Object Oriented Programming Set 2

Q1 | When arguments are passed by value, the function works with the original arguments in the calling program.
  • true
  • false
Q2 | Which of the following can legitimately be passed to a function?
  • a constant
  • a variable
  • a structure
  • all of the above
Q3 | How many values can be returned from a function?
  • 0
  • 1
  • 2
  • 3
Q4 | When a function returns a value, the entire function call can appear on the right side of the equal sign and be assigned to another variable.
  • true
  • false
Q5 | When an argument is passed by reference
  • a variable is created in the function to hold the argument’s value.
  • the function cannot access the argument’s value.
  • a temporary variable is created in the calling program to hold the argument’s value.
  • the function accesses the argument’s original value in the calling program.
Q6 | Overloaded functions
  • are a group of functions with the same name.
  • all have the same number and types of arguments.
  • make life simpler for programmers.
  • a and c
Q7 | A static local variable is used to
  • make a variable visible to several functions.
  • make a variable visible to only one function.
  • retain a value when a function is not executing.
  • b and c
Q8 | In C++ there can be an array of four dimensions.
  • true
  • false
Q9 | When an array name is passed to a function, the function
  • accesses exactly the same array as the calling program.
  • refers to the array using a different name than that used by the calling program.
  • refers to the array using the same name as that used by the calling program.
  • a and b
Q10 | The compiler will complain if you try to access array element 14 in a 10-element array.
  • true
  • false
Q11 | The extraction operator (>>) stops reading a string when it encounters a space.
  • true
  • false
Q12 | You can read input that consists of multiple lines of text using
  • the normal cout <
  • the cin.get() function with one argument.
  • the cin.get() function with two arguments.
  • the cin.get() function with three arguments.
Q13 | You should prefer C-strings to the Standard C++ string class in new programs.
  • true
  • false
Q14 | Objects of the string class
  • are zero-terminated.
  • can be copied with the assignment operator.
  • do not require memory management.
  • both b and c
Q15 | Can destuctors be private in C++?
  • yes
  • no
Q16 | What is value of size?
  • 28
  • 32
  • 20
  • 24
Q17 | What value will be printed for data.i?
  • 10 220.5 230.5 unpredictable value
  • 220
  • 230.5
  • unpredictable value
Q18 | What is the compilation error for thisprogram?
  • each undeclared identifier is reported only once
  • cout and cin not declared in scope
  • invalid conversion from int to float
  • all of the above
Q19 | What will be the output of the program?
  • 1
  • default value
  • will not compile
  • none of the above
Q20 | What is the output of the program?
  • 0 0
  • x = 0 y = 0
  • compilation error
Q21 | Which function will change the state of the object?
  • only set()
  • only display()
  • display() and set() both
  • none of the above
Q22 | What will be the output of the following program?
  • compilation error: display() cannot be accessed in application
  • compilation error:test class object cannot be accessed in function demo
  • compilation error: variable x is private in test
  • both a and b
Q23 | The only integer that can be assigned directly to a pointer is                    
  • 0
  • -1
  • 999
  • -999
Q24 | Which of the following feature is not supported by C++?
  • exception handling
  • reflection
  • operator overloading
  • namespace
Q25 | The operators that cannot be overloaded is
  • *
  • -
  • ::
  • ()