C++ mcqs for interviews and exam preparation for all levels of education. Object oriented programming basic mcqs. share on
C++ Questions and Answers
- In C++ generally the near pointer take 2 bytes. The size of pointer to pointer to float will take:
- 6 bytes
- 4 bytes
- 2 bytes
- 8 bytes
- A pure virtual function is a virtual function that:
- caused its class to be abstract
- return nothing
- is used in a base class
- takes no arguments
- Note: You can choose more than one option.
- If you want to sort many large objects or structures, the most efficient way would be:
- place them in an array and sort the array
- place pointer to them in an array and sort the array
- place them in a linked list and sort the linked list
- A global variable is defined in file F1. To access the variable in file F2, you must:
- define it in F1 using extern
- define it in F2 using keyword extern
- declare it in F2 using keyword extern
- define it in F3 using extern
- To be accessed from a member function of the derived class, data or functions in the base class must be:
- public
- protected
- public or protected
Also Read:
- Actual code for a template function is generated when:
- the function declaration appears in the source code
- the function definition appears in the source code
- a call to function appears in the source code
- the function declaration appears in the source code
- Signature of the function include…
- Number of parameter
- Types of parameters
- Function name
- All of above
- A break statement inside a nested if, will do what:
- The control will be transferred to the outer if
- The control will be returned back to next statement in the outer scope
- It will be an error
- A break statement inside a swtich if, will do what:
- If there are more initializers then the number of variables then:
- compiler will ignore
- compiler will give an error
- Exceptions are thrown:
- from a throw statement to a catch block
- from the throw statement to a try block
- from the print of error to a catch block