Solved Multiple Choice Questions of C++ set-4


1. In C++ ..................... operator is used for Dynamic memory allocation.
A) Scope resolution
B) Conditional
C) New
D) Membership access

2. Operators such as ...................... cannot be overloaded.
A) +
B) ++
C) : :
D) = =

3. The ...................... objects have values that can be tested for various error conditions.
A) osstream
B) ofstream
C) stream
D) ifstream

4. Which function return the current position of the get or put pointer in bytes.
A) tellg( )
B) tellp( )
C) tell( )
D) Both A and B

5. The first index number in an array starts with ............................ and the index number of an array of size n will be ............
A) 0, n-1
B) 1, n-1
C) 0, n
D) 1, n

6. To overload an operator ..................... keyword must be used along with the operator to be overloaded.
A) Over
B) Overload
C) Void
D) Operator

7. What is the output of the program
#include<iostream.h>

void main()
{
     int n=1;
     cout<<endl<<"The numbers are;"<<endl;
     do
           {

cout <<n<<"\t";
n++;
           } while (n<=100);
     cout <<endl;
 }

A) Print natural numbers 0 to 99
B) Print natural numbers 1 to 99
C) Print natural numbers 0 to 100
D) Print natural numbers 1 to 100

8. Everything defined at the program scope level (ie. outside functions and classes) is said to be ...............
A) local scope
B) regional scope
C) global scope
D) static scope

9. Because the lifetime of a local variable is limited and determined automatically, these variables are also called ............................
A) automator
B) automatic
C) dynamic
D) static

10. ................ allows that a section of a program is compiled only if the defined constant that is specified as the parameter has been defined, independently of its value.
A) #ifdef
B) #if
C) #define
D) #ifd

Answers

1. C) New
2. C) : :
3. D) ifstream
4. B) tellp( )
5. A) 0, n-1
6. D) Operator
7. D) Print natural numbers 1 to 100
8. C) global scope
9. B) automatic
10. A) #ifdef
Solved Multiple Choice Questions of C++ set-4 Solved Multiple Choice Questions of C++ set-4 Reviewed by mohamed on 4:07 ص Rating: 5

ليست هناك تعليقات:

يتم التشغيل بواسطة Blogger.