On This Page

This set of CPP Programming Multiple Choice Questions & Answers (MCQs) focuses on Cpp Programming Set 4

Q1 | While overloading binary operators using member function, it requires ___ argument/s.
  • Zero
  • One
  • Two
  • Three
Q2 | Where the default value of parameter have to be specified?
  • Function call
  • Function definition
  • Function prototype
  • Both B or C
Q3 | For automatic objects, constructors and destructors are called each time the objects
  • enter and leave scope
  • inherit parent class
  • are constructed
  • are destroyed
Q4 | Which operation is used as Logical 'AND'
  • Operator-&
  • Operator-
  • Operator-&&
  • Operator +
Q5 | When an ADT is implemented as a C++ class, which of the following should normally betrue?
  • Member functions are private, member variables are public
  • Member functions are public, member variables are private
  • Member functions as well as member variables are private
  • Member functions as well as member variables are public
Q6 | Variable that are listed in function's calls are called
  • Actual parameter
  • Declared parameter
  • Passed parameter
  • None
Q7 | What kind of error can arise when there is a problem with memory?
  • Segmentation fault
  • Produce an error
  • Both Segmentation fault & Produce an error
  • None of the mentioned
Q8 | Which operations don’t throw anything?
  • Operations which are reversible
  • Operations which are irreversible
  • Operations which are static
  • Operations which are dynamic
Q9 | What operation can be performed by destructor?
  • Abort the program
  • Resource cleanup
  • Exit from the current block
  • None of the mentioned
Q10 | Which interface in the container is required for storage management?
  • Memory management
  • Allocator interface
  • Memory interface
  • None of the mentioned
Q11 | How can the member functions in the container be accessed?
  • Iterator
  • Indirect
  • Both Iterator & Indirect
  • None of the mentioned
Q12 | In which type of storage location are the vector members stored?
  • Contiguous storage locations
  • Non-contiguous storage locations
  • Contiguous & Non-contiguous storage locations
  • None of the mentioned
Q13 | What do container adapter provide to interface?
  • Restricted interface
  • More interface
  • No interface
  • None
Q14 | What does the sequence adaptor provide?
  • Insertion
  • Deletion
  • Interface to sequence container
  • None
Q15 | Which operators is part of RTTI?
  • dynamic_cast()
  • typeid
  • Both dynamic_cast() & typeid
  • None
Q16 | At which time does the static_cast can be applied?
  • Compile-time construct
  • Runtime construct
  • Both Compile-time & Runtime construct
  • None
Q17 | Which function is used to position back from the end of file object?
  • seekg
  • seekp
  • both seekg & seekp
  • None
Q18 | String class have a concat() function that is used to _____________________
  • Replace old string by new string
  • Add two strings
  • Append one string at end of another string
  • Remove a string from end of one string
Q19 | Which among the following is/are type(s) of this pointer?
  • const
  • volatile
  • const or volatile
  • int
Q20 | Which is the pointer which denotes the object calling the member function?
  • Variable pointer
  • This pointer
  • Null pointer
  • Zero pointer
Q21 | Which property is shown most when upcasting is used?
  • Code reusability
  • Code efficiency
  • Complex code simple syntax
  • Encapsulation
Q22 | If multiple inheritance is implemented, which upcasting will be correct?
  • Upcast to first base class listed in inheritance
  • Upcast to any base class
  • Upcast to send base class listed in inheritance
  • Upcast is not possible
Q23 | When are the pointer types known for upcasting the objects?
  • Compile time
  • Runtime
  • Source code build time
  • Doesn’t apply to pointer types
Q24 | Which among the following is a mandatory condition for downcasting?
  • It must not be done explicitly
  • It must be done implicitly
  • It must be done explicitly
  • It can’t be done explicitly
Q25 | Which container provides random access iterators?
  • vector
  • deque
  • sort
  • both vector & deque