cpp exercise3

C++ Operators Exercise

1. Choose that operator which cannot be overloaded ?

a. /
b. ()
c. %
d. ::

Show Answer

The correct option is (d)
Explanation:
Scope resolution (::) is not permitted to be overloaded.

2.Which header file do you need to include to use typecasting?

a. ctype.h
b. math.h
c. stdin.h
d. None

Show Answer

The correct option is (d)
Explanation:
No Explanation

3. Which is a valid typecast ?

a. a(char);
b. (char)a;
c. (char)a;
d. to(char, a);

Show Answer

The correct option is (b)
Explanation:
No Explanation

4. Which is a good use for typecasting ?

a. To allow your program to use nothing but integers.
b. To change the return type of a function.
c. To swap variables rapidly.
d. To allow division of two integers to return a decimal value.

Show Answer

The correct option is (d)
Explanation:
No Explanation.

5. In CPP, dynamic memory allocation is done using ______________ operator ?

a. malloc().
b. calloc().
c. New.
d. allocate.

Show Answer

The correct option is (c)
Explanation:
No Explanation

6. Which of the following is not a false statement about new operator ?

a. It returns garbage value when memory allocation fails.
b. It automatically computes the size of the data object.
c. It can’t be overloaded
d. All of the above

Show Answer

The correct option is (b)
Explanation:
No Explanation.

7. Which of the following operator is used to release the dynamically allocated memory in CPP?

a. free.
b. delete.
c. remove.
d. both b and c

Show Answer

The correct option is (b)
Explanation:
No Explanation.

8. Which of the following is not used to seek a file pointer?

a. ios::set.
b. ios::end.
c. ios::beg
d. ios::cur

Show Answer

The correct option is (a)
Explanation:
No Explanation.

9. We can create objects of the abstract class.?

a. True
b. False

Show Answer

The correct option is (b)
Explanation:
No Explanation

  • C++ Dynamic Initialization of Objects
  • C++ Copy Constructor
  • C++ Dynamic Constructor
  • C++ Destructors
  • C++ Exercise
  • C++ Operator Overloading
  • C++ Overloading Unary Operators
  • Const pointer in C
  • Void pointer in c
  • C++ Overloading Binary Operators
  • C++ Overloading Binary Operators Using Friends
  • C++ Manipulation String Using Operators
  • C++ Rules for overloading operators
  • C++ Exercise
  • C++ Basic To class Type
  • C++ Class TO Basic Type
  • C++ One class To another class type
  • C++ Exercise
  • C++ Inheritance introduction
  • C++ Single Inheritance
  • C++ Multiple Inheritance
  • C++ Ambiguity Resolution in inheritance
  • C++ Hierarchical Inheritance
  • C++ Hybrid Inheritance
  • C++ Virtual Base Classes
  • C++ Exercise
  • C++ abstract class
  • C++ nesting of classes
  • C++ Exercise
  • C++ polymorphism
  • C++ Exercise
  • C++ pointers
  • C++ Pointers TO object
  • C++ this pointer
  • C++ Pointer to Derived class
  • C++ Virtual functions
  • C++ Exercise
  • C++ streams
  • C++ unformatted I/O operations
  • C++ Put() and get()
  • C++ getline() and write()
  • C++ Formatted console I/O
  • C++ Manipulators
  • C++ Exercise
  • C++ file handling
  • C++ file stream classes
  • C++ Open and closing file
  • C++ open using constructor
  • C++ open using open()
  • C++ Detecting End of file
  • C++ File modes
  • C++ File pointers and Manipulators
  • C++ Sequential I/O
  • C++ Reading and Writing
  • C++ Updating a File
  • C++ Error handling In File
  • C++ Command Line Arguments
  • C++ Exercise
  • C++ Template introduction
  • C++ Class Templates with multiple Parameters
  • C++ Function templates
  • C++ Function templates with multiple parameters
  • C++ member function Template
  • C++ Exercise
  • C++ Exception handling
  • C++ Basics of Exception Handling
  • C++ Exception Handling Mechanism
  • C++ Throwing Mechanism
  • C++ Catch Mechanism
  • C++ Catch all Exceptions
  • C++ Re-Throwing An Exception
  • C++ Specifying Exceptions
  • C++ Exercise