C++ interview questions part 21

C++ interview questions part 21

Take as many assements as you can to improve your validate your skill rating

Total Questions: 20

1. By seeing which operator thus this program stops getting the input? #include #include using namespace std; int main () { char ch; streambuf * p; ofstream os ("test.txt"); pbuf = os.rdbuf(); do { ch = cin.get(); p -> sputc(ch); } while (ch != '.'); os.close(); return 0; }

Correct Answer is : Depends on the compiler

2. Which member function is used to determine whether the stream object is currently associated with a file?

Correct Answer is : std:map

3. Which header file is used for reading and writing to a file?

Correct Answer is : Iterator

4. Which of the following is not one of the sizes of the floating point types?

Correct Answer is : Iterator type

5. Which of the following is a valid floating-point literal?

Correct Answer is : both start & finish

6. What is the range of the floating point numbers?

Correct Answer is : no return type

7. Which of three sizes of floating point types should be used when extended precision is required?

Correct Answer is : result of the type conversion is a valid

8. Which is used to indicate single precision value?

Correct Answer is : 4

9. Which is correct with respect to size of the data types?

Correct Answer is : converted

10. Which is used for formatting purpose in c++?

Correct Answer is : 2110

11. How many number of spaces should be set in default tab?

Correct Answer is : 2

12. What can be improved by formatting the source code?

Correct Answer is : operator float()const

13. Choose the correct formatted code.

Correct Answer is : 1 declares i,2 declares and defines i

14. Which function allows you to set minimum width for the next input?

Correct Answer is : only 4

15. What is the use of the function “showbase”?

Correct Answer is : Yes, but not a very efficient way to write programs

16. Which is used to allocate and deallocate storage for objects during the execution?

Correct Answer is : 234

17. Which operators are used in the free store?

Correct Answer is : error

18. What type of class member is operator new?

Correct Answer is : Statement 1 and 3 are wrong

19. What must be an operand of operator delete?

Correct Answer is : the number you entered

20. How can object be allocated outside the object lifetime?

Correct Answer is : 1st value: 1

Similar Interview Questions

    Search for latest jobs

    Icon
    Icon